lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B50C4F4.60903@caviumnetworks.com>
Date:	Fri, 15 Jan 2010 11:41:40 -0800
From:	David Daney <ddaney@...iumnetworks.com>
To:	Andrew May <acmay@...ay.org>
CC:	ralf@...ux-mips.org, linux-mips@...ux-mips.org,
	netdev@...r.kernel.org, gregkh@...e.de
Subject: Re: [PATCH 7/7] Staging: Octeon Ethernet: Use constants from in.h

Andrew May wrote:
> On Thu,  7 Jan 2010 11:05:06 -0800
> David Daney <ddaney@...iumnetworks.com> wrote:
> 
>> Signed-off-by: David Daney <ddaney@...iumnetworks.com>
>> ---
>>  drivers/staging/octeon/ethernet-defines.h |    3 ---
>>  drivers/staging/octeon/ethernet-tx.c      |    8 ++++----
>>  2 files changed, 4 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/staging/octeon/ethernet-defines.h
>> b/drivers/staging/octeon/ethernet-defines.h index 9c4910e..00a8561
>> 100644 --- a/drivers/staging/octeon/ethernet-defines.h
>> +++ b/drivers/staging/octeon/ethernet-defines.h
>> @@ -98,9 +98,6 @@
>>  #define MAX_SKB_TO_FREE 10
>>  #define MAX_OUT_QUEUE_DEPTH 1000
>>  
>> -#define IP_PROTOCOL_TCP             6
>> -#define IP_PROTOCOL_UDP             0x11
>> -
>>  #define FAU_NUM_PACKET_BUFFERS_TO_FREE (CVMX_FAU_REG_END -
>> sizeof(uint32_t)) #define TOTAL_NUMBER_OF_PORTS
>> (CVMX_PIP_NUM_INPUT_PORTS+1) 
>> diff --git a/drivers/staging/octeon/ethernet-tx.c
>> b/drivers/staging/octeon/ethernet-tx.c index bc67e41..62258bd 100644
>> --- a/drivers/staging/octeon/ethernet-tx.c
>> +++ b/drivers/staging/octeon/ethernet-tx.c
>> @@ -359,8 +359,8 @@ dont_put_skbuff_in_hw:
>>  	if (USE_HW_TCPUDP_CHECKSUM && (skb->protocol ==
>> htons(ETH_P_IP)) && (ip_hdr(skb)->version == 4) && (ip_hdr(skb)->ihl
>> == 5) && ((ip_hdr(skb)->frag_off == 0) || (ip_hdr(skb)->frag_off == 1
>> << 14))
>> -	    && ((ip_hdr(skb)->protocol == IP_PROTOCOL_TCP)
>> -		|| (ip_hdr(skb)->protocol == IP_PROTOCOL_UDP))) {
>> +	    && ((ip_hdr(skb)->protocol == IPPROTO_TCP)
>> +		|| (ip_hdr(skb)->protocol == IPPROTO_UDP))) {
>>  		/* Use hardware checksum calc */
>>  		pko_command.s.ipoffp1 = sizeof(struct ethhdr) + 1;
>>  	}
> 
> Why isn't skb->ip_summed checked here instead?

That may indeed be the correct thing to do, but the main point of this 
particular patch is to remove local definitions that mirror definitions 
provided by core include files.

So in order to not let 'the perfect be the enemy of the good' I think 
this patch should be applied.

> It seems like the csum
> calculation needs to be skipped by the stack if this is actually going
> to help performance.

FWIW: We do set NETIF_F_IP_CSUM.  We are certainly open to suggestions 
as to how the code could be improved, so I may look at this again in the 
future.  Patches from others are also welcome.

> 
> And does this end up re-writing a bad checksum on a routed packet, back
> to being a good checksum?

Indeed it does.  Actually it writes a good checksum on *all* IP packets 
without regard to their source.

David Daney
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists