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

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

From: Michał Mirosław <hidden>
Date: 2012-02-10 22:56:51

2012/2/8  [off-list ref]:
From: Ben Greear <redacted>

This allows e100 to be configured to append the
Ethernet FCS to the skb.
[...]
quoted hunk ↗ jump to hunk
@@ -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 hunk ↗ jump to hunk
@@ -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);
...
quoted hunk ↗ jump to hunk
@@ -1980,7 +1987,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
       if (unlikely(!(rfd_status & cb_ok))) {
               /* Don't indicate if hardware indicates errors */
               dev_kfree_skb_any(skb);
-       } else if (actual_size > ETH_DATA_LEN + VLAN_ETH_HLEN) {
+       } else if (actual_size > ETH_DATA_LEN + VLAN_ETH_HLEN + fcs_pad) {
               /* Don't indicate oversized frames */
               nic->rx_over_length_errors++;
               dev_kfree_skb_any(skb);
Remove this part.

Those changes will keep RX bytes counter behaviour consistent
regardles if RXFCS is on or not. It's less code, BTW. ;-)

Best Regards,
Michał Mirosław
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help