Skip to contentSkip to conversation

igb: allow tx of pre-formatted vlan tagged packets

PATCH In review Arthur Jones 4 participants 10 messages Mar 12, 2009 – Mar 19, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igb: allow tx of pre-formatted vlan tagged packets

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 <[email protected]> for discovering the issue and the coming up with a solution. This patch is based upon his work.

---
 drivers/net/igb/igb_main.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
drivers/net/igb/igb_main.c +11 -1
index fddeece..99ba3a5 100644
@@ -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)
Signature · 1 line
1.5.6.3
#1 lore raw
Quoted 13 lines · On Thu, 12 Mar 2009 13:27:24 -0700 Arthur Jones <[email protected]> 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.

Quoted 8 lines

Thanks to Kand Ly <[email protected]> for discovering the issue and the coming up with a solution. This patch is based upon his work.

---
 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.

drivers/net/igb/igb_main.c static inline bool igb_tx_csum_adv(struct igb_adapter *adapter, · line 2783

Quoted 12 lines
drivers/net/igb/igb_main.c +3 -1
index fddeece..99ba3a5 100644
@@ -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.

Quoted 11 lines
drivers/net/igb/igb_main.c +8 -0
+				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)
#2 lore raw

Hi Stephen, ...

Quoted 20 lines · Stephen Hemminger
Quoted 17 lines · On Thu, 12 Mar 2009 13:27:24 -0700 Arthur Jones <[email protected]> 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 <[email protected]> for discovering the issue and the coming up with a solution. This patch is based upon his work.

Quoted 7 lines
Quoted 4 lines
---
 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

#3 lore raw
Quoted 28 lines · On Thu, 12 Mar 2009 14:00:57 -0700 Arthur Jones <[email protected]> wrote:

Hi Stephen, ...

Quoted 25 lines · Stephen Hemminger
Quoted 21 lines · On Thu, 12 Mar 2009 13:27:24 -0700 Arthur Jones <[email protected]> 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 <[email protected]> for discovering the issue and the coming up with a solution. This patch is based upon his work.

---
 drivers/net/igb/igb_main.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
Quoted 6 lines
Quoted 2 lines

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

#4 lore raw

PATCH 1/1 igb: allow tx of pre-formatted vlan tagged packets

In reply to Arthur Jones

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 <[email protected]> for discovering the issue and the coming up with a solution. This patch is based upon his work.

Macro fixups from Stephen Hemminger <[email protected]>

---
 drivers/net/igb/igb_main.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
drivers/net/igb/igb_main.c +11 -1
index 78558f8..e4ef1f6 100644
@@ -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)
Signature · 8 lines
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
#5 lore raw

I have added a few comments inline.

Quoted 29 lines · Arthur Jones

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 <[email protected]> for discovering the issue and the coming up with a solution. This patch is based upon his work.

Macro fixups from Stephen Hemminger <[email protected]>

---
 drivers/net/igb/igb_main.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
drivers/net/igb/igb_main.c +0 -0
index 78558f8..e4ef1f6 100644

drivers/net/igb/igb_main.c static inline bool igb_tx_csum_adv(struct igb_adapter *adapter, · line 3024

Quoted 9 lines
drivers/net/igb/igb_main.c +5 -1
@@ -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.

drivers/net/igb/igb_main.c static inline bool igb_tx_csum_adv(struct igb_adapter *adapter, · line 3029

Quoted 5 lines
drivers/net/igb/igb_main.c +5 -0
+
+				protocol = vhdr->h_vlan_encapsulated_proto;
+			} else
+				protocol = skb->protocol;
+

This else should have braces since the matching if was using braces.

drivers/net/igb/igb_main.c static inline bool igb_tx_csum_adv(struct igb_adapter *adapter, · line 3033

Quoted 4 lines
drivers/net/igb/igb_main.c +1 -0
+			switch (protocol) {
 			case cpu_to_be16(ETH_P_IP):
 				tu_cmd |= E1000_ADVTXD_TUCMD_IPV4;
 				if (ip_hdr(skb)->protocol == IPPROTO_TCP)

Thanks,

Alex

#6 lore raw

Hi Alexander, ...

Quoted 1 line · Alexander Duyck

I have added a few comments inline.

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

Arthur

#7 lore raw
Quoted 6 lines · Arthur Jones

Hi Alexander, ...

Quoted 1 line · Alexander Duyck

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

#8 lore raw

PATCH 1/1 igb: allow tx of pre-formatted vlan tagged packets

In reply to Arthur Jones

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 <[email protected]> for discovering the issue and the coming up with a solution. This patch is based upon his work.

Fixups from Stephen Hemminger <[email protected]> and Alexander Duyck <[email protected]>.

---
 drivers/net/igb/igb_main.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
drivers/net/igb/igb_main.c +12 -1
index 7124f59..26742dd 100644
@@ -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)
Signature · 8 lines
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
maintainer
#9 lore raw

From: Arthur Jones <[email protected]>
Date: Tue, 17 Mar 2009 10:39:24 -0700

Quoted 13 lines

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.

Quoted 8 lines

Thanks to Kand Ly <[email protected]> for discovering the issue and the coming up with a solution. This patch is based upon his work.

Fixups from Stephen Hemminger <[email protected]> and Alexander Duyck <[email protected]>.

Jeff, are you queueing this one up?