From: Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Jiri Pirko <jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: ryazanov.s.a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
jasowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
Neil.Jerram-QnUH15yq9NYqDJ6do+/SaQ@public.gmane.org,
edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
andy-QlMahl40kYEqcZcGjlUOXw@public.gmane.org,
dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org,
nbd-p3rKhJxN3npAfugRpC6u6w@public.gmane.org,
ronye-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
ben-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org,
buytenh-OLH4Qvv75CYX/NnBR394Jw@public.gmane.org,
roopa-qUQiAmfTcIp+XZJcv9eMoEEOCMrvLtNR@public.gmane.org,
jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org,
aviadr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public.gmane.org,
vyasevic-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org,
stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org,
dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org,
davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Subject: Re: [patch net-next 07/13] dsa: implement ndo_swdev_get_id
Date: Wed, 03 Sep 2014 16:20:58 -0700 [thread overview]
Message-ID: <5407A25A.8050401@gmail.com> (raw)
In-Reply-To: <1409736300-12303-8-git-send-email-jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
On 09/03/2014 02:24 AM, Jiri Pirko wrote:
> Signed-off-by: Jiri Pirko <jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
> ---
> include/linux/netdevice.h | 3 ++-
> include/net/dsa.h | 1 +
> net/dsa/Kconfig | 2 +-
> net/dsa/dsa.c | 3 +++
> net/dsa/slave.c | 10 ++++++++++
> 5 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 6a009d1..7ee070f 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -41,7 +41,6 @@
>
> #include <linux/ethtool.h>
> #include <net/net_namespace.h>
> -#include <net/dsa.h>
> #ifdef CONFIG_DCB
> #include <net/dcbnl.h>
> #endif
> @@ -1259,6 +1258,8 @@ enum netdev_priv_flags {
> #define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE
> #define IFF_MACVLAN IFF_MACVLAN
>
> +#include <net/dsa.h>
> +
> /**
> * struct net_device - The DEVICE structure.
> * Actually, this whole structure is a big mistake. It mixes I/O
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index 9771292..d60cd42 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -140,6 +140,7 @@ struct dsa_switch {
> u32 phys_mii_mask;
> struct mii_bus *slave_mii_bus;
> struct net_device *ports[DSA_MAX_PORTS];
> + struct netdev_phys_item_id psid;
> };
>
> static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p)
> diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
> index a585fd6..4e144a2 100644
> --- a/net/dsa/Kconfig
> +++ b/net/dsa/Kconfig
> @@ -1,6 +1,6 @@
> config HAVE_NET_DSA
> def_bool y
> - depends on NETDEVICES && !S390
> + depends on NETDEVICES && NET_SWITCHDEV && !S390
It does not look like this is necessary, we are only using definitions
from net/dsa.h and include/linux/netdevice.h, and if it was, a 'select'
would be more appropriate here I think.
TBH, I think we should rather drop this patch for now, I do not see any
benefit in providing a random id over no-id at all.
>
> # Drivers must select NET_DSA and the appropriate tagging format
>
> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> index 61f145c..374912d 100644
> --- a/net/dsa/dsa.c
> +++ b/net/dsa/dsa.c
> @@ -202,6 +202,9 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
> ds->ports[i] = slave_dev;
> }
>
> + ds->psid.id_len = MAX_PHYS_ITEM_ID_LEN;
> + get_random_bytes(ds->psid.id, ds->psid.id_len);
> +
> return ds;
>
> out_free:
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index 7333a4a..d79a6c7 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -192,6 +192,15 @@ static netdev_tx_t dsa_slave_notag_xmit(struct sk_buff *skb,
> return NETDEV_TX_OK;
> }
>
> +static int dsa_slave_swdev_get_id(struct net_device *dev,
> + struct netdev_phys_item_id *psid)
> +{
> + struct dsa_slave_priv *p = netdev_priv(dev);
> + struct dsa_switch *ds = p->parent;
> +
> + memcpy(psid, &ds->psid, sizeof(*psid));
> + return 0;
> +}
>
> /* ethtool operations *******************************************************/
> static int
> @@ -323,6 +332,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
> .ndo_set_rx_mode = dsa_slave_set_rx_mode,
> .ndo_set_mac_address = dsa_slave_set_mac_address,
> .ndo_do_ioctl = dsa_slave_ioctl,
> + .ndo_swdev_get_id = dsa_slave_swdev_get_id,
> };
>
> static const struct dsa_device_ops notag_netdev_ops = {
>
next prev parent reply other threads:[~2014-09-03 23:20 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-03 9:24 [patch net-next 00/13] introduce rocker switch driver with openvswitch hardware accelerated datapath Jiri Pirko
2014-09-03 9:24 ` [patch net-next 01/13] openvswitch: split flow structures into ovs specific and generic ones Jiri Pirko
[not found] ` <1409736300-12303-2-git-send-email-jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
2014-09-03 15:20 ` John Fastabend
2014-09-03 21:11 ` Jamal Hadi Salim
[not found] ` <540731B9.4010603-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-03 18:42 ` Pravin Shelar
[not found] ` <CALnjE+rk26Om1O5_Q=8tn7eAyh4Ywen-1+UD_nCVj_geZY1HuQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-04 12:25 ` Jiri Pirko
2014-09-04 12:09 ` Jiri Pirko
2014-09-03 18:41 ` Pravin Shelar
2014-09-03 21:22 ` Jamal Hadi Salim
[not found] ` <54078694.5040104-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
2014-09-03 21:59 ` Pravin Shelar
[not found] ` <CALnjE+qUqSK7kHSi5BZuA0hzFjMcZ8TCTd9JRG1PPmMfDmAQOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-04 1:54 ` Jamal Hadi Salim
[not found] ` <CALnjE+pscRmfhaWgkWCunJfjvG04RiNUAj6nefSFHrknQTC+xw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-04 12:33 ` Jiri Pirko
[not found] ` <20140904123323.GF1867-6KJVSR23iU5sFDB2n11ItA@public.gmane.org>
2014-09-04 20:46 ` Pravin Shelar
2014-09-17 8:34 ` Jiri Pirko
2014-09-17 22:07 ` Jesse Gross
2014-09-03 9:24 ` [patch net-next 02/13] net: rename netdev_phys_port_id to more generic name Jiri Pirko
[not found] ` <1409736300-12303-1-git-send-email-jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
2014-09-03 9:24 ` [patch net-next 03/13] net: introduce generic switch devices support Jiri Pirko
[not found] ` <1409736300-12303-4-git-send-email-jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
2014-09-03 15:46 ` John Fastabend
[not found] ` <540737CF.4000402-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-04 12:46 ` Jiri Pirko
2014-09-03 9:24 ` [patch net-next 04/13] rtnl: expose physical switch id for particular device Jiri Pirko
2014-09-03 9:24 ` [patch net-next 05/13] net-sysfs: " Jiri Pirko
2014-09-03 9:24 ` [patch net-next 06/13] net: introduce dummy switch Jiri Pirko
2014-09-03 9:24 ` [patch net-next 07/13] dsa: implement ndo_swdev_get_id Jiri Pirko
[not found] ` <1409736300-12303-8-git-send-email-jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
2014-09-03 23:20 ` Florian Fainelli [this message]
[not found] ` <5407A25A.8050401-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-04 12:47 ` Jiri Pirko
[not found] ` <20140904124701.GH1867-6KJVSR23iU5sFDB2n11ItA@public.gmane.org>
2014-09-05 4:43 ` Felix Fietkau
2014-09-05 5:52 ` Jiri Pirko
2014-09-03 9:24 ` [patch net-next 10/13] openvswitch: add support for datapath hardware offload Jiri Pirko
[not found] ` <1409736300-12303-11-git-send-email-jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
2014-09-03 16:37 ` John Fastabend
[not found] ` <540743B4.9080500-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-04 12:48 ` Jiri Pirko
[not found] ` <20140904124837.GI1867-6KJVSR23iU5sFDB2n11ItA@public.gmane.org>
2014-09-05 3:59 ` Simon Horman
2014-09-03 9:24 ` [patch net-next 11/13] sw_flow: add misc section to key with in_port_ifindex field Jiri Pirko
2014-09-03 9:24 ` [patch net-next 12/13] rocker: introduce rocker switch driver Jiri Pirko
2014-09-03 9:24 ` [patch net-next 08/13] net: introduce netdev_phys_item_ids_match helper Jiri Pirko
2014-09-03 9:24 ` [patch net-next 09/13] openvswitch: introduce vport_op get_netdev Jiri Pirko
2014-09-03 9:25 ` [patch net-next 13/13] switchdev: introduce Netlink API Jiri Pirko
2014-09-08 13:54 ` [patch net-next 00/13] introduce rocker switch driver with openvswitch hardware accelerated datapath Thomas Graf
2014-09-09 21:09 ` Alexei Starovoitov
2014-09-15 12:43 ` Thomas Graf
2014-09-16 15:58 ` Jiri Pirko
[not found] ` <20140916155832.GA1869-6KJVSR23iU488b5SBfVpbw@public.gmane.org>
2015-06-29 5:44 ` Neelakantam Gaddam
[not found] ` <CAOv37=BNU1-+kgTR6RUqxw7snJL6=5g-rLYhuPc1F-V0B1k7tA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-29 5:46 ` Jiri Pirko
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=5407A25A.8050401@gmail.com \
--to=f.fainelli-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=Neil.Jerram-QnUH15yq9NYqDJ6do+/SaQ@public.gmane.org \
--cc=andy-QlMahl40kYEqcZcGjlUOXw@public.gmane.org \
--cc=aviadr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=ben-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org \
--cc=buytenh-OLH4Qvv75CYX/NnBR394Jw@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org \
--cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
--cc=edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=jasowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org \
--cc=jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org \
--cc=john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=nbd-p3rKhJxN3npAfugRpC6u6w@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org \
--cc=nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public.gmane.org \
--cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=ronye-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=roopa-qUQiAmfTcIp+XZJcv9eMoEEOCMrvLtNR@public.gmane.org \
--cc=ryazanov.s.a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org \
--cc=vyasevic-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.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).