Skip to content

Commit 67fd893

Browse files
Alexander Duyckdavem330
authored andcommitted
ethernet/intel: Use napi_alloc_skb
This change replaces calls to netdev_alloc_skb_ip_align with napi_alloc_skb. The advantage of napi_alloc_skb is currently the fact that the page allocation doesn't make use of any irq disable calls. There are few spots where I couldn't replace the calls as the buffer allocation routine is called as a part of init which is outside of the softirq context. Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent fd11a83 commit 67fd893

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

drivers/net/ethernet/intel/e1000/e1000_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4100,7 +4100,7 @@ static bool e1000_tbi_should_accept(struct e1000_adapter *adapter,
41004100
static struct sk_buff *e1000_alloc_rx_skb(struct e1000_adapter *adapter,
41014101
unsigned int bufsz)
41024102
{
4103-
struct sk_buff *skb = netdev_alloc_skb_ip_align(adapter->netdev, bufsz);
4103+
struct sk_buff *skb = napi_alloc_skb(&adapter->napi, bufsz);
41044104

41054105
if (unlikely(!skb))
41064106
adapter->alloc_rx_buff_failed++;

drivers/net/ethernet/intel/e1000e/netdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ static bool e1000_clean_rx_irq(struct e1000_ring *rx_ring, int *work_done,
10161016
*/
10171017
if (length < copybreak) {
10181018
struct sk_buff *new_skb =
1019-
netdev_alloc_skb_ip_align(netdev, length);
1019+
napi_alloc_skb(&adapter->napi, length);
10201020
if (new_skb) {
10211021
skb_copy_to_linear_data_offset(new_skb,
10221022
-NET_IP_ALIGN,

drivers/net/ethernet/intel/fm10k/fm10k_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ static struct sk_buff *fm10k_fetch_rx_buffer(struct fm10k_ring *rx_ring,
308308
#endif
309309

310310
/* allocate a skb to store the frags */
311-
skb = netdev_alloc_skb_ip_align(rx_ring->netdev,
312-
FM10K_RX_HDR_LEN);
311+
skb = napi_alloc_skb(&rx_ring->q_vector->napi,
312+
FM10K_RX_HDR_LEN);
313313
if (unlikely(!skb)) {
314314
rx_ring->rx_stats.alloc_failed++;
315315
return NULL;

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6644,8 +6644,7 @@ static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring,
66446644
#endif
66456645

66466646
/* allocate a skb to store the frags */
6647-
skb = netdev_alloc_skb_ip_align(rx_ring->netdev,
6648-
IGB_RX_HDR_LEN);
6647+
skb = napi_alloc_skb(&rx_ring->q_vector->napi, IGB_RX_HDR_LEN);
66496648
if (unlikely(!skb)) {
66506649
rx_ring->rx_stats.alloc_failed++;
66516650
return NULL;

drivers/net/ethernet/intel/ixgb/ixgb_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,7 +1963,7 @@ ixgb_rx_checksum(struct ixgb_adapter *adapter,
19631963
* this should improve performance for small packets with large amounts
19641964
* of reassembly being done in the stack
19651965
*/
1966-
static void ixgb_check_copybreak(struct net_device *netdev,
1966+
static void ixgb_check_copybreak(struct napi_struct *napi,
19671967
struct ixgb_buffer *buffer_info,
19681968
u32 length, struct sk_buff **skb)
19691969
{
@@ -1972,7 +1972,7 @@ static void ixgb_check_copybreak(struct net_device *netdev,
19721972
if (length > copybreak)
19731973
return;
19741974

1975-
new_skb = netdev_alloc_skb_ip_align(netdev, length);
1975+
new_skb = napi_alloc_skb(napi, length);
19761976
if (!new_skb)
19771977
return;
19781978

@@ -2064,7 +2064,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do)
20642064
goto rxdesc_done;
20652065
}
20662066

2067-
ixgb_check_copybreak(netdev, buffer_info, length, &skb);
2067+
ixgb_check_copybreak(&adapter->napi, buffer_info, length, &skb);
20682068

20692069
/* Good Receive */
20702070
skb_put(skb, length);

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,8 +1913,8 @@ static struct sk_buff *ixgbe_fetch_rx_buffer(struct ixgbe_ring *rx_ring,
19131913
#endif
19141914

19151915
/* allocate a skb to store the frags */
1916-
skb = netdev_alloc_skb_ip_align(rx_ring->netdev,
1917-
IXGBE_RX_HDR_SIZE);
1916+
skb = napi_alloc_skb(&rx_ring->q_vector->napi,
1917+
IXGBE_RX_HDR_SIZE);
19181918
if (unlikely(!skb)) {
19191919
rx_ring->rx_stats.alloc_rx_buff_failed++;
19201920
return NULL;

0 commit comments

Comments
 (0)