All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] igb: allow tx of pre-formatted vlan tagged packets
@ 2009-03-12 20:27 Arthur Jones
  2009-03-12 20:51 ` Stephen Hemminger
  2009-03-12 21:33 ` [net-next PATCH] " Arthur Jones
  0 siblings, 2 replies; 10+ messages in thread
From: Arthur Jones @ 2009-03-12 20:27 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: e1000-devel, netdev

When the 82575 is fed 802.1q packets, it chokes with
an error of the form:

igb 0000:08:00.1: partial checksum but proto=81

As the logic there was not smart enough to look into
the vlan header to pick out the encapsulated protocol.

There are times when we'd like to send these packets
out without having to configure a vlan on the interface.
Here we check for the vlan tag and allow the packet to
go out with the correct hardware checksum.

Thanks to Kand Ly <kand@riverbed.com> for discovering the
issue and the coming up with a solution.  This patch is
based upon his work.

Signed-off-by: Arthur Jones <ajones@riverbed.com>
---
 drivers/net/igb/igb_main.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index fddeece..99ba3a5 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -2778,7 +2778,17 @@ static inline bool igb_tx_csum_adv(struct igb_adapter *adapter,
 		tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT);
 
 		if (skb->ip_summed == CHECKSUM_PARTIAL) {
-			switch (skb->protocol) {
+			__be16 protocol;
+
+			if (skb->protocol == __constant_htons(ETH_P_8021Q)) {
+				const struct vlan_ethhdr *vhdr =
+					(const struct vlan_ethhdr *) skb->data;
+
+				protocol = vhdr->h_vlan_encapsulated_proto;
+			} else
+				protocol = skb->protocol;
+
+			switch (protocol) {
 			case __constant_htons(ETH_P_IP):
 				tu_cmd |= E1000_ADVTXD_TUCMD_IPV4;
 				if (ip_hdr(skb)->protocol == IPPROTO_TCP)
-- 
1.5.6.3

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

* Re: [PATCH] igb: allow tx of pre-formatted vlan tagged packets
  2009-03-12 20:27 [PATCH] igb: allow tx of pre-formatted vlan tagged packets Arthur Jones
@ 2009-03-12 20:51 ` Stephen Hemminger
  2009-03-12 21:00   ` Arthur Jones
  2009-03-12 21:33 ` [net-next PATCH] " Arthur Jones
  1 sibling, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2009-03-12 20:51 UTC (permalink / raw)
  To: Arthur Jones; +Cc: Jeff Kirsher, e1000-devel, netdev

On Thu, 12 Mar 2009 13:27:24 -0700
Arthur Jones <ajones@riverbed.com> wrote:

> When the 82575 is fed 802.1q packets, it chokes with
> an error of the form:
> 
> igb 0000:08:00.1: partial checksum but proto=81
> 
> As the logic there was not smart enough to look into
> the vlan header to pick out the encapsulated protocol.
> 
> There are times when we'd like to send these packets
> out without having to configure a vlan on the interface.
> Here we check for the vlan tag and allow the packet to
> go out with the correct hardware checksum.
> 
> Thanks to Kand Ly <kand@riverbed.com> for discovering the
> issue and the coming up with a solution.  This patch is
> based upon his work.
> 
> Signed-off-by: Arthur Jones <ajones@riverbed.com>
> ---
>  drivers/net/igb/igb_main.c |   12 +++++++++++-
>  1 files changed, 11 insertions(+), 1 deletions(-)

That code in current igb driver (net-next-2.6) tree no longer has
the whole switch you are changing.



> diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
> index fddeece..99ba3a5 100644
> --- a/drivers/net/igb/igb_main.c
> +++ b/drivers/net/igb/igb_main.c
> @@ -2778,7 +2778,17 @@ static inline bool igb_tx_csum_adv(struct igb_adapter *adapter,
>  		tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT);
>  
>  		if (skb->ip_summed == CHECKSUM_PARTIAL) {
> -			switch (skb->protocol) {
> +			__be16 protocol;
> +
> +			if (skb->protocol == __constant_htons(ETH_P_8021Q)) {

Don't use __constant_htons() here, macro is smart enough to know when
value is const.

> +				const struct vlan_ethhdr *vhdr =
> +					(const struct vlan_ethhdr *) skb->data;
> +
> +				protocol = vhdr->h_vlan_encapsulated_proto;
> +			} else
> +				protocol = skb->protocol;
> +
> +			switch (protocol) {
>  			case __constant_htons(ETH_P_IP):
>  				tu_cmd |= E1000_ADVTXD_TUCMD_IPV4;
>  				if (ip_hdr(skb)->protocol == IPPROTO_TCP)

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

* Re: [PATCH] igb: allow tx of pre-formatted vlan tagged packets
  2009-03-12 20:51 ` Stephen Hemminger
@ 2009-03-12 21:00   ` Arthur Jones
  2009-03-12 21:22     ` Stephen Hemminger
  0 siblings, 1 reply; 10+ messages in thread
From: Arthur Jones @ 2009-03-12 21:00 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Jeff Kirsher, e1000-devel, netdev

Hi Stephen, ...

On Thu, Mar 12, 2009 at 01:51:19PM -0700, Stephen Hemminger wrote:
> On Thu, 12 Mar 2009 13:27:24 -0700
> Arthur Jones <ajones@riverbed.com> wrote:
> 
> > When the 82575 is fed 802.1q packets, it chokes with
> > an error of the form:
> > 
> > igb 0000:08:00.1: partial checksum but proto=81
> > 
> > As the logic there was not smart enough to look into
> > the vlan header to pick out the encapsulated protocol.
> > 
> > There are times when we'd like to send these packets
> > out without having to configure a vlan on the interface.
> > Here we check for the vlan tag and allow the packet to
> > go out with the correct hardware checksum.
> > 
> > Thanks to Kand Ly <kand@riverbed.com> for discovering the
> > issue and the coming up with a solution.  This patch is
> > based upon his work.
> > 
> > Signed-off-by: Arthur Jones <ajones@riverbed.com>
> > ---
> >  drivers/net/igb/igb_main.c |   12 +++++++++++-
> >  1 files changed, 11 insertions(+), 1 deletions(-)
> 
> That code in current igb driver (net-next-2.6) tree no longer has
> the whole switch you are changing.

Ok, thanks, I'll test that one...

Arthur

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

* Re: [PATCH] igb: allow tx of pre-formatted vlan tagged packets
  2009-03-12 21:00   ` Arthur Jones
@ 2009-03-12 21:22     ` Stephen Hemminger
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2009-03-12 21:22 UTC (permalink / raw)
  To: Arthur Jones; +Cc: Jeff Kirsher, e1000-devel, netdev

On Thu, 12 Mar 2009 14:00:57 -0700
Arthur Jones <ajones@riverbed.com> wrote:

> Hi Stephen, ...
> 
> On Thu, Mar 12, 2009 at 01:51:19PM -0700, Stephen Hemminger wrote:
> > On Thu, 12 Mar 2009 13:27:24 -0700
> > Arthur Jones <ajones@riverbed.com> wrote:
> > 
> > > When the 82575 is fed 802.1q packets, it chokes with
> > > an error of the form:
> > > 
> > > igb 0000:08:00.1: partial checksum but proto=81
> > > 
> > > As the logic there was not smart enough to look into
> > > the vlan header to pick out the encapsulated protocol.
> > > 
> > > There are times when we'd like to send these packets
> > > out without having to configure a vlan on the interface.
> > > Here we check for the vlan tag and allow the packet to
> > > go out with the correct hardware checksum.
> > > 
> > > Thanks to Kand Ly <kand@riverbed.com> for discovering the
> > > issue and the coming up with a solution.  This patch is
> > > based upon his work.
> > > 
> > > Signed-off-by: Arthur Jones <ajones@riverbed.com>
> > > ---
> > >  drivers/net/igb/igb_main.c |   12 +++++++++++-
> > >  1 files changed, 11 insertions(+), 1 deletions(-)
> > 
> > That code in current igb driver (net-next-2.6) tree no longer has
> > the whole switch you are changing.
> 
> Ok, thanks, I'll test that one...
> 
> Arthur

Actually, it is there just a little furthur down than I was looking

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

* [net-next PATCH] igb: allow tx of pre-formatted vlan tagged packets
  2009-03-12 20:27 [PATCH] igb: allow tx of pre-formatted vlan tagged packets Arthur Jones
  2009-03-12 20:51 ` Stephen Hemminger
@ 2009-03-12 21:33 ` Arthur Jones
  2009-03-12 22:30   ` Alexander Duyck
  2009-03-17 17:39   ` [net-next PATCH -- take 2] " Arthur Jones
  1 sibling, 2 replies; 10+ messages in thread
From: Arthur Jones @ 2009-03-12 21:33 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: e1000-devel, netdev, Hemminger, Stephen

When the 82575 is fed 802.1q packets, it chokes with
an error of the form:

igb 0000:08:00.1: partial checksum but proto=81

As the logic there was not smart enough to look into
the vlan header to pick out the encapsulated protocol.

There are times when we'd like to send these packets
out without having to configure a vlan on the interface.
Here we check for the vlan tag and allow the packet to
go out with the correct hardware checksum.

Thanks to Kand Ly <kand@riverbed.com> for discovering the
issue and the coming up with a solution.  This patch is
based upon his work.

Macro fixups from Stephen Hemminger <shemminger@vyatta.com>

Signed-off-by: Arthur Jones <ajones@riverbed.com>
---
 drivers/net/igb/igb_main.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 78558f8..e4ef1f6 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -3017,7 +3017,17 @@ static inline bool igb_tx_csum_adv(struct igb_adapter *adapter,
 		tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT);
 
 		if (skb->ip_summed == CHECKSUM_PARTIAL) {
-			switch (skb->protocol) {
+			__be16 protocol;
+
+			if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) {
+				const struct vlan_ethhdr *vhdr =
+					(const struct vlan_ethhdr *) skb->data;
+
+				protocol = vhdr->h_vlan_encapsulated_proto;
+			} else
+				protocol = skb->protocol;
+
+			switch (protocol) {
 			case cpu_to_be16(ETH_P_IP):
 				tu_cmd |= E1000_ADVTXD_TUCMD_IPV4;
 				if (ip_hdr(skb)->protocol == IPPROTO_TCP)
-- 
1.5.6.3

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com

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

* Re: [net-next PATCH] igb: allow tx of pre-formatted vlan tagged packets
  2009-03-12 21:33 ` [net-next PATCH] " Arthur Jones
@ 2009-03-12 22:30   ` Alexander Duyck
  2009-03-13 14:55     ` Arthur Jones
  2009-03-17 17:39   ` [net-next PATCH -- take 2] " Arthur Jones
  1 sibling, 1 reply; 10+ messages in thread
From: Alexander Duyck @ 2009-03-12 22:30 UTC (permalink / raw)
  To: Arthur Jones; +Cc: Kirsher, Jeffrey T, e1000-devel, netdev, Stephen Hemminger

I have added a few comments inline.

Arthur Jones wrote:
> When the 82575 is fed 802.1q packets, it chokes with
> an error of the form:
> 
> igb 0000:08:00.1: partial checksum but proto=81
> 
> As the logic there was not smart enough to look into
> the vlan header to pick out the encapsulated protocol.
> 
> There are times when we'd like to send these packets
> out without having to configure a vlan on the interface.
> Here we check for the vlan tag and allow the packet to
> go out with the correct hardware checksum.
> 
> Thanks to Kand Ly <kand@riverbed.com> for discovering the
> issue and the coming up with a solution.  This patch is
> based upon his work.
> 
> Macro fixups from Stephen Hemminger <shemminger@vyatta.com>
> 
> Signed-off-by: Arthur Jones <ajones@riverbed.com>
> ---
>  drivers/net/igb/igb_main.c |   12 +++++++++++-
>  1 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
> index 78558f8..e4ef1f6 100644
> --- a/drivers/net/igb/igb_main.c
> +++ b/drivers/net/igb/igb_main.c
> @@ -3017,7 +3017,17 @@ static inline bool igb_tx_csum_adv(struct igb_adapter *adapter,
>  		tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT);
>  
>  		if (skb->ip_summed == CHECKSUM_PARTIAL) {
> -			switch (skb->protocol) {
> +			__be16 protocol;
> +
> +			if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) {
> +				const struct vlan_ethhdr *vhdr =
> +					(const struct vlan_ethhdr *) skb->data;
This should probably reference skb_mac_header(skb) instead of data in 
the event that data is an offset instead of a pointer.

> +
> +				protocol = vhdr->h_vlan_encapsulated_proto;
> +			} else
> +				protocol = skb->protocol;
> +
This else should have braces since the matching if was using braces.

> +			switch (protocol) {
>  			case cpu_to_be16(ETH_P_IP):
>  				tu_cmd |= E1000_ADVTXD_TUCMD_IPV4;
>  				if (ip_hdr(skb)->protocol == IPPROTO_TCP)

Thanks,

Alex

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

* Re: [net-next PATCH] igb: allow tx of pre-formatted vlan tagged packets
  2009-03-12 22:30   ` Alexander Duyck
@ 2009-03-13 14:55     ` Arthur Jones
  2009-03-13 16:24       ` Arthur Jones
  0 siblings, 1 reply; 10+ messages in thread
From: Arthur Jones @ 2009-03-13 14:55 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: Kirsher, Jeffrey T, e1000-devel, netdev, Stephen Hemminger

Hi Alexander, ...

On Thu, Mar 12, 2009 at 03:30:02PM -0700, Alexander Duyck wrote:
> I have added a few comments inline.

Thanks, I'll fix these up and re-submit...

Arthur


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

* Re: [net-next PATCH] igb: allow tx of pre-formatted vlan tagged packets
  2009-03-13 14:55     ` Arthur Jones
@ 2009-03-13 16:24       ` Arthur Jones
  0 siblings, 0 replies; 10+ messages in thread
From: Arthur Jones @ 2009-03-13 16:24 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: Kirsher, Jeffrey T, e1000-devel, netdev, Stephen Hemminger

On Fri, Mar 13, 2009 at 07:55:01AM -0700, Arthur Jones wrote:
> Hi Alexander, ...
> 
> On Thu, Mar 12, 2009 at 03:30:02PM -0700, Alexander Duyck wrote:
> > I have added a few comments inline.
> 
> Thanks, I'll fix these up and re-submit...

I'm out of the office today, though, so testing
will have to wait until Monday -- I'll resend
after the patch is tested...

Arthur

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

* [net-next PATCH -- take 2] igb: allow tx of pre-formatted vlan tagged packets
  2009-03-12 21:33 ` [net-next PATCH] " Arthur Jones
  2009-03-12 22:30   ` Alexander Duyck
@ 2009-03-17 17:39   ` Arthur Jones
  2009-03-19  6:40     ` David Miller
  1 sibling, 1 reply; 10+ messages in thread
From: Arthur Jones @ 2009-03-17 17:39 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: e1000-devel, netdev, Hemminger, Stephen

When the 82575 is fed 802.1q packets, it chokes with
an error of the form:

igb 0000:08:00.1: partial checksum but proto=81

As the logic there was not smart enough to look into
the vlan header to pick out the encapsulated protocol.

There are times when we'd like to send these packets
out without having to configure a vlan on the interface.
Here we check for the vlan tag and allow the packet to
go out with the correct hardware checksum.

Thanks to Kand Ly <kand@riverbed.com> for discovering the
issue and the coming up with a solution.  This patch is
based upon his work.

Fixups from Stephen Hemminger <shemminger@vyatta.com> and
Alexander Duyck <alexander.h.duyck@intel.com>.

Signed-off-by: Arthur Jones <ajones@riverbed.com>
---
 drivers/net/igb/igb_main.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 7124f59..26742dd 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -3030,7 +3030,18 @@ static inline bool igb_tx_csum_adv(struct igb_adapter *adapter,
 		tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT);
 
 		if (skb->ip_summed == CHECKSUM_PARTIAL) {
-			switch (skb->protocol) {
+			__be16 protocol;
+
+			if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) {
+				const struct vlan_ethhdr *vhdr =
+					vlan_eth_hdr(skb);
+
+				protocol = vhdr->h_vlan_encapsulated_proto;
+			} else {
+				protocol = skb->protocol;
+			}
+
+			switch (protocol) {
 			case cpu_to_be16(ETH_P_IP):
 				tu_cmd |= E1000_ADVTXD_TUCMD_IPV4;
 				if (ip_hdr(skb)->protocol == IPPROTO_TCP)
-- 
1.5.6.3

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com

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

* Re: [net-next PATCH -- take 2] igb: allow tx of pre-formatted vlan tagged packets
  2009-03-17 17:39   ` [net-next PATCH -- take 2] " Arthur Jones
@ 2009-03-19  6:40     ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2009-03-19  6:40 UTC (permalink / raw)
  To: ajones
  Cc: jeffrey.t.kirsher, e1000-devel, netdev, shemminger, alexander.h.duyck

From: Arthur Jones <ajones@riverbed.com>
Date: Tue, 17 Mar 2009 10:39:24 -0700

> When the 82575 is fed 802.1q packets, it chokes with
> an error of the form:
> 
> igb 0000:08:00.1: partial checksum but proto=81
> 
> As the logic there was not smart enough to look into
> the vlan header to pick out the encapsulated protocol.
> 
> There are times when we'd like to send these packets
> out without having to configure a vlan on the interface.
> Here we check for the vlan tag and allow the packet to
> go out with the correct hardware checksum.
> 
> Thanks to Kand Ly <kand@riverbed.com> for discovering the
> issue and the coming up with a solution.  This patch is
> based upon his work.
> 
> Fixups from Stephen Hemminger <shemminger@vyatta.com> and
> Alexander Duyck <alexander.h.duyck@intel.com>.
> 
> Signed-off-by: Arthur Jones <ajones@riverbed.com>

Jeff, are you queueing this one up?

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

end of thread, other threads:[~2009-03-19  6:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-12 20:27 [PATCH] igb: allow tx of pre-formatted vlan tagged packets Arthur Jones
2009-03-12 20:51 ` Stephen Hemminger
2009-03-12 21:00   ` Arthur Jones
2009-03-12 21:22     ` Stephen Hemminger
2009-03-12 21:33 ` [net-next PATCH] " Arthur Jones
2009-03-12 22:30   ` Alexander Duyck
2009-03-13 14:55     ` Arthur Jones
2009-03-13 16:24       ` Arthur Jones
2009-03-17 17:39   ` [net-next PATCH -- take 2] " Arthur Jones
2009-03-19  6:40     ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.