From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: fgao@ikuai8.com, davem@davemloft.net, kuznet@ms2.inr.ac.ru,
jmorris@namei.org, kaber@trash.net, netdev@vger.kernel.org,
gfree.wind@gmail.com
Subject: Re: [PATCH net-next 2/2] net: Eliminate duplicated codes by creating one new function in_dev_select_addr
Date: Tue, 7 Mar 2017 18:46:22 +0300 [thread overview]
Message-ID: <b2c1e98f-427f-8796-ddbe-bd4eebf6b94e@cogentembedded.com> (raw)
In-Reply-To: <1488898279-18930-1-git-send-email-fgao@ikuai8.com>
Hello!
On 03/07/2017 05:51 PM, fgao@ikuai8.com wrote:
> From: Gao Feng <fgao@ikuai8.com>
>
> There are two duplicated loop codes which used to select right
Just "loops".
> address in current codes. Now eliminate these codes by creating
> one new function in_dev_select_addr.
>
> Signed-off-by: Gao Feng <fgao@ikuai8.com>
> ---
> net/ipv4/devinet.c | 34 +++++++++++++++++++---------------
> 1 file changed, 19 insertions(+), 15 deletions(-)
>
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index 1a9e550..d0964c5 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -1191,6 +1191,19 @@ static int inet_gifconf(struct net_device *dev, char __user *buf, int len)
> return done;
> }
>
> +static __be32 in_dev_select_addr(const struct in_device *in_dev,
> + int scope)
> +{
> + for_primary_ifa(in_dev) {
> + if (ifa->ifa_scope != RT_SCOPE_LINK &&
> + ifa->ifa_scope <= scope) {
> + return ifa->ifa_local;
> + }
Could drop the useless {} here, while at it.
> + } endfor_ifa(in_dev);
> +
> + return 0;
> +}
> +
> __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope)
> {
> __be32 addr = 0;
[...]
MBR, Sergei
next prev parent reply other threads:[~2017-03-07 15:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-07 14:51 [PATCH net-next 2/2] net: Eliminate duplicated codes by creating one new function in_dev_select_addr fgao
2017-03-07 15:46 ` Sergei Shtylyov [this message]
2017-03-10 1:36 ` Feng Gao
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=b2c1e98f-427f-8796-ddbe-bd4eebf6b94e@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=davem@davemloft.net \
--cc=fgao@ikuai8.com \
--cc=gfree.wind@gmail.com \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--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).