Thread (26 messages) flat view 26 messages, 7 authors, 2012-02-11

Re: [PATCH v2 02/10] e100: Support RXFCS feature flag.

From: Ben Greear <hidden>
Date: 2012-02-11 00:17:26

On 02/10/2012 02:56 PM, Michał Mirosław wrote:
2012/2/8[off-list ref]:
quoted
From: Ben Greear<redacted>

This allows e100 to be configured to append the
Ethernet FCS to the skb.
[...]
quoted
@@ -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.
quoted
@@ -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.
quoted
        actual_size = le16_to_cpu(rfd->actual_size)&  0x3FFF;
u16 data_size = actual_size;
if (unlikely(dev->features&  NETIF_F_RXFCS))
     actual_size -= 4;
quoted
-       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 [off-list ref]
Candela Technologies Inc  http://www.candelatech.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help