All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arkadi Sharshevsky <arkadis@mellanox.com>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>,
	netdev@vger.kernel.org
Cc: davem@davemloft.net, jiri@resnulli.us, ivecera@redhat.com,
	f.fainelli@gmail.com, andrew@lunn.ch, Woojung.Huh@microchip.com,
	stephen@networkplumber.org, mlxsw@mellanox.com
Subject: Re: [PATCH net-next 09/11] net: dsa: Move FDB dump implementation inside DSA
Date: Wed, 19 Jul 2017 15:00:39 +0300	[thread overview]
Message-ID: <6da16295-facd-cc14-12a4-e91d62202695@mellanox.com> (raw)
In-Reply-To: <877ez5boxj.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>



On 07/18/2017 09:06 PM, Vivien Didelot wrote:
> Hi Arkadi,
> 
> Arkadi Sharshevsky <arkadis@mellanox.com> writes:
> 
>> +typedef int dsa_fdb_dump_cb_t(const unsigned char *addr, u16 vid,
>> +			      u16 ndm_state, void *data);
> 
> Can I ask you to change u16 ndm_state for bool is_static at the same
> time? Ethernet switches do not need to report more than that.
>

Will fix, thanks.

>> +static int
>> +dsa_slave_port_fdb_do_dump(const unsigned char *addr, u16 vid,
>> +			   u16 ndm_state, void *data)
>> +{
>> +	struct dsa_slave_dump_ctx *dump = data;
>> +	u32 portid = NETLINK_CB(dump->cb->skb).portid;
>> +	u32 seq = dump->cb->nlh->nlmsg_seq;
>> +	struct nlmsghdr *nlh;
>> +	struct ndmsg *ndm;
>> +
>> +	if (dump->idx < dump->cb->args[2])
>> +		goto skip;
>> +
>> +	nlh = nlmsg_put(dump->skb, portid, seq, RTM_NEWNEIGH,
>> +			sizeof(*ndm), NLM_F_MULTI);
>> +	if (!nlh)
>> +		return -EMSGSIZE;
>> +
>> +	ndm = nlmsg_data(nlh);
>> +	ndm->ndm_family  = AF_BRIDGE;
>> +	ndm->ndm_pad1    = 0;
>> +	ndm->ndm_pad2    = 0;
>> +	ndm->ndm_flags   = NTF_SELF;
>> +	ndm->ndm_type    = 0;
>> +	ndm->ndm_ifindex = dump->dev->ifindex;
>> +	ndm->ndm_state   = ndm_state;
> 
> So we can simply scope this here:
> 
>         ndm->ndm_state = is_static ? NUD_NOARP : NUD_REACHABLE;
> 
>> +
>> +	if (nla_put(dump->skb, NDA_LLADDR, ETH_ALEN, addr))
>> +		goto nla_put_failure;
>> +
>> +	if (vid && nla_put_u16(dump->skb, NDA_VLAN, vid))
>> +		goto nla_put_failure;
>> +
>> +	nlmsg_end(dump->skb, nlh);
>> +
>> +skip:
>> +	dump->idx++;
>> +	return 0;
>> +
>> +nla_put_failure:
>> +	nlmsg_cancel(dump->skb, nlh);
>> +	return -EMSGSIZE;
>> +}
> 
> Other than that, LGTM.
> 
> 
> Thanks,
> 
>         Vivien
> 

  reply	other threads:[~2017-07-19 12:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18 14:20 [PATCH net-next 00/11] Change DSA's FDB API and perform switchdev cleanup Arkadi Sharshevsky
2017-07-18 14:20 ` [PATCH net-next 01/11] net: dsa: Change DSA slave FDB API to be switchdev independent Arkadi Sharshevsky
2017-07-18 14:20 ` [PATCH net-next 02/11] net: dsa: Remove prepare phase for FDB Arkadi Sharshevsky
2017-07-18 14:20 ` [PATCH net-next 03/11] net: dsa: Remove switchdev dependency from DSA switch notifier chain Arkadi Sharshevsky
2017-07-18 14:20 ` [PATCH net-next 04/11] net: dsa: Add support for learning FDB through notification Arkadi Sharshevsky
2017-07-18 17:16   ` Vivien Didelot
2017-07-19 10:27     ` Arkadi Sharshevsky
2017-07-18 14:20 ` [PATCH net-next 05/11] net: dsa: Remove support for FDB add/del via SELF Arkadi Sharshevsky
2017-07-18 17:19   ` Vivien Didelot
2017-07-18 14:20 ` [PATCH net-next 06/11] net: dsa: Add support for querying supported bridge flags Arkadi Sharshevsky
2017-07-18 17:22   ` Vivien Didelot
2017-07-18 14:20 ` [PATCH net-next 07/11] net: dsa: Remove support for bypass bridge port attributes/vlan set Arkadi Sharshevsky
2017-07-18 17:40   ` Vivien Didelot
2017-07-19 11:53     ` Arkadi Sharshevsky
2017-07-18 14:20 ` [PATCH net-next 08/11] net: dsa: Remove redundant MDB dump support Arkadi Sharshevsky
2017-07-18 17:42   ` Vivien Didelot
2017-07-18 14:20 ` [PATCH net-next 09/11] net: dsa: Move FDB dump implementation inside DSA Arkadi Sharshevsky
2017-07-18 18:06   ` Vivien Didelot
2017-07-19 12:00     ` Arkadi Sharshevsky [this message]
2017-07-18 14:20 ` [PATCH net-next 10/11] net: bridge: Remove FDB deletion through switchdev object Arkadi Sharshevsky
2017-07-18 18:07   ` Vivien Didelot
2017-07-18 14:20 ` [PATCH net-next 11/11] net: switchdev: Remove bridge bypass support from switchdev Arkadi Sharshevsky
2017-07-18 18:11   ` Vivien Didelot

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=6da16295-facd-cc14-12a4-e91d62202695@mellanox.com \
    --to=arkadis@mellanox.com \
    --cc=Woojung.Huh@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=ivecera@redhat.com \
    --cc=jiri@resnulli.us \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=vivien.didelot@savoirfairelinux.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.