[Devel] [PATCH RHEL8 COMMIT] net/drivers/i40e: suppress warning on skb linearization
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Jun 18 20:31:56 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.45
------>
commit 3c5d79c5979c0728f7d11f0392c220c6b8a2637a
Author: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
Date: Fri Jun 18 20:31:56 2021 +0300
net/drivers/i40e: suppress warning on skb linearization
Preallocate required memory with reasoned flags and skip memory
allocation step made by __pskb_pull_tail.
https://pmc.acronis.com/browse/VSTOR-22811
Signed-off-by: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
Acked-by: Konstantin Khorenko <khorenko at virtuozzo.com>
khorenko@:
* skb buffer is provided to DMA zone, so allocation cannot be switched to
kvmalloc(), so we just supress the warning here.
* i40e_skb_linearize() code is taken from __pskb_pull_tail(),
except for the size: we omit "+128" preallocation here
because no future expansions are expected in this case.
* there is another similar place: i40e_xmit_frame_ring() in i40evf/i40e_txrx.c,
but as we did not trigger the warning there and as we just shut up the warning,
we don't touch the second place in advance.
https://jira.sw.ru/browse/PSBM-127846
(cherry-picked from vz7 commit 9b2d96420858 ("net/drivers/i40e: suppress
warning on skb linearization"))
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 1c56ec2421d4..edc094db762e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -3554,6 +3554,23 @@ static int i40e_xmit_xdp_ring(struct xdp_frame *xdpf,
return I40E_XDP_TX;
}
+
+static int i40e_skb_linearize(struct sk_buff *skb)
+{
+ int eat = (skb->tail + skb->data_len) - skb->end;
+
+ /* workaround to avoid allocation without __GFP_ORDER_NOWARN inside
+ * __pskb_pull_tail()
+ */
+ if (eat > 0 || skb_cloned(skb)) {
+ if (pskb_expand_head(skb, 0, eat > 0 ? eat : 0,
+ GFP_ATOMIC | __GFP_ORDER_NOWARN))
+ return -ENOMEM;
+ }
+
+ return __skb_linearize(skb);
+}
+
/**
* i40e_xmit_frame_ring - Sends buffer on Tx ring
* @skb: send buffer
@@ -3582,7 +3599,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
count = i40e_xmit_descriptor_count(skb);
if (i40e_chk_linearize(skb, count)) {
- if (__skb_linearize(skb)) {
+ if (i40e_skb_linearize(skb)) {
dev_kfree_skb_any(skb);
return NETDEV_TX_OK;
}
More information about the Devel
mailing list