netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH resend net-next 2/3] myri10ge: Add vlan rx for better GRO perf.
@ 2012-11-28 21:20 Andrew Gallatin
  2012-11-29 18:17 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Gallatin @ 2012-11-28 21:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev


Unlike LRO, GRO requires that vlan tags be removed before
aggregation can occur.  Since the myri10ge NIC does not support
hardware vlan tag offload, we must remove the tag in the driver
to achieve performance comparable to LRO for vlan tagged frames.

Thanks to Eric Duzamet for his help simplifying the original patch.

Signed-off-by: Andrew Gallatin <gallatin@myri.com>
---
  drivers/net/ethernet/myricom/myri10ge/myri10ge.c |   40 
++++++++++++++++++++++
  1 file changed, 40 insertions(+)

diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c 
b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index a5ab2f2..93ed089 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -1264,6 +1264,41 @@ myri10ge_unmap_rx_page(struct pci_dev *pdev,
  	}
  }

+/*
+ * GRO does not support acceleration of tagged vlan frames, and
+ * this NIC does not support vlan tag offload, so we must pop
+ * the tag ourselves to be able to achieve GRO performance that
+ * is comparable to LRO.
+ */
+
+static inline void
+myri10ge_vlan_rx(struct net_device *dev, void *addr, struct sk_buff *skb)
+{
+	u8 *va;
+	struct vlan_ethhdr *veh;
+	struct skb_frag_struct *frag;
+
+	va = addr;
+	va += MXGEFW_PAD;
+	veh = (struct vlan_ethhdr *) va;
+	if ((dev->features & (NETIF_F_HW_VLAN_RX)) == NETIF_F_HW_VLAN_RX &&
+	    (veh->h_vlan_proto == ntohs(ETH_P_8021Q))) {
+		/* fixup csum if needed */
+		if (skb->ip_summed == CHECKSUM_COMPLETE)
+			skb->csum = csum_sub(skb->csum,
+					     csum_partial(va + ETH_HLEN,
+							  VLAN_HLEN, 0));
+		/* pop tag */
+		__vlan_hwaccel_put_tag(skb, ntohs(veh->h_vlan_TCI));
+		memmove(va + VLAN_HLEN, va, 2 * ETH_ALEN);
+		skb->len -= VLAN_HLEN;
+		skb->data_len -= VLAN_HLEN;
+		frag = skb_shinfo(skb)->frags;
+		frag->page_offset += VLAN_HLEN;
+		skb_frag_size_set(frag, skb_frag_size(frag) - VLAN_HLEN);
+	}
+}
+
  static inline int
  myri10ge_rx_done(struct myri10ge_slice_state *ss, int len, __wsum csum)
  {
@@ -1329,6 +1364,7 @@ myri10ge_rx_done(struct myri10ge_slice_state *ss, 
int len, __wsum csum)
  		skb->ip_summed = CHECKSUM_COMPLETE;
  		skb->csum = csum;
  	}
+	myri10ge_vlan_rx(mgp->dev, va, skb);
  	skb_record_rx_queue(skb, ss - &mgp->ss[0]);

  	napi_gro_frags(&ss->napi);
@@ -3854,6 +3890,10 @@ static int myri10ge_probe(struct pci_dev *pdev, 
const struct pci_device_id *ent)
  	netdev->netdev_ops = &myri10ge_netdev_ops;
  	netdev->mtu = myri10ge_initial_mtu;
  	netdev->hw_features = mgp->features | NETIF_F_RXCSUM;
+
+	/* fake NETIF_F_HW_VLAN_RX for good GRO performance */
+	netdev->hw_features |= NETIF_F_HW_VLAN_RX;
+
  	netdev->features = netdev->hw_features;

  	if (dac_enabled)
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH resend net-next 2/3] myri10ge: Add vlan rx for better GRO perf.
  2012-11-28 21:20 [PATCH resend net-next 2/3] myri10ge: Add vlan rx for better GRO perf Andrew Gallatin
@ 2012-11-29 18:17 ` David Miller
  2012-11-29 19:19   ` Andrew Gallatin
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2012-11-29 18:17 UTC (permalink / raw)
  To: gallatin; +Cc: netdev

From: Andrew Gallatin <gallatin@myri.com>
Date: Wed, 28 Nov 2012 16:20:56 -0500

> + if ((dev->features & (NETIF_F_HW_VLAN_RX)) == NETIF_F_HW_VLAN_RX &&
> +	    (veh->h_vlan_proto == ntohs(ETH_P_8021Q))) {
> +		/* fixup csum if needed */
> +		if (skb->ip_summed == CHECKSUM_COMPLETE)
> +			skb->csum = csum_sub(skb->csum,
> + csum_partial(va + ETH_HLEN,
> + VLAN_HLEN, 0));

This indentation looks like spaghetti, verify that this kind of error
doesn't exist in the rest of your patches, and resend the series.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH resend net-next 2/3] myri10ge: Add vlan rx for better GRO perf.
  2012-11-29 18:17 ` David Miller
@ 2012-11-29 19:19   ` Andrew Gallatin
  2012-11-29 19:47     ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Gallatin @ 2012-11-29 19:19 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On 11/29/12 13:17, David Miller wrote:
> From: Andrew Gallatin <gallatin@myri.com>
> Date: Wed, 28 Nov 2012 16:20:56 -0500
>
>> + if ((dev->features & (NETIF_F_HW_VLAN_RX)) == NETIF_F_HW_VLAN_RX &&
>> +	    (veh->h_vlan_proto == ntohs(ETH_P_8021Q))) {
>> +		/* fixup csum if needed */
>> +		if (skb->ip_summed == CHECKSUM_COMPLETE)
>> +			skb->csum = csum_sub(skb->csum,
>> + csum_partial(va + ETH_HLEN,
>> + VLAN_HLEN, 0));
>
> This indentation looks like spaghetti, verify that this kind of error
> doesn't exist in the rest of your patches, and resend the series.
>

Sorry.  Emacs victim...  I'll clean it up & re-submit.  I'd stupidly
assumed that checkpatch would verify indentation.  :(

Drew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH resend net-next 2/3] myri10ge: Add vlan rx for better GRO perf.
  2012-11-29 19:19   ` Andrew Gallatin
@ 2012-11-29 19:47     ` Joe Perches
  2012-11-29 19:53       ` Andrew Gallatin
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2012-11-29 19:47 UTC (permalink / raw)
  To: Andrew Gallatin; +Cc: David Miller, netdev

On Thu, 2012-11-29 at 14:19 -0500, Andrew Gallatin wrote:
> On 11/29/12 13:17, David Miller wrote:
> > From: Andrew Gallatin <gallatin@myri.com>
> > Date: Wed, 28 Nov 2012 16:20:56 -0500
> >
> >> + if ((dev->features & (NETIF_F_HW_VLAN_RX)) == NETIF_F_HW_VLAN_RX &&
> >> +	    (veh->h_vlan_proto == ntohs(ETH_P_8021Q))) {
> >> +		/* fixup csum if needed */
> >> +		if (skb->ip_summed == CHECKSUM_COMPLETE)
> >> +			skb->csum = csum_sub(skb->csum,
> >> + csum_partial(va + ETH_HLEN,
> >> + VLAN_HLEN, 0));
> >
> > This indentation looks like spaghetti, verify that this kind of error
> > doesn't exist in the rest of your patches, and resend the series.
> >
> 
> Sorry.  Emacs victim...  I'll clean it up & re-submit.  I'd stupidly
> assumed that checkpatch would verify indentation.  :(

checkpatch --strict

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH resend net-next 2/3] myri10ge: Add vlan rx for better GRO perf.
  2012-11-29 19:47     ` Joe Perches
@ 2012-11-29 19:53       ` Andrew Gallatin
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Gallatin @ 2012-11-29 19:53 UTC (permalink / raw)
  To: Joe Perches; +Cc: David Miller, netdev

On 11/29/12 14:47, Joe Perches wrote:
> On Thu, 2012-11-29 at 14:19 -0500, Andrew Gallatin wrote:
>> On 11/29/12 13:17, David Miller wrote:
>>> From: Andrew Gallatin <gallatin@myri.com>
>>> Date: Wed, 28 Nov 2012 16:20:56 -0500
>>>
>>>> + if ((dev->features & (NETIF_F_HW_VLAN_RX)) == NETIF_F_HW_VLAN_RX &&
>>>> +	    (veh->h_vlan_proto == ntohs(ETH_P_8021Q))) {
>>>> +		/* fixup csum if needed */
>>>> +		if (skb->ip_summed == CHECKSUM_COMPLETE)
>>>> +			skb->csum = csum_sub(skb->csum,
>>>> + csum_partial(va + ETH_HLEN,
>>>> + VLAN_HLEN, 0));
>>>
>>> This indentation looks like spaghetti, verify that this kind of error
>>> doesn't exist in the rest of your patches, and resend the series.
>>>
>>
>> Sorry.  Emacs victim...  I'll clean it up & re-submit.  I'd stupidly
>> assumed that checkpatch would verify indentation.  :(
>
> checkpatch --strict
>

That catches one formatting error in the patch, but does not complain
about the indentation issues.

Drew

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-11-29 19:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-28 21:20 [PATCH resend net-next 2/3] myri10ge: Add vlan rx for better GRO perf Andrew Gallatin
2012-11-29 18:17 ` David Miller
2012-11-29 19:19   ` Andrew Gallatin
2012-11-29 19:47     ` Joe Perches
2012-11-29 19:53       ` Andrew Gallatin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).