netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Martin Lau <kafai@fb.com>, David Ahern <dsahern@kernel.org>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"idosch@mellanox.com" <idosch@mellanox.com>
Subject: Re: [PATCH v2 net-next 2/5] ipv4: Add fib_nh_common to fib_result
Date: Mon, 1 Apr 2019 12:47:17 -0600	[thread overview]
Message-ID: <1c7ae34e-db63-a834-6623-1170ec8899a7@gmail.com> (raw)
In-Reply-To: <20190401182033.khnhgfphfn3rptb4@kafai-mbp.dhcp.thefacebook.com>

On 4/1/19 12:20 PM, Martin Lau wrote:
>> diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
>> index 12a6d759cf57..5070bc531ca4 100644
>> --- a/include/net/ip_fib.h
>> +++ b/include/net/ip_fib.h
>> @@ -156,15 +156,16 @@ struct fib_rule;
>>  
>>  struct fib_table;
>>  struct fib_result {
>> -	__be32		prefix;
>> -	unsigned char	prefixlen;
>> -	unsigned char	nh_sel;
>> -	unsigned char	type;
>> -	unsigned char	scope;
>> -	u32		tclassid;
>> -	struct fib_info *fi;
>> -	struct fib_table *table;
>> -	struct hlist_head *fa_head;
>> +	__be32			prefix;
>> +	unsigned char		prefixlen;
>> +	unsigned char		nh_sel;
> Is nh_sel still needed?

yes, for fib_result_nl API and nl_fib_lookup.


>> diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
>> index df777af7e278..f81c7dc7ff59 100644
>> --- a/net/ipv4/fib_semantics.c
>> +++ b/net/ipv4/fib_semantics.c
>> @@ -1075,6 +1075,24 @@ __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh)
>>  	return nh->nh_saddr;
>>  }
>>  
>> +__be32 fib_result_prefsrc(struct net *net, struct fib_result *res)
>> +{
>> +	struct fib_nh_common *nhc = res->nhc;
>> +	struct fib_nh *nh;
>> +
>> +	if (res->fi->fib_prefsrc)
>> +		return res->fi->fib_prefsrc;
>> +
>> +	if (unlikely(nhc->nhc_family != AF_INET))
> Comparing with FIB_RES_PREFSRC, it is not immediately obvious
> why this test is needed.  May be a comment or a commit log message?

This branch is for the case of v6 with v4. I can remove from this patch
and add later. Right now, nhc will only be from a fib_nh.

> 
>> +		return inet_select_addr(nhc->nhc_dev, 0, res->fi->fib_scope);
>> +
>> +	nh = container_of(nhc, struct fib_nh, nh_common);
>> +	if (nh->nh_saddr_genid == atomic_read(&net->ipv4.dev_addr_genid))
>> +		return nh->nh_saddr;
>> +
>> +	return fib_info_update_nh_saddr(net, nh);
>> +}
>> +
>>  static bool fib_valid_prefsrc(struct fib_config *cfg, __be32 fib_prefsrc)
>>  {
>>  	if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst ||
>> @@ -1762,20 +1780,22 @@ void fib_select_multipath(struct fib_result *res, int hash)
>>  	struct net *net = fi->fib_net;
>>  	bool first = false;
>>  
>> -	for_nexthops(fi) {
>> +	change_nexthops(fi) {
> Is it mainly because of the 'const'?

yes.

  reply	other threads:[~2019-04-01 18:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01 16:25 [PATCH v2 net-next 0/5] net: More movement to fib_nh_common David Ahern
2019-04-01 16:25 ` [PATCH v2 net-next 1/5] ipv4: Update fib_table_lookup tracepoint to take common nexthop David Ahern
2019-04-01 16:26 ` [PATCH v2 net-next 2/5] ipv4: Add fib_nh_common to fib_result David Ahern
2019-04-01 18:20   ` Martin Lau
2019-04-01 18:47     ` David Ahern [this message]
2019-04-01 16:26 ` [PATCH v2 net-next 3/5] ipv4: Refactor nexthop attributes in fib_dump_info David Ahern
2019-04-01 16:26 ` [PATCH v2 net-next 4/5] ipv4: Change fib_nexthop_info and fib_add_nexthop to take fib_nh_common David Ahern
2019-04-01 16:26 ` [PATCH v2 net-next 5/5] ipv6: Flip to fib_nexthop_info David Ahern
2019-04-01 20:15   ` Martin Lau
2019-04-01 20:20     ` David Ahern

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=1c7ae34e-db63-a834-6623-1170ec8899a7@gmail.com \
    --to=dsahern@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=idosch@mellanox.com \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.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).