diff options
author | Emil Tantilov <emil.s.tantilov@intel.com> | 2014-11-07 20:39:25 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2014-11-20 17:21:31 -0500 |
commit | dff80520335ac79eed1cd62fcbb7156a6557d94e (patch) | |
tree | c870790acacc45e47a76360bf08d3acada5f0ee9 /drivers/net/ethernet/intel | |
parent | ec62fe264110a021336de20e400bc778a4111f60 (diff) |
ixgbevf: Combine the logic for post Rx processing into single function
This patch cleans up ixgbevf_clean_rx_irq() by merging several similar
operations into a new function - ixgbevf_process_skb_fields().
CC: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 68 |
2 files changed, 38 insertions, 34 deletions
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h index 5f7d2f3c738d..90d5751b7f92 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | |||
@@ -346,8 +346,10 @@ static inline void ixgbevf_write_tail(struct ixgbevf_ring *ring, u32 value) | |||
346 | 346 | ||
347 | /* board specific private data structure */ | 347 | /* board specific private data structure */ |
348 | struct ixgbevf_adapter { | 348 | struct ixgbevf_adapter { |
349 | struct timer_list watchdog_timer; | 349 | /* this field must be first, see ixgbevf_process_skb_fields */ |
350 | unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; | 350 | unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; |
351 | |||
352 | struct timer_list watchdog_timer; | ||
351 | struct work_struct reset_task; | 353 | struct work_struct reset_task; |
352 | struct ixgbevf_q_vector *q_vector[MAX_MSIX_Q_VECTORS]; | 354 | struct ixgbevf_q_vector *q_vector[MAX_MSIX_Q_VECTORS]; |
353 | 355 | ||
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index 19062dcf1e80..36b005e58930 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -328,37 +328,12 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_q_vector *q_vector, | |||
328 | } | 328 | } |
329 | 329 | ||
330 | /** | 330 | /** |
331 | * ixgbevf_receive_skb - Send a completed packet up the stack | ||
332 | * @q_vector: structure containing interrupt and ring information | ||
333 | * @skb: packet to send up | ||
334 | * @rx_desc: rx descriptor | ||
335 | **/ | ||
336 | static void ixgbevf_receive_skb(struct ixgbevf_q_vector *q_vector, | ||
337 | struct sk_buff *skb, | ||
338 | union ixgbe_adv_rx_desc *rx_desc) | ||
339 | { | ||
340 | struct ixgbevf_adapter *adapter = q_vector->adapter; | ||
341 | bool is_vlan = !!ixgbevf_test_staterr(rx_desc, IXGBE_RXD_STAT_VP); | ||
342 | u16 tag = le16_to_cpu(rx_desc->wb.upper.vlan); | ||
343 | |||
344 | if (is_vlan && test_bit(tag & VLAN_VID_MASK, adapter->active_vlans)) | ||
345 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), tag); | ||
346 | |||
347 | if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) | ||
348 | napi_gro_receive(&q_vector->napi, skb); | ||
349 | else | ||
350 | netif_rx(skb); | ||
351 | } | ||
352 | |||
353 | /** | ||
354 | * ixgbevf_rx_skb - Helper function to determine proper Rx method | 331 | * ixgbevf_rx_skb - Helper function to determine proper Rx method |
355 | * @q_vector: structure containing interrupt and ring information | 332 | * @q_vector: structure containing interrupt and ring information |
356 | * @skb: packet to send up | 333 | * @skb: packet to send up |
357 | * @rx_desc: rx descriptor | ||
358 | **/ | 334 | **/ |
359 | static void ixgbevf_rx_skb(struct ixgbevf_q_vector *q_vector, | 335 | static void ixgbevf_rx_skb(struct ixgbevf_q_vector *q_vector, |
360 | struct sk_buff *skb, | 336 | struct sk_buff *skb) |
361 | union ixgbe_adv_rx_desc *rx_desc) | ||
362 | { | 337 | { |
363 | #ifdef CONFIG_NET_RX_BUSY_POLL | 338 | #ifdef CONFIG_NET_RX_BUSY_POLL |
364 | skb_mark_napi_id(skb, &q_vector->napi); | 339 | skb_mark_napi_id(skb, &q_vector->napi); |
@@ -369,8 +344,10 @@ static void ixgbevf_rx_skb(struct ixgbevf_q_vector *q_vector, | |||
369 | return; | 344 | return; |
370 | } | 345 | } |
371 | #endif /* CONFIG_NET_RX_BUSY_POLL */ | 346 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
372 | 347 | if (!(q_vector->adapter->flags & IXGBE_FLAG_IN_NETPOLL)) | |
373 | ixgbevf_receive_skb(q_vector, skb, rx_desc); | 348 | napi_gro_receive(&q_vector->napi, skb); |
349 | else | ||
350 | netif_rx(skb); | ||
374 | } | 351 | } |
375 | 352 | ||
376 | /* ixgbevf_rx_checksum - indicate in skb if hw indicated a good cksum | 353 | /* ixgbevf_rx_checksum - indicate in skb if hw indicated a good cksum |
@@ -407,6 +384,32 @@ static inline void ixgbevf_rx_checksum(struct ixgbevf_ring *ring, | |||
407 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 384 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
408 | } | 385 | } |
409 | 386 | ||
387 | /* ixgbevf_process_skb_fields - Populate skb header fields from Rx descriptor | ||
388 | * @rx_ring: rx descriptor ring packet is being transacted on | ||
389 | * @rx_desc: pointer to the EOP Rx descriptor | ||
390 | * @skb: pointer to current skb being populated | ||
391 | * | ||
392 | * This function checks the ring, descriptor, and packet information in | ||
393 | * order to populate the checksum, VLAN, protocol, and other fields within | ||
394 | * the skb. | ||
395 | */ | ||
396 | static void ixgbevf_process_skb_fields(struct ixgbevf_ring *rx_ring, | ||
397 | union ixgbe_adv_rx_desc *rx_desc, | ||
398 | struct sk_buff *skb) | ||
399 | { | ||
400 | ixgbevf_rx_checksum(rx_ring, rx_desc, skb); | ||
401 | |||
402 | if (ixgbevf_test_staterr(rx_desc, IXGBE_RXD_STAT_VP)) { | ||
403 | u16 vid = le16_to_cpu(rx_desc->wb.upper.vlan); | ||
404 | unsigned long *active_vlans = netdev_priv(rx_ring->netdev); | ||
405 | |||
406 | if (test_bit(vid & VLAN_VID_MASK, active_vlans)) | ||
407 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid); | ||
408 | } | ||
409 | |||
410 | skb->protocol = eth_type_trans(skb, rx_ring->netdev); | ||
411 | } | ||
412 | |||
410 | static bool ixgbevf_alloc_mapped_skb(struct ixgbevf_ring *rx_ring, | 413 | static bool ixgbevf_alloc_mapped_skb(struct ixgbevf_ring *rx_ring, |
411 | struct ixgbevf_rx_buffer *bi) | 414 | struct ixgbevf_rx_buffer *bi) |
412 | { | 415 | { |
@@ -576,14 +579,10 @@ static int ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector, | |||
576 | goto next_desc; | 579 | goto next_desc; |
577 | } | 580 | } |
578 | 581 | ||
579 | ixgbevf_rx_checksum(rx_ring, rx_desc, skb); | ||
580 | |||
581 | /* probably a little skewed due to removing CRC */ | 582 | /* probably a little skewed due to removing CRC */ |
582 | total_rx_bytes += skb->len; | 583 | total_rx_bytes += skb->len; |
583 | total_rx_packets++; | 584 | total_rx_packets++; |
584 | 585 | ||
585 | skb->protocol = eth_type_trans(skb, rx_ring->netdev); | ||
586 | |||
587 | /* Workaround hardware that can't do proper VEPA multicast | 586 | /* Workaround hardware that can't do proper VEPA multicast |
588 | * source pruning. | 587 | * source pruning. |
589 | */ | 588 | */ |
@@ -595,7 +594,10 @@ static int ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector, | |||
595 | goto next_desc; | 594 | goto next_desc; |
596 | } | 595 | } |
597 | 596 | ||
598 | ixgbevf_rx_skb(q_vector, skb, rx_desc); | 597 | /* populate checksum, VLAN, and protocol */ |
598 | ixgbevf_process_skb_fields(rx_ring, rx_desc, skb); | ||
599 | |||
600 | ixgbevf_rx_skb(q_vector, skb); | ||
599 | 601 | ||
600 | next_desc: | 602 | next_desc: |
601 | /* return some buffers to hardware, one at a time is too slow */ | 603 | /* return some buffers to hardware, one at a time is too slow */ |