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]
Message-ID: <CAHXqBFJoxkM+U5y5NiepO3BxsjuK=gpYQQTvWXjbRZOnKjCiaQ@mail.gmail.com>
Date:	Fri, 10 Feb 2012 23:56:31 +0100
From:	Michał Mirosław <mirqus@...il.com>
To:	greearb@...delatech.com
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH v2 02/10] e100: Support RXFCS feature flag.

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);
...

> @@ -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
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ