diff options
author | Shani Michaeli <shanim@mellanox.com> | 2014-11-09 06:51:52 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-11-11 13:20:02 -0500 |
commit | dd65beac48a5259945846956d4b27344dfb73bd9 (patch) | |
tree | 3ec180fb02067fc902eba5eb836eec5b64114f09 /drivers/net/ethernet | |
parent | b00394c007269183d9f539fa87e65892ac2006e2 (diff) |
net/mlx4_en: Extend usage of napi_gro_frags
We can call napi_gro_frags for all the received traffic regardless
of the checksum status. Specifically, received packets whose status
is CHECKSUM_NONE (and soon to be added CHECKSUM_COMPLETE)
are eligible for napi_gro_frags as well.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Shani Michaeli <shanim@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_rx.c | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index 5a193f40a14c..df6d352c4e54 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c | |||
@@ -747,60 +747,6 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud | |||
747 | if ((cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPOK)) && | 747 | if ((cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPOK)) && |
748 | (cqe->checksum == cpu_to_be16(0xffff))) { | 748 | (cqe->checksum == cpu_to_be16(0xffff))) { |
749 | ring->csum_ok++; | 749 | ring->csum_ok++; |
750 | /* This packet is eligible for GRO if it is: | ||
751 | * - DIX Ethernet (type interpretation) | ||
752 | * - TCP/IP (v4) | ||
753 | * - without IP options | ||
754 | * - not an IP fragment | ||
755 | * - no LLS polling in progress | ||
756 | */ | ||
757 | if (!mlx4_en_cq_busy_polling(cq) && | ||
758 | (dev->features & NETIF_F_GRO)) { | ||
759 | struct sk_buff *gro_skb = napi_get_frags(&cq->napi); | ||
760 | if (!gro_skb) | ||
761 | goto next; | ||
762 | |||
763 | nr = mlx4_en_complete_rx_desc(priv, | ||
764 | rx_desc, frags, gro_skb, | ||
765 | length); | ||
766 | if (!nr) | ||
767 | goto next; | ||
768 | |||
769 | skb_shinfo(gro_skb)->nr_frags = nr; | ||
770 | gro_skb->len = length; | ||
771 | gro_skb->data_len = length; | ||
772 | gro_skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
773 | |||
774 | if (l2_tunnel) | ||
775 | gro_skb->csum_level = 1; | ||
776 | if ((cqe->vlan_my_qpn & | ||
777 | cpu_to_be32(MLX4_CQE_VLAN_PRESENT_MASK)) && | ||
778 | (dev->features & NETIF_F_HW_VLAN_CTAG_RX)) { | ||
779 | u16 vid = be16_to_cpu(cqe->sl_vid); | ||
780 | |||
781 | __vlan_hwaccel_put_tag(gro_skb, htons(ETH_P_8021Q), vid); | ||
782 | } | ||
783 | |||
784 | if (dev->features & NETIF_F_RXHASH) | ||
785 | skb_set_hash(gro_skb, | ||
786 | be32_to_cpu(cqe->immed_rss_invalid), | ||
787 | PKT_HASH_TYPE_L3); | ||
788 | |||
789 | skb_record_rx_queue(gro_skb, cq->ring); | ||
790 | skb_mark_napi_id(gro_skb, &cq->napi); | ||
791 | |||
792 | if (ring->hwtstamp_rx_filter == HWTSTAMP_FILTER_ALL) { | ||
793 | timestamp = mlx4_en_get_cqe_ts(cqe); | ||
794 | mlx4_en_fill_hwtstamps(mdev, | ||
795 | skb_hwtstamps(gro_skb), | ||
796 | timestamp); | ||
797 | } | ||
798 | |||
799 | napi_gro_frags(&cq->napi); | ||
800 | goto next; | ||
801 | } | ||
802 | |||
803 | /* GRO not possible, complete processing here */ | ||
804 | ip_summed = CHECKSUM_UNNECESSARY; | 750 | ip_summed = CHECKSUM_UNNECESSARY; |
805 | } else { | 751 | } else { |
806 | ip_summed = CHECKSUM_NONE; | 752 | ip_summed = CHECKSUM_NONE; |
@@ -811,6 +757,60 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud | |||
811 | ring->csum_none++; | 757 | ring->csum_none++; |
812 | } | 758 | } |
813 | 759 | ||
760 | /* This packet is eligible for GRO if it is: | ||
761 | * - DIX Ethernet (type interpretation) | ||
762 | * - TCP/IP (v4) | ||
763 | * - without IP options | ||
764 | * - not an IP fragment | ||
765 | * - no LLS polling in progress | ||
766 | */ | ||
767 | if (!mlx4_en_cq_busy_polling(cq) && | ||
768 | (dev->features & NETIF_F_GRO)) { | ||
769 | struct sk_buff *gro_skb = napi_get_frags(&cq->napi); | ||
770 | if (!gro_skb) | ||
771 | goto next; | ||
772 | |||
773 | nr = mlx4_en_complete_rx_desc(priv, | ||
774 | rx_desc, frags, gro_skb, | ||
775 | length); | ||
776 | if (!nr) | ||
777 | goto next; | ||
778 | |||
779 | skb_shinfo(gro_skb)->nr_frags = nr; | ||
780 | gro_skb->len = length; | ||
781 | gro_skb->data_len = length; | ||
782 | gro_skb->ip_summed = ip_summed; | ||
783 | |||
784 | if (l2_tunnel && ip_summed == CHECKSUM_UNNECESSARY) | ||
785 | gro_skb->encapsulation = 1; | ||
786 | if ((cqe->vlan_my_qpn & | ||
787 | cpu_to_be32(MLX4_CQE_VLAN_PRESENT_MASK)) && | ||
788 | (dev->features & NETIF_F_HW_VLAN_CTAG_RX)) { | ||
789 | u16 vid = be16_to_cpu(cqe->sl_vid); | ||
790 | |||
791 | __vlan_hwaccel_put_tag(gro_skb, htons(ETH_P_8021Q), vid); | ||
792 | } | ||
793 | |||
794 | if (dev->features & NETIF_F_RXHASH) | ||
795 | skb_set_hash(gro_skb, | ||
796 | be32_to_cpu(cqe->immed_rss_invalid), | ||
797 | PKT_HASH_TYPE_L3); | ||
798 | |||
799 | skb_record_rx_queue(gro_skb, cq->ring); | ||
800 | skb_mark_napi_id(gro_skb, &cq->napi); | ||
801 | |||
802 | if (ring->hwtstamp_rx_filter == HWTSTAMP_FILTER_ALL) { | ||
803 | timestamp = mlx4_en_get_cqe_ts(cqe); | ||
804 | mlx4_en_fill_hwtstamps(mdev, | ||
805 | skb_hwtstamps(gro_skb), | ||
806 | timestamp); | ||
807 | } | ||
808 | |||
809 | napi_gro_frags(&cq->napi); | ||
810 | goto next; | ||
811 | } | ||
812 | |||
813 | /* GRO not possible, complete processing here */ | ||
814 | skb = mlx4_en_rx_skb(priv, rx_desc, frags, length); | 814 | skb = mlx4_en_rx_skb(priv, rx_desc, frags, length); |
815 | if (!skb) { | 815 | if (!skb) { |
816 | priv->stats.rx_dropped++; | 816 | priv->stats.rx_dropped++; |