All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paritosh Potukuchi <paritoshpotukuchi@gmail.com>
To: kuniyu@google.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kuba@kernel.org, edumazet@google.com, andrew+netdev@lunn.ch,
	jv@jvosburgh.net, davem@davemloft.net, pabeni@redhat.com,
	paritosh.potukuchi@amd.com
Subject: Re: [PATCH v2 2/2] bonding: reuse neigh_setup from slave neigh_parms
Date: Fri,  3 Jul 2026 09:47:35 +0000	[thread overview]
Message-ID: <20260703094735.678916-1-paritosh.potukuchi@amd.com> (raw)
In-Reply-To: <20260703064109.1836070-1-kuniyu@google.com>

Hi Kuniyuki,

>This introduces O(n) list traversal while it can be done
>with fixed costs (3 dereferences + 1 call).

>Since neigh_table is global (arp_tbl or nd_tbl), the O(n)
>list traversal could take longer and rather de-optimise.

Yes, that is true. One reason why I chose to do that is
because ndo_neigh_setup is a function primarily meant 
to setup the neigh_parms structure, when neigh_parms does
not exist.
On the other hand, lookup_neigh_parms is meant
to search for a near-complete neigh_parms structure,
that is already associated with a netdev. 
Even if we want to use ndo_neigh_setup, since it takes
less time, I would suggest using it as a fallback to 
not finding an already existing parms, setup.

Moreover, time complexity might not be an issue in this
path since, this is rarely used aggresively. 


One issue with ndo_neigh_setup in bond-like devices is
that, to get the underlying netdevs neigh_setup function,
it expects us to pass a dummy neigh_parms structure that 
has been zeroed out. This seems to be fragile as suggested
in a TODO in bond_neigh_init(). 
Generally its main goal is to fill the parms.neigh_setup 
field.

Can we populate a few more fields in the zeroed-
out parms structure, before passing to the driver in 
ndo_neigh_setup? That seems to be a much safer approach.

Regards,
Paritosh


  reply	other threads:[~2026-07-03  9:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01  8:15 [PATCH v2 0/2] Add and use neigh_parms_lookup_dev() Paritosh Potukuchi
2026-07-01  8:15 ` [PATCH v2 1/2] net: neighbour: add neigh_parms_lookup_dev() helper Paritosh Potukuchi
2026-07-01  8:16 ` [PATCH v2 2/2] bonding: reuse neigh_setup from slave neigh_parms Paritosh Potukuchi
2026-07-03  6:38   ` Kuniyuki Iwashima
2026-07-03  9:47     ` Paritosh Potukuchi [this message]
2026-07-04  1:43       ` Kuniyuki Iwashima
2026-07-06 10:07         ` Paritosh Potukuchi

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=20260703094735.678916-1-paritosh.potukuchi@amd.com \
    --to=paritoshpotukuchi@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jv@jvosburgh.net \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paritosh.potukuchi@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.