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]
Date:   Thu, 2 Feb 2017 16:34:00 -0800
From:   Michael Chan <michael.chan@...adcom.com>
To:     Jakub Kicinski <kubakici@...pl>
Cc:     David Miller <davem@...emloft.net>, Netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next v2 01/12] bnxt_en: Refactor rx SKB function.

On Thu, Feb 2, 2017 at 4:22 PM, Jakub Kicinski <kubakici@...pl> wrote:
> On Thu, 2 Feb 2017 15:40:19 -0800, Michael Chan wrote:
>> On Thu, Feb 2, 2017 at 2:56 PM, Jakub Kicinski <kubakici@...pl> wrote:
>> > (b) why
>> > do you encode the two parameters in a single u32?  It's the seventh
>> > parameter so it's going on the stack anyway, no?
>>
>> Both the length and the offset come from the hardware's rx completion
>> record.  Both are u16.  The offset happens to be in the upper 16-bit
>> in the hardware record.  So it is convenient to encode it like this
>> and I chose to do it like this. Of course, using a separate parameter
>> will also work.
>
> Yes, I initially thought you read them out this way straight from the
> descriptor but you actually combine them into this form:
>
> +               unsigned int payload_len;
> +
> +               payload_len = (le32_to_cpu(rxcmp->rx_cmp_misc_v1) &
> +                              RX_CMP_PAYLOAD_OFFSET) | len;
> +               skb = bp->rx_skb_func(bp, rxr, cons, prod, data, dma_addr,
>

Yes they are combined because they come from 2 different words.  But I
don't have to do the shift for the offset because it is already in the
upper 16-bit.

> I don't mind though, I was just hoping this is some clever optimization
> technique I could learn :)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ