[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 10 Feb 2012 16:17:25 -0800
From: Ben Greear <greearb@...delatech.com>
To: Michał Mirosław <mirqus@...il.com>
CC: netdev@...r.kernel.org
Subject: Re: [PATCH v2 02/10] e100: Support RXFCS feature flag.
On 02/10/2012 02:56 PM, Michał Mirosław wrote:
> 2012/2/8<greearb@...delatech.com>:
>> From: Ben Greear<greearb@...delatech.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@...delatech.com>
Candela Technologies Inc http://www.candelatech.com
--
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