diff options
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 81 |
1 files changed, 13 insertions, 68 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 7489094bbbc8..f7b592eff68e 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -403,23 +403,20 @@ static int __ixgbe_notify_dca(struct device *dev, void *data) | |||
403 | * @rx_ring: rx descriptor ring (for a specific queue) to setup | 403 | * @rx_ring: rx descriptor ring (for a specific queue) to setup |
404 | * @rx_desc: rx descriptor | 404 | * @rx_desc: rx descriptor |
405 | **/ | 405 | **/ |
406 | static void ixgbe_receive_skb(struct ixgbe_adapter *adapter, | 406 | static void ixgbe_receive_skb(struct ixgbe_q_vector *q_vector, |
407 | struct sk_buff *skb, u8 status, | 407 | struct sk_buff *skb, u8 status, |
408 | struct ixgbe_ring *ring, | ||
409 | union ixgbe_adv_rx_desc *rx_desc) | 408 | union ixgbe_adv_rx_desc *rx_desc) |
410 | { | 409 | { |
410 | struct ixgbe_adapter *adapter = q_vector->adapter; | ||
411 | struct napi_struct *napi = &q_vector->napi; | ||
411 | bool is_vlan = (status & IXGBE_RXD_STAT_VP); | 412 | bool is_vlan = (status & IXGBE_RXD_STAT_VP); |
412 | u16 tag = le16_to_cpu(rx_desc->wb.upper.vlan); | 413 | u16 tag = le16_to_cpu(rx_desc->wb.upper.vlan); |
413 | 414 | ||
414 | if (adapter->netdev->features & NETIF_F_LRO && | 415 | if (skb->ip_summed == CHECKSUM_UNNECESSARY) { |
415 | skb->ip_summed == CHECKSUM_UNNECESSARY) { | ||
416 | if (adapter->vlgrp && is_vlan && (tag != 0)) | 416 | if (adapter->vlgrp && is_vlan && (tag != 0)) |
417 | lro_vlan_hwaccel_receive_skb(&ring->lro_mgr, skb, | 417 | vlan_gro_receive(napi, adapter->vlgrp, tag, skb); |
418 | adapter->vlgrp, tag, | ||
419 | rx_desc); | ||
420 | else | 418 | else |
421 | lro_receive_skb(&ring->lro_mgr, skb, rx_desc); | 419 | napi_gro_receive(napi, skb); |
422 | ring->lro_used = true; | ||
423 | } else { | 420 | } else { |
424 | if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) { | 421 | if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) { |
425 | if (adapter->vlgrp && is_vlan && (tag != 0)) | 422 | if (adapter->vlgrp && is_vlan && (tag != 0)) |
@@ -574,10 +571,11 @@ static inline u16 ixgbe_get_pkt_info(union ixgbe_adv_rx_desc *rx_desc) | |||
574 | return rx_desc->wb.lower.lo_dword.hs_rss.pkt_info; | 571 | return rx_desc->wb.lower.lo_dword.hs_rss.pkt_info; |
575 | } | 572 | } |
576 | 573 | ||
577 | static bool ixgbe_clean_rx_irq(struct ixgbe_adapter *adapter, | 574 | static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, |
578 | struct ixgbe_ring *rx_ring, | 575 | struct ixgbe_ring *rx_ring, |
579 | int *work_done, int work_to_do) | 576 | int *work_done, int work_to_do) |
580 | { | 577 | { |
578 | struct ixgbe_adapter *adapter = q_vector->adapter; | ||
581 | struct pci_dev *pdev = adapter->pdev; | 579 | struct pci_dev *pdev = adapter->pdev; |
582 | union ixgbe_adv_rx_desc *rx_desc, *next_rxd; | 580 | union ixgbe_adv_rx_desc *rx_desc, *next_rxd; |
583 | struct ixgbe_rx_buffer *rx_buffer_info, *next_buffer; | 581 | struct ixgbe_rx_buffer *rx_buffer_info, *next_buffer; |
@@ -678,7 +676,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_adapter *adapter, | |||
678 | total_rx_packets++; | 676 | total_rx_packets++; |
679 | 677 | ||
680 | skb->protocol = eth_type_trans(skb, adapter->netdev); | 678 | skb->protocol = eth_type_trans(skb, adapter->netdev); |
681 | ixgbe_receive_skb(adapter, skb, staterr, rx_ring, rx_desc); | 679 | ixgbe_receive_skb(q_vector, skb, staterr, rx_desc); |
682 | 680 | ||
683 | next_desc: | 681 | next_desc: |
684 | rx_desc->wb.upper.status_error = 0; | 682 | rx_desc->wb.upper.status_error = 0; |
@@ -696,11 +694,6 @@ next_desc: | |||
696 | staterr = le32_to_cpu(rx_desc->wb.upper.status_error); | 694 | staterr = le32_to_cpu(rx_desc->wb.upper.status_error); |
697 | } | 695 | } |
698 | 696 | ||
699 | if (rx_ring->lro_used) { | ||
700 | lro_flush_all(&rx_ring->lro_mgr); | ||
701 | rx_ring->lro_used = false; | ||
702 | } | ||
703 | |||
704 | rx_ring->next_to_clean = i; | 697 | rx_ring->next_to_clean = i; |
705 | cleaned_count = IXGBE_DESC_UNUSED(rx_ring); | 698 | cleaned_count = IXGBE_DESC_UNUSED(rx_ring); |
706 | 699 | ||
@@ -1052,7 +1045,7 @@ static int ixgbe_clean_rxonly(struct napi_struct *napi, int budget) | |||
1052 | ixgbe_update_rx_dca(adapter, rx_ring); | 1045 | ixgbe_update_rx_dca(adapter, rx_ring); |
1053 | #endif | 1046 | #endif |
1054 | 1047 | ||
1055 | ixgbe_clean_rx_irq(adapter, rx_ring, &work_done, budget); | 1048 | ixgbe_clean_rx_irq(q_vector, rx_ring, &work_done, budget); |
1056 | 1049 | ||
1057 | /* If all Rx work done, exit the polling mode */ | 1050 | /* If all Rx work done, exit the polling mode */ |
1058 | if (work_done < budget) { | 1051 | if (work_done < budget) { |
@@ -1095,7 +1088,7 @@ static int ixgbe_clean_rxonly_many(struct napi_struct *napi, int budget) | |||
1095 | if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) | 1088 | if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) |
1096 | ixgbe_update_rx_dca(adapter, rx_ring); | 1089 | ixgbe_update_rx_dca(adapter, rx_ring); |
1097 | #endif | 1090 | #endif |
1098 | ixgbe_clean_rx_irq(adapter, rx_ring, &work_done, budget); | 1091 | ixgbe_clean_rx_irq(q_vector, rx_ring, &work_done, budget); |
1099 | enable_mask |= rx_ring->v_idx; | 1092 | enable_mask |= rx_ring->v_idx; |
1100 | r_idx = find_next_bit(q_vector->rxr_idx, adapter->num_rx_queues, | 1093 | r_idx = find_next_bit(q_vector->rxr_idx, adapter->num_rx_queues, |
1101 | r_idx + 1); | 1094 | r_idx + 1); |
@@ -1568,33 +1561,6 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, int index) | |||
1568 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_SRRCTL(index), srrctl); | 1561 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_SRRCTL(index), srrctl); |
1569 | } | 1562 | } |
1570 | 1563 | ||
1571 | /** | ||
1572 | * ixgbe_get_skb_hdr - helper function for LRO header processing | ||
1573 | * @skb: pointer to sk_buff to be added to LRO packet | ||
1574 | * @iphdr: pointer to ip header structure | ||
1575 | * @tcph: pointer to tcp header structure | ||
1576 | * @hdr_flags: pointer to header flags | ||
1577 | * @priv: private data | ||
1578 | **/ | ||
1579 | static int ixgbe_get_skb_hdr(struct sk_buff *skb, void **iphdr, void **tcph, | ||
1580 | u64 *hdr_flags, void *priv) | ||
1581 | { | ||
1582 | union ixgbe_adv_rx_desc *rx_desc = priv; | ||
1583 | |||
1584 | /* Verify that this is a valid IPv4 TCP packet */ | ||
1585 | if (!((ixgbe_get_pkt_info(rx_desc) & IXGBE_RXDADV_PKTTYPE_IPV4) && | ||
1586 | (ixgbe_get_pkt_info(rx_desc) & IXGBE_RXDADV_PKTTYPE_TCP))) | ||
1587 | return -1; | ||
1588 | |||
1589 | /* Set network headers */ | ||
1590 | skb_reset_network_header(skb); | ||
1591 | skb_set_transport_header(skb, ip_hdrlen(skb)); | ||
1592 | *iphdr = ip_hdr(skb); | ||
1593 | *tcph = tcp_hdr(skb); | ||
1594 | *hdr_flags = LRO_IPV4 | LRO_TCP; | ||
1595 | return 0; | ||
1596 | } | ||
1597 | |||
1598 | #define PAGE_USE_COUNT(S) (((S) >> PAGE_SHIFT) + \ | 1564 | #define PAGE_USE_COUNT(S) (((S) >> PAGE_SHIFT) + \ |
1599 | (((S) & (PAGE_SIZE - 1)) ? 1 : 0)) | 1565 | (((S) & (PAGE_SIZE - 1)) ? 1 : 0)) |
1600 | 1566 | ||
@@ -1666,16 +1632,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
1666 | adapter->rx_ring[i].head = IXGBE_RDH(j); | 1632 | adapter->rx_ring[i].head = IXGBE_RDH(j); |
1667 | adapter->rx_ring[i].tail = IXGBE_RDT(j); | 1633 | adapter->rx_ring[i].tail = IXGBE_RDT(j); |
1668 | adapter->rx_ring[i].rx_buf_len = rx_buf_len; | 1634 | adapter->rx_ring[i].rx_buf_len = rx_buf_len; |
1669 | /* Intitial LRO Settings */ | ||
1670 | adapter->rx_ring[i].lro_mgr.max_aggr = IXGBE_MAX_LRO_AGGREGATE; | ||
1671 | adapter->rx_ring[i].lro_mgr.max_desc = IXGBE_MAX_LRO_DESCRIPTORS; | ||
1672 | adapter->rx_ring[i].lro_mgr.get_skb_header = ixgbe_get_skb_hdr; | ||
1673 | adapter->rx_ring[i].lro_mgr.features = LRO_F_EXTRACT_VLAN_ID; | ||
1674 | if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) | ||
1675 | adapter->rx_ring[i].lro_mgr.features |= LRO_F_NAPI; | ||
1676 | adapter->rx_ring[i].lro_mgr.dev = adapter->netdev; | ||
1677 | adapter->rx_ring[i].lro_mgr.ip_summed = CHECKSUM_UNNECESSARY; | ||
1678 | adapter->rx_ring[i].lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY; | ||
1679 | 1635 | ||
1680 | ixgbe_configure_srrctl(adapter, j); | 1636 | ixgbe_configure_srrctl(adapter, j); |
1681 | } | 1637 | } |
@@ -2310,7 +2266,7 @@ static int ixgbe_poll(struct napi_struct *napi, int budget) | |||
2310 | #endif | 2266 | #endif |
2311 | 2267 | ||
2312 | tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring); | 2268 | tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring); |
2313 | ixgbe_clean_rx_irq(adapter, adapter->rx_ring, &work_done, budget); | 2269 | ixgbe_clean_rx_irq(q_vector, adapter->rx_ring, &work_done, budget); |
2314 | 2270 | ||
2315 | if (tx_cleaned) | 2271 | if (tx_cleaned) |
2316 | work_done = budget; | 2272 | work_done = budget; |
@@ -2926,12 +2882,6 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter, | |||
2926 | struct pci_dev *pdev = adapter->pdev; | 2882 | struct pci_dev *pdev = adapter->pdev; |
2927 | int size; | 2883 | int size; |
2928 | 2884 | ||
2929 | size = sizeof(struct net_lro_desc) * IXGBE_MAX_LRO_DESCRIPTORS; | ||
2930 | rx_ring->lro_mgr.lro_arr = vmalloc(size); | ||
2931 | if (!rx_ring->lro_mgr.lro_arr) | ||
2932 | return -ENOMEM; | ||
2933 | memset(rx_ring->lro_mgr.lro_arr, 0, size); | ||
2934 | |||
2935 | size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count; | 2885 | size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count; |
2936 | rx_ring->rx_buffer_info = vmalloc(size); | 2886 | rx_ring->rx_buffer_info = vmalloc(size); |
2937 | if (!rx_ring->rx_buffer_info) { | 2887 | if (!rx_ring->rx_buffer_info) { |
@@ -2960,8 +2910,6 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter, | |||
2960 | return 0; | 2910 | return 0; |
2961 | 2911 | ||
2962 | alloc_failed: | 2912 | alloc_failed: |
2963 | vfree(rx_ring->lro_mgr.lro_arr); | ||
2964 | rx_ring->lro_mgr.lro_arr = NULL; | ||
2965 | return -ENOMEM; | 2913 | return -ENOMEM; |
2966 | } | 2914 | } |
2967 | 2915 | ||
@@ -3039,9 +2987,6 @@ void ixgbe_free_rx_resources(struct ixgbe_adapter *adapter, | |||
3039 | { | 2987 | { |
3040 | struct pci_dev *pdev = adapter->pdev; | 2988 | struct pci_dev *pdev = adapter->pdev; |
3041 | 2989 | ||
3042 | vfree(rx_ring->lro_mgr.lro_arr); | ||
3043 | rx_ring->lro_mgr.lro_arr = NULL; | ||
3044 | |||
3045 | ixgbe_clean_rx_ring(adapter, rx_ring); | 2990 | ixgbe_clean_rx_ring(adapter, rx_ring); |
3046 | 2991 | ||
3047 | vfree(rx_ring->rx_buffer_info); | 2992 | vfree(rx_ring->rx_buffer_info); |
@@ -4141,7 +4086,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
4141 | netdev->features |= NETIF_F_IPV6_CSUM; | 4086 | netdev->features |= NETIF_F_IPV6_CSUM; |
4142 | netdev->features |= NETIF_F_TSO; | 4087 | netdev->features |= NETIF_F_TSO; |
4143 | netdev->features |= NETIF_F_TSO6; | 4088 | netdev->features |= NETIF_F_TSO6; |
4144 | netdev->features |= NETIF_F_LRO; | 4089 | netdev->features |= NETIF_F_GRO; |
4145 | 4090 | ||
4146 | netdev->vlan_features |= NETIF_F_TSO; | 4091 | netdev->vlan_features |= NETIF_F_TSO; |
4147 | netdev->vlan_features |= NETIF_F_TSO6; | 4092 | netdev->vlan_features |= NETIF_F_TSO6; |