[Devel] [PATCH RHEL7 COMMIT] net/drivers/i40e: suppress warning on skb linearization
Konstantin Khorenko
khorenko at virtuozzo.com
Wed May 22 18:10:50 MSK 2019
The commit is pushed to "branch-rh7-3.10.0-957.12.2.vz7.96.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.12.2.vz7.96.2
------>
commit f0e8204b7b80c332aecd1074a7407a1ba8ef14d1
Author: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
Date: Wed May 22 18:10:48 2019 +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.
---
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 90559320fa16..8855c7a42276 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -3526,6 +3526,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
@@ -3554,7 +3571,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