Patchwork [2/2] qeth: l3 hw tx csum circumvent hw bug

login
register
mail settings
Submitter frank.blaschka@de.ibm.com
Date Jan. 13, 2011, 6:42 a.m.
Message ID <20110113064310.729751199@de.ibm.com>
Download mbox | patch
Permalink /patch/78669/
State Accepted
Delegated to: David Miller
Headers show

Comments

frank.blaschka@de.ibm.com - Jan. 13, 2011, 6:42 a.m.
From: Frank Blaschka <frank.blaschka@de.ibm.com>

Some OSA level have a bug in the hw tx csum logic. We can circumvent
this bug by turning on IP hw csum also.

Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
---

 drivers/s390/net/qeth_l3_main.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Jan. 13, 2011, 7:47 a.m.
From: frank.blaschka@de.ibm.com
Date: Thu, 13 Jan 2011 07:42:25 +0100

> --- a/drivers/s390/net/qeth_l3_main.c
> +++ b/drivers/s390/net/qeth_l3_main.c
> @@ -2998,7 +2998,9 @@ static inline void qeth_l3_hdr_csum(stru
>  	 */
>  	if (iph->protocol == IPPROTO_UDP)
>  		hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_UDP;
> -	hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_CSUM_TRANSP_REQ;
> +	hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_CSUM_TRANSP_REQ |
> +		QETH_HDR_EXT_CSUM_HDR_REQ;
> +	iph->check = 0;
>  	if (card->options.performance_stats)
>  		card->perf_stats.tx_csum++;
>  }

You may not change the packet header contents blindly like this.
Otherwise unpredictable contents will be seen by tcpdump and any
other code path which has a clone of this packet.

Thus, you'll need to guard this change with something like:

		if (skb_header_cloned(skb) &&
		    pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
			dev_kfree_skb(skb);
			goto tx_fail;
		}

Please fix this and resubmit your two patches.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
frank.blaschka@de.ibm.com - Jan. 13, 2011, 8:23 a.m.
On Wed, Jan 12, 2011 at 11:47:35PM -0800, David Miller wrote:
> From: frank.blaschka@de.ibm.com
> Date: Thu, 13 Jan 2011 07:42:25 +0100
> 
> > --- a/drivers/s390/net/qeth_l3_main.c
> > +++ b/drivers/s390/net/qeth_l3_main.c
> > @@ -2998,7 +2998,9 @@ static inline void qeth_l3_hdr_csum(stru
> >  	 */
> >  	if (iph->protocol == IPPROTO_UDP)
> >  		hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_UDP;
> > -	hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_CSUM_TRANSP_REQ;
> > +	hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_CSUM_TRANSP_REQ |
> > +		QETH_HDR_EXT_CSUM_HDR_REQ;
> > +	iph->check = 0;
> >  	if (card->options.performance_stats)
> >  		card->perf_stats.tx_csum++;
> >  }
> 
> You may not change the packet header contents blindly like this.
> Otherwise unpredictable contents will be seen by tcpdump and any
> other code path which has a clone of this packet.
> 
> Thus, you'll need to guard this change with something like:
> 
> 		if (skb_header_cloned(skb) &&
> 		    pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
> 			dev_kfree_skb(skb);
> 			goto tx_fail;
> 		}
Yes I know. Because of the suboptimal l3 driver design :-) we already have
a private copy of the skb at this place. Thx!
> 
> Please fix this and resubmit your two patches.
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Jan. 16, 2011, 4:46 a.m.
From: Frank Blaschka <frank.blaschka@de.ibm.com>
Date: Thu, 13 Jan 2011 09:23:59 +0100

> On Wed, Jan 12, 2011 at 11:47:35PM -0800, David Miller wrote:
>> From: frank.blaschka@de.ibm.com
>> Date: Thu, 13 Jan 2011 07:42:25 +0100
>> 
>> > --- a/drivers/s390/net/qeth_l3_main.c
>> > +++ b/drivers/s390/net/qeth_l3_main.c
>> > @@ -2998,7 +2998,9 @@ static inline void qeth_l3_hdr_csum(stru
>> >  	 */
>> >  	if (iph->protocol == IPPROTO_UDP)
>> >  		hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_UDP;
>> > -	hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_CSUM_TRANSP_REQ;
>> > +	hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_CSUM_TRANSP_REQ |
>> > +		QETH_HDR_EXT_CSUM_HDR_REQ;
>> > +	iph->check = 0;
>> >  	if (card->options.performance_stats)
>> >  		card->perf_stats.tx_csum++;
>> >  }
>> 
>> You may not change the packet header contents blindly like this.
>> Otherwise unpredictable contents will be seen by tcpdump and any
>> other code path which has a clone of this packet.
>> 
>> Thus, you'll need to guard this change with something like:
>> 
>> 		if (skb_header_cloned(skb) &&
>> 		    pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
>> 			dev_kfree_skb(skb);
>> 			goto tx_fail;
>> 		}
> Yes I know. Because of the suboptimal l3 driver design :-) we already have
> a private copy of the skb at this place. Thx!

I see, thanks for explaining.

Both patches applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -2998,7 +2998,9 @@  static inline void qeth_l3_hdr_csum(stru
 	 */
 	if (iph->protocol == IPPROTO_UDP)
 		hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_UDP;
-	hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_CSUM_TRANSP_REQ;
+	hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_CSUM_TRANSP_REQ |
+		QETH_HDR_EXT_CSUM_HDR_REQ;
+	iph->check = 0;
 	if (card->options.performance_stats)
 		card->perf_stats.tx_csum++;
 }