netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xin Long <lucien.xin@gmail.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: network dev <netdev@vger.kernel.org>,
	davem@davemloft.net, kuba@kernel.org,
	Eric Dumazet <edumazet@google.com>,
	David Ahern <dsahern@gmail.com>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	Pravin B Shelar <pshelar@ovn.org>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Jiri Pirko <jiri@resnulli.us>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Florian Westphal <fw@strlen.de>,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	Ilya Maximets <i.maximets@ovn.org>,
	Aaron Conole <aconole@redhat.com>,
	Roopa Prabhu <roopa@nvidia.com>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	Mahesh Bandewar <maheshb@google.com>,
	Paul Moore <paul@paul-moore.com>,
	Guillaume Nault <gnault@redhat.com>
Subject: Re: [PATCHv4 net-next 09/10] net: add gso_ipv4_max_size and gro_ipv4_max_size per device
Date: Tue, 31 Jan 2023 12:55:10 -0500	[thread overview]
Message-ID: <CADvbK_fXGCEwuHX5PCU1-+dTTG4ZMLGLXY8A_AqJpDoR2uV-cA@mail.gmail.com> (raw)
In-Reply-To: <0601c53b3dc178293e05d87f75f481367ff4fd47.camel@redhat.com>

On Tue, Jan 31, 2023 at 9:59 AM Paolo Abeni <pabeni@redhat.com> wrote:
>
> On Sat, 2023-01-28 at 10:58 -0500, Xin Long wrote:
> > This patch introduces gso_ipv4_max_size and gro_ipv4_max_size
> > per device and adds netlink attributes for them, so that IPV4
> > BIG TCP can be guarded by a separate tunable in the next patch.
> >
> > To not break the old application using "gso/gro_max_size" for
> > IPv4 GSO packets, this patch updates "gso/gro_ipv4_max_size"
> > in netif_set_gso/gro_max_size() if the new size isn't greater
> > than GSO_LEGACY_MAX_SIZE, so that nothing will change even if
> > userspace doesn't realize the new netlink attributes.
>
> Not a big deal, but I think it would be nice to include the pahole info
> showing where the new fields are located and why that are good
> locations.
>
> No need to send a new version for just for the above, unless Eric asks
> otherwise ;)
>
The the pahole info without and with the patch shows below:

- Without the Patch:

# pahole --hex -C net_device vmlinux
struct net_device {
...
long unsigned int          gro_flush_timeout;    /* 0x330   0x8 */
int                        napi_defer_hard_irqs; /* 0x338   0x4 */
unsigned int               gro_max_size;         /* 0x33c   0x4 */  <---------
/* --- cacheline 13 boundary (832 bytes) --- */
rx_handler_func_t *        rx_handler;           /* 0x340   0x8 */
void *                     rx_handler_data;      /* 0x348   0x8 */
struct mini_Qdisc *        miniq_ingress;        /* 0x350   0x8 */
struct netdev_queue *      ingress_queue;        /* 0x358   0x8 */
struct nf_hook_entries *   nf_hooks_ingress;     /* 0x360   0x8 */
unsigned char              broadcast[32];        /* 0x368  0x20 */
/* --- cacheline 14 boundary (896 bytes) was 8 bytes ago --- */
struct cpu_rmap *          rx_cpu_rmap;          /* 0x388   0x8 */
struct hlist_node          index_hlist;          /* 0x390  0x10 */

/* XXX 32 bytes hole, try to pack */

/* --- cacheline 15 boundary (960 bytes) --- */
struct netdev_queue *      _tx __attribute__((__aligned__(64))); /*
0x3c0   0x8 */
...

/* --- cacheline 32 boundary (2048 bytes) was 24 bytes ago --- */
const struct attribute_group  * sysfs_groups[4]; /* 0x818  0x20 */
const struct attribute_group  * sysfs_rx_queue_group; /* 0x838   0x8 */
/* --- cacheline 33 boundary (2112 bytes) --- */
const struct rtnl_link_ops  * rtnl_link_ops;     /* 0x840   0x8 */
unsigned int               gso_max_size;         /* 0x848   0x4 */
unsigned int               tso_max_size;         /* 0x84c   0x4 */
u16                        gso_max_segs;         /* 0x850   0x2 */
u16                        tso_max_segs;         /* 0x852   0x2 */   <---------

/* XXX 4 bytes hole, try to pack */

const struct dcbnl_rtnl_ops  * dcbnl_ops;        /* 0x858   0x8 */
s16                        num_tc;               /* 0x860   0x2 */
struct netdev_tc_txq       tc_to_txq[16];        /* 0x862  0x40 */
/* --- cacheline 34 boundary (2176 bytes) was 34 bytes ago --- */
u8                         prio_tc_map[16];      /* 0x8a2  0x10 */
...
}


- With the Patch:

For "gso_ipv4_max_size", it filled the hole as expected.

/* --- cacheline 33 boundary (2112 bytes) --- */
const struct rtnl_link_ops  * rtnl_link_ops;     /* 0x840   0x8 */
unsigned int               gso_max_size;         /* 0x848   0x4 */
unsigned int               tso_max_size;         /* 0x84c   0x4 */
u16                        gso_max_segs;         /* 0x850   0x2 */
u16                        tso_max_segs;         /* 0x852   0x2 */
unsigned int               gso_ipv4_max_size;    /* 0x854   0x4 */ <-------
const struct dcbnl_rtnl_ops  * dcbnl_ops;        /* 0x858   0x8 */
s16                        num_tc;               /* 0x860   0x2 */
struct netdev_tc_txq       tc_to_txq[16];        /* 0x862  0x40 */
/* --- cacheline 34 boundary (2176 bytes) was 34 bytes ago --- */
u8                         prio_tc_map[16];      /* 0x8a2  0x10 */


For "gro_ipv4_max_size", these are no byte holes, I just put it
in the "Cache lines mostly used on receive path" area, and
next to gro_max_size.

long unsigned int          gro_flush_timeout;    /* 0x330   0x8 */
int                        napi_defer_hard_irqs; /* 0x338   0x4 */
unsigned int               gro_max_size;         /* 0x33c   0x4 */
/* --- cacheline 13 boundary (832 bytes) --- */
unsigned int               gro_ipv4_max_size;    /* 0x340   0x4 */  <------

/* XXX 4 bytes hole, try to pack */

rx_handler_func_t *        rx_handler;           /* 0x348   0x8 */
void *                     rx_handler_data;      /* 0x350   0x8 */
struct mini_Qdisc *        miniq_ingress;        /* 0x358   0x8 */
struct netdev_queue *      ingress_queue;        /* 0x360   0x8 */
struct nf_hook_entries *   nf_hooks_ingress;     /* 0x368   0x8 */
unsigned char              broadcast[32];        /* 0x370  0x20 */
/* --- cacheline 14 boundary (896 bytes) was 16 bytes ago --- */
struct cpu_rmap *          rx_cpu_rmap;          /* 0x390   0x8 */
struct hlist_node          index_hlist;          /* 0x398  0x10 */

/* XXX 24 bytes hole, try to pack */

/* --- cacheline 15 boundary (960 bytes) --- */
struct netdev_queue *      _tx __attribute__((__aligned__(64))); /*
0x3c0   0x8 */


Thanks.

  reply	other threads:[~2023-01-31 17:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-28 15:58 [PATCHv4 net-next 00/10] net: support ipv4 big tcp Xin Long
2023-01-28 15:58 ` [PATCHv4 net-next 01/10] net: add a couple of helpers for iph tot_len Xin Long
2023-02-01 15:31   ` David Ahern
2023-01-28 15:58 ` [PATCHv4 net-next 02/10] bridge: use skb_ip_totlen in br netfilter Xin Long
2023-01-31 15:01   ` Nikolay Aleksandrov
2023-01-28 15:58 ` [PATCHv4 net-next 03/10] openvswitch: use skb_ip_totlen in conntrack Xin Long
2023-02-01 13:29   ` Aaron Conole
2023-01-28 15:58 ` [PATCHv4 net-next 04/10] net: sched: use skb_ip_totlen and iph_totlen Xin Long
2023-01-28 15:58 ` [PATCHv4 net-next 05/10] netfilter: " Xin Long
2023-01-28 15:58 ` [PATCHv4 net-next 06/10] cipso_ipv4: use iph_set_totlen in skbuff_setattr Xin Long
2023-01-28 15:58 ` [PATCHv4 net-next 07/10] ipvlan: use skb_ip_totlen in ipvlan_get_L3_hdr Xin Long
2023-01-28 15:58 ` [PATCHv4 net-next 08/10] packet: add TP_STATUS_GSO_TCP for tp_status Xin Long
2023-02-01 15:32   ` David Ahern
2023-01-28 15:58 ` [PATCHv4 net-next 09/10] net: add gso_ipv4_max_size and gro_ipv4_max_size per device Xin Long
2023-01-31 14:59   ` Paolo Abeni
2023-01-31 17:55     ` Xin Long [this message]
2023-02-01 15:36   ` David Ahern
2023-01-28 15:58 ` [PATCHv4 net-next 10/10] net: add support for ipv4 big tcp Xin Long
2023-02-01 15:38   ` David Ahern
2023-02-02  9:24   ` [PATCHv4 net-next 10/10] net: add support for ipv4 big tcp: manual merge Matthieu Baerts
2023-02-01  8:53 ` [PATCHv4 net-next 00/10] net: support ipv4 big tcp Eric Dumazet
2023-02-01 15:39 ` David Ahern
2023-02-02  5:10 ` patchwork-bot+netdevbpf

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=CADvbK_fXGCEwuHX5PCU1-+dTTG4ZMLGLXY8A_AqJpDoR2uV-cA@mail.gmail.com \
    --to=lucien.xin@gmail.com \
    --cc=aconole@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=gnault@redhat.com \
    --cc=i.maximets@ovn.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=maheshb@google.com \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=paul@paul-moore.com \
    --cc=pshelar@ovn.org \
    --cc=razor@blackwall.org \
    --cc=roopa@nvidia.com \
    --cc=xiyou.wangcong@gmail.com \
    --cc=yoshfuji@linux-ipv6.org \
    /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).