netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Sergey Shtylyov <s.shtylyov@omp.ru>
Cc: "Paul Barker" <paul@pbarker.dev>,
	"David S . Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Paul Barker" <paul.barker.ct@bp.renesas.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
	"Biju Das" <biju.das.jz@bp.renesas.com>,
	"Claudiu Beznea" <claudiu.beznea.uj@bp.renesas.com>,
	netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [net-next PATCH 11/11] net: ravb: Add VLAN checksum support
Date: Tue, 1 Oct 2024 11:44:13 +0100	[thread overview]
Message-ID: <20241001104413.GK1310185@kernel.org> (raw)
In-Reply-To: <ab7482f9-6833-416f-8adf-5e1347628dec@omp.ru>

On Mon, Sep 30, 2024 at 11:36:40PM +0300, Sergey Shtylyov wrote:
> On 9/30/24 19:08, Paul Barker wrote:
> 
> > From: Paul Barker <paul.barker.ct@bp.renesas.com>
> > 
> > The GbEth IP supports offloading checksum calculation for VLAN-tagged
> > packets, provided that the EtherType is 0x8100 and only one VLAN tag is
> > present.
> > 
> > Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
> [...]
> 
> > diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> > index 832132d44fb4..eb7499d42a9b 100644
> > --- a/drivers/net/ethernet/renesas/ravb_main.c
> > +++ b/drivers/net/ethernet/renesas/ravb_main.c
> > @@ -2063,11 +2063,30 @@ static void ravb_tx_timeout_work(struct work_struct *work)
> >  
> >  static bool ravb_can_tx_csum_gbeth(struct sk_buff *skb)
> >  {
> > -	/* TODO: Need to add support for VLAN tag 802.1Q */
> > -	if (skb_vlan_tag_present(skb))
> > +	u16 net_protocol = ntohs(skb->protocol);
> > +
> > +	/* GbEth IP can calculate the checksum if:
> > +	 * - there are zero or one VLAN headers with TPID=0x8100
> > +	 * - the network protocol is IPv4 or IPv6
> > +	 * - the transport protocol is TCP, UDP or ICMP
> > +	 * - the packet is not fragmented
> > +	 */
> > +
> > +	if (skb_vlan_tag_present(skb) &&
> > +	    (skb->vlan_proto != ETH_P_8021Q || net_protocol == ETH_P_8021Q))
> 
>    Not sure I understand this check... Maybe s/==/!=/?

A minor nit if the check stays in some form:
vlan_proto is big endian, while ETH_P_8021Q is host byte order.

> 
> >  		return false;
> >  
> > -	switch (ntohs(skb->protocol)) {
> > +	if (net_protocol == ETH_P_8021Q) {
> > +		struct vlan_hdr vhdr, *vh;
> > +
> > +		vh = skb_header_pointer(skb, ETH_HLEN, sizeof(vhdr), &vhdr);
> 
>    Hm, I thought the VLAN header starts at ETH_HLEN - 2, not at ETH_HLEN...
> 
> [...]
> 
> MBR, Sergey
> 
> 

  parent reply	other threads:[~2024-10-01 10:44 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30 16:08 [net-next PATCH 00/11] Extend GbEth checksum offload support to VLAN/IPv6 packets Paul Barker
2024-09-30 16:08 ` [net-next PATCH 01/11] net: ravb: Factor out checksum offload enable bits Paul Barker
2024-09-30 17:02   ` Sergey Shtylyov
2024-09-30 16:08 ` [net-next PATCH 02/11] net: ravb: Disable IP header RX checksum offloading Paul Barker
2024-09-30 17:16   ` Sergey Shtylyov
2024-09-30 16:08 ` [net-next PATCH 03/11] net: ravb: Drop IP protocol check from RX csum verification Paul Barker
2024-09-30 17:29   ` Sergey Shtylyov
2024-09-30 16:08 ` [net-next PATCH 04/11] net: ravb: Combine if conditions in RX csum validation Paul Barker
2024-09-30 17:40   ` Sergey Shtylyov
2024-09-30 16:08 ` [net-next PATCH 05/11] net: ravb: Simplify types " Paul Barker
2024-09-30 19:11   ` Sergey Shtylyov
2024-09-30 19:30     ` Sergey Shtylyov
2024-10-03  9:23     ` Paul Barker
2024-10-03 13:20       ` Sergey Shtylyov
2024-09-30 16:08 ` [net-next PATCH 06/11] net: ravb: Disable IP header TX checksum offloading Paul Barker
2024-09-30 19:23   ` Sergey Shtylyov
2024-09-30 16:08 ` [net-next PATCH 07/11] net: ravb: Simplify UDP TX checksum offload Paul Barker
2024-09-30 19:39   ` Sergey Shtylyov
2024-09-30 16:08 ` [net-next PATCH 08/11] net: ravb: Support ICMP TX checksum offload for GbEth Paul Barker
2024-09-30 19:48   ` Sergey Shtylyov
2024-09-30 16:08 ` [net-next PATCH 09/11] net: ravb: Enable IPv6 RX checksum offloading " Paul Barker
2024-09-30 19:55   ` Sergey Shtylyov
2024-09-30 16:08 ` [net-next PATCH 10/11] net: ravb: Enable IPv6 TX checksum offload " Paul Barker
2024-09-30 20:08   ` Sergey Shtylyov
2024-09-30 16:08 ` [net-next PATCH 11/11] net: ravb: Add VLAN checksum support Paul Barker
2024-09-30 20:36   ` Sergey Shtylyov
2024-09-30 22:32     ` Sergey Shtylyov
2024-10-01 10:44     ` Simon Horman [this message]
2024-10-02 15:27       ` Sergey Shtylyov
2024-10-03 10:26     ` Paul Barker
2024-10-01 16:46   ` kernel test robot

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=20241001104413.GK1310185@kernel.org \
    --to=horms@kernel.org \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=claudiu.beznea.uj@bp.renesas.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=geert+renesas@glider.be \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=pabeni@redhat.com \
    --cc=paul.barker.ct@bp.renesas.com \
    --cc=paul@pbarker.dev \
    --cc=s.shtylyov@omp.ru \
    /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).