mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
Cc: Paolo Abeni <pabeni@redhat.com>,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	andrew+netdev@lunn.ch, horms@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, michael.chan@broadcom.com,
	pavan.chebbi@broadcom.com, vsrama-krishna.nemani@broadcom.com,
	vikas.gupta@broadcom.com,
	Rajashekar Hudumula <rajashekar.hudumula@broadcom.com>
Subject: Re: [v4, net-next 2/7] bng_en: Add RX support
Date: Mon, 12 Jan 2026 22:11:11 +0100	[thread overview]
Message-ID: <ec0dc3cd-687a-4612-89d9-3c5cdd093ad0@lunn.ch> (raw)
In-Reply-To: <CANXQDtYR6P9+oHXpAzxPk4cE1jSYCFoCbELcWad25h1c6wfmQQ@mail.gmail.com>

On Tue, Jan 13, 2026 at 01:14:33AM +0530, Bhargava Chenna Marreddy wrote:
> On Thu, Jan 8, 2026 at 3:15 PM Paolo Abeni <pabeni@redhat.com> wrote:
> >
> > On 1/5/26 8:21 AM, Bhargava Marreddy wrote:
> > > diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_hw_def.h b/drivers/net/ethernet/broadcom/bnge/bnge_hw_def.h
> > > new file mode 100644
> > > index 000000000000..4da4259095fa
> > > --- /dev/null
> > > +++ b/drivers/net/ethernet/broadcom/bnge/bnge_hw_def.h
> > > @@ -0,0 +1,198 @@
> > > +/* SPDX-License-Identifier: GPL-2.0 */
> > > +/* Copyright (c) 2025 Broadcom */
> > > +
> > > +#ifndef _BNGE_HW_DEF_H_
> > > +#define _BNGE_HW_DEF_H_
> > > +
> > > +struct tx_bd_ext {
> > > +     __le32 tx_bd_hsize_lflags;
> > > +     #define TX_BD_FLAGS_TCP_UDP_CHKSUM                      (1 << 0)
> >
> > Please use BIT()
> 
> Simon Horman raised a similar point. However, some hardware BD values
> use non-contiguous bits that make BIT() and GENMASK() overly complex.
> We believe the current definitions better reflect the hardware spec.
> Please let us know if you’d still prefer a different approach.

You probably want to use BIT() for all fields which are
contiguous. Doing something different then marks the other fields are
somehow special and need treating with care.

> > > +     #define TX_BD_FLAGS_IP_CKSUM                            (1 << 1)
> > > +     #define TX_BD_FLAGS_NO_CRC                              (1 << 2)
> > > +     #define TX_BD_FLAGS_STAMP                               (1 << 3)
> > > +     #define TX_BD_FLAGS_T_IP_CHKSUM                         (1 << 4)
> > > +     #define TX_BD_FLAGS_LSO                                 (1 << 5)
> > > +     #define TX_BD_FLAGS_IPID_FMT                            (1 << 6)
> > > +     #define TX_BD_FLAGS_T_IPID                              (1 << 7)
> > > +     #define TX_BD_HSIZE                                     (0xff << 16)
> > > +      #define TX_BD_HSIZE_SHIFT                               16
> >
> > I'm quite suprised checkpatch does not complain, but the above
> > indentation is IMHO quite messy.

> > please move the macro definition before the struct and avoid mixing
> > whitespaces and tabs.
> 
> Since these are hardware-defined structs, we kept the #defines with
> their members to make the mapping clear.
> Any concerns with this?

The names should make it clear. The structure member can be called
tx_bd_flags, and the bits are TX_BD_FLAGS_IP_CKSUM etc.

> > > +static struct sk_buff *bnge_copy_skb(struct bnge_napi *bnapi, u8 *data,
> > > +                                  unsigned int len, dma_addr_t mapping)
> > > +{
> > > +     struct bnge_net *bn = bnapi->bn;
> > > +     struct bnge_dev *bd = bn->bd;
> > > +     struct sk_buff *skb;
> > > +
> > > +     skb = napi_alloc_skb(&bnapi->napi, len);
> > > +     if (!skb)
> > > +             return NULL;
> > > +
> > > +     dma_sync_single_for_cpu(bd->dev, mapping, bn->rx_copybreak,
> > > +                             bn->rx_dir);
> > > +
> > > +     memcpy(skb->data - NET_IP_ALIGN, data - NET_IP_ALIGN,
> > > +            len + NET_IP_ALIGN);
> >
> > This works under the assumption that len <=  bn->rx_copybreak; why
> > syncing the whole 'rx_copybreak' instead of 'len' ?
> 
> Good point. syncing the actual packet length is more precise and
> avoids unnecessary cache maintenance.
> Let us test this on our hardware and get back to you.

When i did this for the FEC, i got a nice performance boost.

     Andrew

  reply	other threads:[~2026-01-12 21:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05  7:21 [v4, net-next 0/7] bng_en: enhancements for RX and TX datapath Bhargava Marreddy
2026-01-05  7:21 ` [v4, net-next 1/7] bng_en: Extend bnge_set_ring_params() for rx-copybreak Bhargava Marreddy
2026-01-05  7:21 ` [v4, net-next 2/7] bng_en: Add RX support Bhargava Marreddy
2026-01-08  9:45   ` Paolo Abeni
2026-01-12 19:44     ` Bhargava Chenna Marreddy
2026-01-12 21:11       ` Andrew Lunn [this message]
2026-01-16 16:47         ` Bhargava Chenna Marreddy
2026-01-16 16:58       ` Bhargava Chenna Marreddy
2026-01-16 17:06   ` ALOK TIWARI
2026-01-16 18:28     ` Bhargava Chenna Marreddy
2026-01-05  7:21 ` [v4, net-next 3/7] bng_en: Handle an HWRM completion request Bhargava Marreddy
2026-01-05  7:21 ` [v4, net-next 4/7] bng_en: Add TX support Bhargava Marreddy
2026-01-08 10:09   ` Paolo Abeni
2026-01-12 21:16     ` Bhargava Chenna Marreddy
2026-01-16 18:43       ` Bhargava Chenna Marreddy
2026-01-05  7:21 ` [v4, net-next 5/7] bng_en: Add support to handle AGG events Bhargava Marreddy
2026-01-05  7:21 ` [v4, net-next 6/7] bng_en: Add TPA related functions Bhargava Marreddy
2026-01-05  7:21 ` [v4, net-next 7/7] bng_en: Add support for TPA events Bhargava Marreddy

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=ec0dc3cd-687a-4612-89d9-3c5cdd093ad0@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=andrew+netdev@lunn.ch \
    --cc=bhargava.marreddy@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=rajashekar.hudumula@broadcom.com \
    --cc=vikas.gupta@broadcom.com \
    --cc=vsrama-krishna.nemani@broadcom.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

all inboxes | Powered by JetHome®