netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Antoine Tenart <antoine.tenart@bootlin.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com,
	quentin.schulz@bootlin.com, allan.nielsen@microchip.com
Subject: Re: [PATCH net-next] net: mscc: allow extracting the FCS into the skb
Date: Mon, 1 Oct 2018 16:59:46 +0200	[thread overview]
Message-ID: <20181001145946.GD2967@piout.net> (raw)
In-Reply-To: <20181001095714.26024-1-antoine.tenart@bootlin.com>

On 01/10/2018 11:57:14+0200, Antoine Ténart wrote:
> This patch adds support for the NETIF_F_RXFCS feature in the Mscc
> Ethernet driver. This feature is disabled by default and allow an user
> to request the driver not to drop the FCS and to extract it into the skb
> for debugging purposes.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

> ---
>  drivers/net/ethernet/mscc/ocelot.c       | 2 +-
>  drivers/net/ethernet/mscc/ocelot_board.c | 7 ++++++-
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
> index 1a4f2bb48ead..eb5119e7e60b 100644
> --- a/drivers/net/ethernet/mscc/ocelot.c
> +++ b/drivers/net/ethernet/mscc/ocelot.c
> @@ -1606,7 +1606,7 @@ int ocelot_probe_port(struct ocelot *ocelot, u8 port,
>  	dev->ethtool_ops = &ocelot_ethtool_ops;
>  	dev->switchdev_ops = &ocelot_port_switchdev_ops;
>  
> -	dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
> +	dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS;
>  	dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
>  
>  	memcpy(dev->dev_addr, ocelot->base_mac, ETH_ALEN);
> diff --git a/drivers/net/ethernet/mscc/ocelot_board.c b/drivers/net/ethernet/mscc/ocelot_board.c
> index 3cdf63e35b53..245452a0f244 100644
> --- a/drivers/net/ethernet/mscc/ocelot_board.c
> +++ b/drivers/net/ethernet/mscc/ocelot_board.c
> @@ -126,11 +126,16 @@ static irqreturn_t ocelot_xtr_irq_handler(int irq, void *arg)
>  			len += sz;
>  		} while (len < buf_len);
>  
> -		/* Read the FCS and discard it */
> +		/* Read the FCS */
>  		sz = ocelot_rx_frame_word(ocelot, grp, false, &val);
>  		/* Update the statistics if part of the FCS was read before */
>  		len -= ETH_FCS_LEN - sz;
>  
> +		if (unlikely(dev->features & NETIF_F_RXFCS)) {
> +			buf = (u32 *)skb_put(skb, ETH_FCS_LEN);
> +			*buf = val;
> +		}
> +
>  		if (sz < 0) {
>  			err = sz;
>  			break;
> -- 
> 2.17.1
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2018-10-01 14:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-01  9:57 [PATCH net-next] net: mscc: allow extracting the FCS into the skb Antoine Tenart
2018-10-01 14:59 ` Alexandre Belloni [this message]
2018-10-01 16:35 ` Florian Fainelli
2018-10-02  6:59   ` Antoine Tenart
2018-10-02 12:43     ` Andrew Lunn
2018-10-10 14:46       ` Antoine Tenart
2018-10-10 16:25         ` Florian Fainelli
2018-10-10 17:26           ` David Miller
2018-10-11  6:57             ` Antoine Tenart

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=20181001145946.GD2967@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=allan.nielsen@microchip.com \
    --cc=antoine.tenart@bootlin.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=quentin.schulz@bootlin.com \
    --cc=thomas.petazzoni@bootlin.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).