All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: "Michał Mirosław" <mirqus@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH v2 02/10] e100: Support RXFCS feature flag.
Date: Fri, 10 Feb 2012 16:17:25 -0800	[thread overview]
Message-ID: <4F35B395.3000003@candelatech.com> (raw)
In-Reply-To: <CAHXqBFJoxkM+U5y5NiepO3BxsjuK=gpYQQTvWXjbRZOnKjCiaQ@mail.gmail.com>

On 02/10/2012 02:56 PM, Michał Mirosław wrote:
> 2012/2/8<greearb@candelatech.com>:
>> From: Ben Greear<greearb@candelatech.com>
>>
>> This allows e100 to be configured to append the
>> Ethernet FCS to the skb.
> [...]
>> @@ -1919,6 +1923,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
>>         struct sk_buff *skb = rx->skb;
>>         struct rfd *rfd = (struct rfd *)skb->data;
>>         u16 rfd_status, actual_size;
>> +       u16 fcs_pad = 0;
>>
>>         if (unlikely(work_done&&  *work_done>= work_to_do))
>>                 return -EAGAIN;
>
> Remove this part.
>
>> @@ -1951,9 +1956,11 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
>>         }
>>
>>         /* Get actual data size */
>> +       if (unlikely(dev->features&  NETIF_F_RXFCS))
>> +               fcs_pad = 4;
>
> Remove part above.
>
>>         actual_size = le16_to_cpu(rfd->actual_size)&  0x3FFF;
>
> u16 data_size = actual_size;
> if (unlikely(dev->features&  NETIF_F_RXFCS))
>      actual_size -= 4;
>
>> -       if (unlikely(actual_size>  RFD_BUF_LEN - sizeof(struct rfd)))
>> -               actual_size = RFD_BUF_LEN - sizeof(struct rfd);
>> +       if (unlikely(actual_size>  RFD_BUF_LEN + fcs_pad - sizeof(struct rfd)))
>> +               actual_size = RFD_BUF_LEN + fcs_pad - sizeof(struct rfd);
>>
>>         /* Get data */
>>         pci_unmap_single(nic->pdev, rx->dma_addr,
>
> Remove this part.
>
> ...
> skb_put(skb, data_size);
> ...

Well, that breaks if the unlikely() branch hits above..now 'data_size' will
be larger than it should be.  I can add more logic to fix that up, but
then code size is going to be larger again, and we also have the
potential confusion between what data-size and actual-size variables
mean.

I will double-check that the counter works properly, but I think I'll
leave the rest as it is, at least for now.

Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

  reply	other threads:[~2012-02-11  0:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-08 19:54 [PATCH v2 00/10] Low-level Ethernet debugging features greearb
2012-02-08 19:54 ` [PATCH v2 01/10] net: Support RXFCS feature flag greearb
2012-02-08 19:54 ` [PATCH v2 02/10] e100: " greearb
2012-02-10 22:56   ` Michał Mirosław
2012-02-11  0:17     ` Ben Greear [this message]
2012-02-08 19:54 ` [PATCH v2 03/10] e1000e: " greearb
2012-02-10 22:46   ` Michał Mirosław
2012-02-10 22:57     ` Ben Greear
2012-02-10 23:09       ` Michał Mirosław
2012-02-11  0:06         ` Ben Greear
2012-02-08 19:54 ` [PATCH v2 04/10] net: Add framework to allow sending packets with customized CRC greearb
2012-02-08 19:54 ` [PATCH v2 05/10] e100: Support sending custom Ethernet CRC greearb
2012-02-08 19:54 ` [PATCH v2 06/10] e1000e: " greearb
2012-02-08 19:54 ` [PATCH v2 07/10] net: Support RX-ALL feature flag greearb
2012-02-08 19:54 ` [PATCH v2 08/10] e1000e: Support RXALL " greearb
2012-02-08 19:54 ` [PATCH v2 09/10] e100: " greearb
2012-02-08 19:54 ` [PATCH v2 10/10] e1000: Support sending custom Ethernet CRC greearb
2012-02-10  4:31 ` [PATCH v2 00/10] Low-level Ethernet debugging features Jeff Kirsher
2012-02-10  5:42   ` Ben Greear
2012-02-10  5:52     ` Jeff Kirsher
2012-02-10 13:25     ` Eric Dumazet
2012-02-10 13:45       ` David Laight
2012-02-10 13:51         ` Eric Dumazet
2012-02-10 14:09           ` Eric Dumazet
2012-02-10 17:18       ` Ben Greear
2012-02-10 20:43   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F35B395.3000003@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=mirqus@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.