* Re: [PATCH nf-next] netns: add and use net_ns_barrier
From: Florian Westphal @ 2017-06-13 18:07 UTC (permalink / raw)
To: Cong Wang
Cc: Florian Westphal, Eric W. Biederman, netfilter-devel,
Linux Kernel Network Developers
In-Reply-To: <CAM_iQpUtZZBXQNB+tWJikQNmCHBot3tp7vAsc6+Xnh5H__6++g@mail.gmail.com>
Cong Wang <xiyou.wangcong@gmail.com> wrote:
> On Mon, Jun 12, 2017 at 11:16 PM, Florian Westphal <fw@strlen.de> wrote:
> > Cong Wang <xiyou.wangcong@gmail.com> wrote:
> >> On Thu, Jun 1, 2017 at 1:52 AM, Florian Westphal <fw@strlen.de> wrote:
> >> > Joe described it nicely, problem is that after unload we may have
> >> > conntracks that still have a nf_conn_help extension attached that
> >> > has a pointer to a structure that resided in the (unloaded) module.
> >>
> >> Why not hold a refcnt for its module?
> >
> > That would work as well.
> >
> > I'm not sure its nice to disallow rmmod of helper modules if they are
> > used by a connection however.
>
> I am _not_ suggesting to disallow rmmod.
My point was that if you hold reference counts to the module users
will need to manually flush conntrack table (or at least manually
remove affected connections), else rmmod won't work as refcount might be
gt 0.
> > Right now you can "rmmod nf_conntrack_foo" at any time and this should
> > work just fine without first having to flush affected conntracks
> > manually.
>
> My point is that since netns wq could invoke code of that module,
> why it doesn't hold a refcnt of that module?
*shrug*, I did not write this stuff.
Historically it wasn't needed because we just clear out the helper area
in the affected conntracks (i.e, future packets are not inspected by
the helper anymore).
When conntracks were made per-netns this problem was added as we're not
guaranteed to see all net namespace because module_exit and netns cleanup
can run concurrently.
We can still use the "old" model if we guarantee that we wait for
netns cleanup to finish (which is what this patch does).
The alternative, as you pointed out, is to take a module reference for
each conntrack that uses the helper (and put again when connection is
destroyed).
I don't really care that much except that if we go for the latter
solution users cannot "just rmmod" the module anymore but might have
to manually remove the affected connections first.
Pablo, I can rework things to do module get/put but I ask for explicit
instructions to do so (I prefer the "barrier" approach).
^ permalink raw reply
* Re: [PATCH RFC net-next 3/4] net/mlx5: Separate between eswitch and MPFS l2 table logic
From: Jes Sorensen @ 2017-06-13 18:18 UTC (permalink / raw)
To: Saeed Mahameed
Cc: Saeed Mahameed, Linux Netdev List, Kernel Team, Or Gerlitz,
Tzahi Oved
In-Reply-To: <CALzJLG-QeLp95diOuH+CFjX3rzChS4cne0ZKmHZg+1ZHFgCh1w@mail.gmail.com>
On 06/13/2017 01:49 PM, Saeed Mahameed wrote:
> On Mon, Jun 12, 2017 at 8:52 PM, Jes Sorensen <jsorensen@fb.com> wrote:
>> On 06/07/2017 07:42 PM, Saeed Mahameed wrote:
>>>
>>> Multi-Physical Function Switch (MPFs) is required for when multi-PF
>>> configuration is enabled to allow passing user configured unicast MAC
>>> addresses to the requesting PF.
>>>
>>> Before this patch eswitch.c used to manage the HW MPFS l2 table,
>>> eswitch always enabled vport(0) (NIC PF) vport's contexts update on
>>> unicast
>>> mac address list changes, to populate the PF's MPFS L2 table accordingly,
>>> even if SRIOV was not enabled.
>>>
>>> In downstream patch we would like to allow compiling the driver without
>>> eswitch functionalities, for that we move MPFS l2 table logic out
>>> of eswitch.c into its own file, and provide Kconfig flag (MLX5_MPFS) to
>>> allow compiling out MPFS for those who don't want Multi-PF support
>>>
>>> NIC PF netdevice will now directly update MPFS l2 table via the new MPFS
>>> API. VF netdevice has no access to MPFS L2 table, so e-Switch will remain
>>> responsible of updating its PF MPFS l2 table on behalf of its VFs.
>>>
>>> Due to this change we also don't require enabling vport(0) (PF vport)
>>> unicast mac changes events anymore, for when SRIOV is not enabled.
>>> Which means eswitch is now activated only on SRIOV activation, and not
>>> required otherwise.
>>
>>
>>
>> On overall it looks good - one nit.
>>
>>> +static int alloc_l2table_index(struct mlx5_mpfs *l2table, u32 *ix)
>>> +{
>>> + int err = 0;
>>> +
>>> + *ix = find_first_zero_bit(l2table->bitmap, l2table->size);
>>> + if (*ix >= l2table->size)
>>> + err = -ENOSPC;
>>> + else
>>> + __set_bit(*ix, l2table->bitmap);
>>> +
>>> + return err;
>>> +}
>>
>>
>> You pass in a pointer for ix but you don't modify it, why not just pass in
>> the value?.
>>
>
> we do modify ix:
> *ix = find_first_zero_bit(l2table->bitmap, l2table->size);
>
> The idea is to find the next free index and return it to the caller
I clearly need new glasses :(
Jes
^ permalink raw reply
* Re: [PATCH RFC net-next 4/4] net/mlx5: Add CONFIG_MLX5_ESWITCH Kconfig
From: Jes Sorensen @ 2017-06-13 18:21 UTC (permalink / raw)
To: Saeed Mahameed
Cc: Saeed Mahameed, Linux Netdev List, Kernel Team, Or Gerlitz,
Tzahi Oved
In-Reply-To: <CALzJLG966pq1q7oyPsuRNcGh9ikK5iocL57pypPOejDPEFOyPQ@mail.gmail.com>
On 06/13/2017 01:58 PM, Saeed Mahameed wrote:
> On Mon, Jun 12, 2017 at 9:20 PM, Jes Sorensen <jsorensen@fb.com> wrote:
>> On 06/07/2017 07:42 PM, Saeed Mahameed wrote:
>>>
>>> This patch gives the option to chose whether to compile the driver with or
>>> without eswitch/eswitch_offloads(switchdev mode)/en_rep(VF representors)
>>> and en_tc offloads.
>>>
>>> It also removes most of the above modules headers declarations and stubs
>>> out the API functions which are used outside these modules.
>>>
>>> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
>>> ---
>>> drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 7 +++++
>>> drivers/net/ethernet/mellanox/mlx5/core/Makefile | 6 +++--
>>> drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 33
>>> +++++++++++++++--------
>>> drivers/net/ethernet/mellanox/mlx5/core/en_rep.h | 8 ++++++
>>> drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 2 ++
>>> drivers/net/ethernet/mellanox/mlx5/core/en_tc.h | 7 +++++
>>> drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 23 +++++++++++-----
>>> drivers/net/ethernet/mellanox/mlx5/core/main.c | 10 +------
>>> 8 files changed, 68 insertions(+), 28 deletions(-)
>>
>>
>> Overall good, a few nits
>>
>>
>>> @@ -3316,6 +3317,7 @@ static int mlx5e_ioctl(struct net_device *dev,
>>> struct ifreq *ifr, int cmd)
>>> }
>>> }
>>> +#ifdef CONFIG_MLX5_ESWITCH
>>> static int mlx5e_set_vf_mac(struct net_device *dev, int vf, u8 *mac)
>>> {
>>> struct mlx5e_priv *priv = netdev_priv(dev);
>>> @@ -3418,6 +3420,7 @@ static int mlx5e_get_vf_stats(struct net_device
>>> *dev,
>>> return mlx5_eswitch_get_vport_stats(mdev->priv.eswitch, vf + 1,
>>> vf_stats);
>>> }
>>> +#endif
>>> static void mlx5e_add_vxlan_port(struct net_device *netdev,
>>> struct udp_tunnel_info *ti)
>>> @@ -3659,6 +3662,7 @@ static const struct net_device_ops
>>> mlx5e_netdev_ops_basic = {
>>> #endif
>>> };
>>> +#ifdef CONFIG_MLX5_ESWITCH
>>> static const struct net_device_ops mlx5e_netdev_ops_sriov = {
>>> .ndo_open = mlx5e_open,
>>> .ndo_stop = mlx5e_close,
>>> @@ -3697,6 +3701,7 @@ static const struct net_device_ops
>>> mlx5e_netdev_ops_sriov = {
>>> .ndo_has_offload_stats = mlx5e_has_offload_stats,
>>> .ndo_get_offload_stats = mlx5e_get_offload_stats,
>>> };
>>> +#endif
>>> static int mlx5e_check_required_hca_cap(struct mlx5_core_dev *mdev)
>>> {
>>> @@ -3923,9 +3928,11 @@ static void mlx5e_set_netdev_dev_addr(struct
>>> net_device *netdev)
>>> }
>>> }
>>> +#if IS_ENABLED(CONFIG_NET_SWITCHDEV) && IS_ENABLED(CONFIG_MLX5_ESWITCH)
>>> static const struct switchdev_ops mlx5e_switchdev_ops = {
>>> .switchdev_port_attr_get = mlx5e_attr_get,
>>> };
>>> +#endif
>>> static void mlx5e_build_nic_netdev(struct net_device *netdev)
>>> {
>>
>>
>> Why not move these functions and the struct into one of the files that is
>> being compiled out. The less #ifdefs we leave in the code the better.
>>
>
> eswitch is independent from netdev, and we want to keep netdev ndos
> local to netdev files.
Not the end of the World then.
>>> @@ -3936,15 +3943,17 @@ static void mlx5e_build_nic_netdev(struct
>>> net_device *netdev)
>>> SET_NETDEV_DEV(netdev, &mdev->pdev->dev);
>>> - if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
>>> - netdev->netdev_ops = &mlx5e_netdev_ops_sriov;
>>> #ifdef CONFIG_MLX5_CORE_EN_DCB
>>> - if (MLX5_CAP_GEN(mdev, qos))
>>> - netdev->dcbnl_ops = &mlx5e_dcbnl_ops;
>>> + if (MLX5_CAP_GEN(mdev, vport_group_manager) && MLX5_CAP_GEN(mdev,
>>> qos))
>>> + netdev->dcbnl_ops = &mlx5e_dcbnl_ops;
>>> +#endif
>>> +
>>> +#ifdef CONFIG_MLX5_ESWITCH
>>> + if (MLX5_CAP_GEN(mdev, vport_group_manager))
>>> + netdev->netdev_ops = &mlx5e_netdev_ops_sriov;
>>> + else
>>> #endif
>>> - } else {
>>> netdev->netdev_ops = &mlx5e_netdev_ops_basic;
>>> - }
>>> netdev->watchdog_timeo = 15 * HZ;
>>
>>
>> This kind of #ifdef is always bad, it's hard to read and easy to get wrong.
>> Why not have MLX5_CAP_GEN return 0 if MLX5_ESWITCH is not enabled and have a
>> dummy pointer?
>>
>
> i know ifdef is ugly, but we have to provide basic ndos (not dummy
> pointers) when eswitch is not avaialbe, also we want the code to be as
> much as free from empty functions that all they do is to return
> -EOPNOTSUPP;
>
> for my taste this way is cleaner and more readable, from these line
> you can understand when SRIOV/Eswitch is not supported. you don't need
> to backtrack the function pointers.
This is not a good way of doing it, with #ifdef's mangling an if()
statement. It really should be avoided. Any problem having
MLX5_CAP_GEN() return 0 when ESWITCH is not enabled?
>>> @@ -4016,7 +4025,7 @@ static void mlx5e_build_nic_netdev(struct net_device
>>> *netdev)
>>> mlx5e_set_netdev_dev_addr(netdev);
>>> -#ifdef CONFIG_NET_SWITCHDEV
>>> +#if IS_ENABLED(CONFIG_NET_SWITCHDEV) && IS_ENABLED(CONFIG_MLX5_ESWITCH)
>>> if (MLX5_CAP_GEN(mdev, vport_group_manager))
>>> netdev->switchdev_ops = &mlx5e_switchdev_ops;
>>> #endif
>>
>>
>> Can MLX5_ESWITCH be enabled without NET_SWITCHDEV?
>>
>
> Yes (Legacy SRIOV mode), but not the other way around.
>
>>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
>>> b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
>>> index 66b5fec15313..7d2860252dce 100644
>>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
>>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
>>> @@ -806,6 +806,7 @@ void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct
>>> mlx5_cqe64 *cqe)
>>> &wqe->next.next_wqe_index);
>>> }
>>> +#ifdef CONFIG_MLX5_ESWITCH
>>> void mlx5e_handle_rx_cqe_rep(struct mlx5e_rq *rq, struct mlx5_cqe64
>>> *cqe)
>>> {
>>> struct net_device *netdev = rq->netdev;
>>> @@ -838,6 +839,7 @@ void mlx5e_handle_rx_cqe_rep(struct mlx5e_rq *rq,
>>> struct mlx5_cqe64 *cqe)
>>> mlx5_wq_ll_pop(&rq->wq, wqe_counter_be,
>>> &wqe->next.next_wqe_index);
>>> }
>>> +#endif
>>> static inline void mlx5e_mpwqe_fill_rx_skb(struct mlx5e_rq *rq,
>>> struct mlx5_cqe64 *cqe,
>>
>>
>> Another case of moving it to one of the disabled files.
>>
>
> this means that we need to export some data path RX helper functions,
> also we would like to keep all RX path local to en_rx.c file for
> performance considerations, and this is the price we have to pay.
The linker takes care of this - if you want them inlined, you should
explicitly inline them. Otherwise there is no cost here.
Please move them over in this case.
Jes
^ permalink raw reply
* Re: [PATCH net-next 03/10] bpf: mlx5e: Report bpf_prog ID during XDP_QUERY_PROG
From: Martin KaFai Lau @ 2017-06-13 18:49 UTC (permalink / raw)
To: Saeed Mahameed
Cc: Linux Netdev List, Alexei Starovoitov, Daniel Borkmann,
Kernel Team, Tariq Toukan, Saeed Mahameed
In-Reply-To: <CALzJLG_mos9=Tw0A0xASi3U3PF+=5-+e+K4ZdsR6M_saZ5B+0w@mail.gmail.com>
On Tue, Jun 13, 2017 at 07:04:26PM +0300, Saeed Mahameed wrote:
> On Tue, Jun 13, 2017 at 4:00 AM, Martin KaFai Lau <kafai@fb.com> wrote:
> > Add support to mlx5e to report bpf_prog ID during XDP_QUERY_PROG.
> >
> > Signed-off-by: Martin KaFai Lau <kafai@fb.com>
> > Cc: Tariq Toukan <tariqt@mellanox.com>
> > Cc: Saeed Mahameed <saeedm@mellanox.com>
> > Acked-by: Alexei Starovoitov <ast@fb.com>
> > Acked-by: Daniel Borkmann <daniel@iogearbox.net>
>
> Acked-by: Saeed Mahameed <saeedm@mellanox.com>
Thanks for reviewing, Saeed.
I will respin v2 with READ_ONCE removed since
it is already under rtnl lock per Jakub Kicinski's
suggestion in nfp. The situation should be similar
in mlx5e.
^ permalink raw reply
* Re: [PATCH net-next 03/10] bpf: mlx5e: Report bpf_prog ID during XDP_QUERY_PROG
From: Daniel Borkmann @ 2017-06-13 19:04 UTC (permalink / raw)
To: Martin KaFai Lau, Saeed Mahameed
Cc: Linux Netdev List, Alexei Starovoitov, Kernel Team, Tariq Toukan,
Saeed Mahameed
In-Reply-To: <20170613184948.wx326pyjauju7iti@dhcp-172-26-110-210.dhcp.thefacebook.com>
On 06/13/2017 08:49 PM, Martin KaFai Lau wrote:
> On Tue, Jun 13, 2017 at 07:04:26PM +0300, Saeed Mahameed wrote:
>> On Tue, Jun 13, 2017 at 4:00 AM, Martin KaFai Lau <kafai@fb.com> wrote:
>>> Add support to mlx5e to report bpf_prog ID during XDP_QUERY_PROG.
>>>
>>> Signed-off-by: Martin KaFai Lau <kafai@fb.com>
>>> Cc: Tariq Toukan <tariqt@mellanox.com>
>>> Cc: Saeed Mahameed <saeedm@mellanox.com>
>>> Acked-by: Alexei Starovoitov <ast@fb.com>
>>> Acked-by: Daniel Borkmann <daniel@iogearbox.net>
>>
>> Acked-by: Saeed Mahameed <saeedm@mellanox.com>
> Thanks for reviewing, Saeed.
>
> I will respin v2 with READ_ONCE removed since
> it is already under rtnl lock per Jakub Kicinski's
> suggestion in nfp. The situation should be similar
> in mlx5e.
Sounds good, yeah, only needed in data path wrt program
updates.
^ permalink raw reply
* [PATCH net-next] cxgb4: handle serial flash interrupt
From: Ganesh Goudar @ 2017-06-13 19:15 UTC (permalink / raw)
To: netdev, davem
Cc: nirranjan, indranil, venkatesh, Ganesh Goudar, Rahul Lakkireddy
If SF bit is not cleared in PL_INT_CAUSE, subsequent non-data
interrupts are not raised. Enable SF bit in Global Interrupt
Mask and handle it as non-fatal and hence eventually clear it.
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
---
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 16af646..d5e316d 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -4462,7 +4462,7 @@ static void pl_intr_handler(struct adapter *adap)
#define PF_INTR_MASK (PFSW_F)
#define GLBL_INTR_MASK (CIM_F | MPS_F | PL_F | PCIE_F | MC_F | EDC0_F | \
EDC1_F | LE_F | TP_F | MA_F | PM_TX_F | PM_RX_F | ULP_RX_F | \
- CPL_SWITCH_F | SGE_F | ULP_TX_F)
+ CPL_SWITCH_F | SGE_F | ULP_TX_F | SF_F)
/**
* t4_slow_intr_handler - control path interrupt handler
--
2.1.0
^ permalink raw reply related
* [PATCH net-next v3 0/4] net: dsa: Multi-CPU ground work (v3)
From: Florian Fainelli @ 2017-06-13 19:17 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, john, Florian Fainelli
Hi all,
This patch series prepares the ground for adding mutliple CPU port support to
DSA, and starts by removing redundant pieces of information such as
master_netdev which is cpu_dp->ethernet. Finally drivers are moved away from
directly accessing ds->dst->cpu_dp and use appropriate helper functions.
Note that if you have Device Tree blobs/platform configurations that are
currently listing multiple CPU ports, the proposed behavior in
dsa_ds_get_cpu_dp() will be to return the last bit set in ds->cpu_port_mask.
Future plans include:
- making dst->cpu_dp a flexible data structure (array, list, you name it)
- having the ability for drivers to return a default/preferred CPU port (if
necessary)
Changes in v3:
- removed the last patch since it causes problems with bcm_sf2/b53 in a
dual-CPU case (root cause known, proper fix underway)
- removed dsa_ds_get_cpu_dp()
Changes in v2:
- added Reviewed-by tags
- assign port->cpu_dp earlier before ops->setup() has run
Florian Fainelli (5):
net: dsa: Remove master_netdev and use dst->cpu_dp->netdev
net: dsa: Relocate master ethtool operations
net: dsa: Associate slave network device with CPU port
net: dsa: Introduce dsa_dst_get_cpu_dp()
net: dsa: Stop accessing ds->dst->cpu_dp in drivers
drivers/net/dsa/b53/b53_common.c | 4 +--
drivers/net/dsa/bcm_sf2.c | 10 +++++---
drivers/net/dsa/mt7530.c | 6 +++--
drivers/net/dsa/mv88e6060.c | 2 +-
drivers/net/dsa/qca8k.c | 2 +-
include/net/dsa.h | 29 +++++++++-------------
net/dsa/dsa.c | 19 ++++----------
net/dsa/dsa2.c | 27 ++++++++++++--------
net/dsa/dsa_priv.h | 10 ++++++++
net/dsa/legacy.c | 23 ++++++++++-------
net/dsa/slave.c | 53 ++++++++++++++++++++--------------------
net/dsa/tag_brcm.c | 5 ++--
net/dsa/tag_ksz.c | 5 ++--
net/dsa/tag_qca.c | 3 ++-
net/dsa/tag_trailer.c | 5 ++--
15 files changed, 107 insertions(+), 96 deletions(-)
--
2.9.3
^ permalink raw reply
* [PATCH 1/4] net: dsa: Remove master_netdev and use dst->cpu_dp->netdev
From: Florian Fainelli @ 2017-06-13 19:17 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, john, Florian Fainelli
In-Reply-To: <20170613191725.26625-1-f.fainelli@gmail.com>
In preparation for supporting multiple CPU ports, remove
dst->master_netdev and ds->master_netdev and replace them with only one
instance of the common object we have for a port: struct
dsa_port::netdev. ds->master_netdev is currently write only and would be
helpful in the case where we have two switches, both with CPU ports, and
also connected within each other, which the multi-CPU port patch series
would address.
While at it, introduce a helper function used in net/dsa/slave.c to
immediately get a reference on the master network device called
dsa_master_netdev().
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/bcm_sf2.c | 4 ++--
drivers/net/dsa/mt7530.c | 4 ++--
include/net/dsa.h | 5 -----
net/dsa/dsa.c | 9 ++-------
net/dsa/dsa2.c | 18 +++++++-----------
net/dsa/dsa_priv.h | 5 +++++
net/dsa/legacy.c | 22 +++++++++++++---------
net/dsa/slave.c | 20 +++++++++-----------
8 files changed, 40 insertions(+), 47 deletions(-)
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 687a8bae5d73..76e98e8ed315 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -806,7 +806,7 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds)
static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port,
struct ethtool_wolinfo *wol)
{
- struct net_device *p = ds->dst[ds->index].master_netdev;
+ struct net_device *p = ds->dst[ds->index].cpu_dp->netdev;
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
struct ethtool_wolinfo pwol;
@@ -829,7 +829,7 @@ static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port,
static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port,
struct ethtool_wolinfo *wol)
{
- struct net_device *p = ds->dst[ds->index].master_netdev;
+ struct net_device *p = ds->dst[ds->index].cpu_dp->netdev;
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
s8 cpu_port = ds->dst->cpu_dp->index;
struct ethtool_wolinfo pwol;
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 25e00d5e0eec..1e46418a3b74 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -912,11 +912,11 @@ mt7530_setup(struct dsa_switch *ds)
struct device_node *dn;
struct mt7530_dummy_poll p;
- /* The parent node of master_netdev which holds the common system
+ /* The parent node of cpu_dp->netdev which holds the common system
* controller also is the container for two GMACs nodes representing
* as two netdev instances.
*/
- dn = ds->master_netdev->dev.of_node->parent;
+ dn = ds->dst->cpu_dp->netdev->dev.of_node->parent;
priv->ethernet = syscon_node_to_regmap(dn);
if (IS_ERR(priv->ethernet))
return PTR_ERR(priv->ethernet);
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 2effb0af9d7c..b2fb53f5e28e 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -227,11 +227,6 @@ struct dsa_switch {
s8 rtable[DSA_MAX_SWITCHES];
/*
- * The lower device this switch uses to talk to the host
- */
- struct net_device *master_netdev;
-
- /*
* Slave mii_bus and devices for the individual ports.
*/
u32 dsa_port_mask;
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 517215391514..6aacc2314a8f 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -118,10 +118,7 @@ int dsa_cpu_port_ethtool_setup(struct dsa_port *cpu_dp)
struct net_device *master;
struct ethtool_ops *cpu_ops;
- master = ds->dst->master_netdev;
- if (ds->master_netdev)
- master = ds->master_netdev;
-
+ master = ds->dst->cpu_dp->netdev;
cpu_ops = devm_kzalloc(ds->dev, sizeof(*cpu_ops), GFP_KERNEL);
if (!cpu_ops)
return -ENOMEM;
@@ -142,9 +139,7 @@ void dsa_cpu_port_ethtool_restore(struct dsa_port *cpu_dp)
struct dsa_switch *ds = cpu_dp->ds;
struct net_device *master;
- master = ds->dst->master_netdev;
- if (ds->master_netdev)
- master = ds->master_netdev;
+ master = ds->dst->cpu_dp->netdev;
master->ethtool_ops = ds->dst->master_orig_ethtool_ops;
}
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index f88e1dddb74a..ab48c4f989da 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -337,7 +337,7 @@ static int dsa_ds_apply(struct dsa_switch_tree *dst, struct dsa_switch *ds)
return err;
if (ds->ops->set_addr) {
- err = ds->ops->set_addr(ds, dst->master_netdev->dev_addr);
+ err = ds->ops->set_addr(ds, dst->cpu_dp->netdev->dev_addr);
if (err < 0)
return err;
}
@@ -444,7 +444,7 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst)
* sent to the tag format's receive function.
*/
wmb();
- dst->master_netdev->dsa_ptr = dst;
+ dst->cpu_dp->netdev->dsa_ptr = dst;
dst->applied = true;
return 0;
@@ -458,7 +458,7 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst)
if (!dst->applied)
return;
- dst->master_netdev->dsa_ptr = NULL;
+ dst->cpu_dp->netdev->dsa_ptr = NULL;
/* If we used a tagging format that doesn't have an ethertype
* field, make sure that all packets from this point get sent
@@ -504,14 +504,10 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index,
if (!ethernet_dev)
return -EPROBE_DEFER;
- if (!ds->master_netdev)
- ds->master_netdev = ethernet_dev;
-
- if (!dst->master_netdev)
- dst->master_netdev = ethernet_dev;
-
- if (!dst->cpu_dp)
+ if (!dst->cpu_dp) {
dst->cpu_dp = port;
+ dst->cpu_dp->netdev = ethernet_dev;
+ }
tag_protocol = ds->ops->get_tag_protocol(ds);
dst->tag_ops = dsa_resolve_tag_protocol(tag_protocol);
@@ -578,7 +574,7 @@ static int dsa_dst_parse(struct dsa_switch_tree *dst)
return err;
}
- if (!dst->master_netdev) {
+ if (!dst->cpu_dp->netdev) {
pr_warn("Tree has no master device\n");
return -EINVAL;
}
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 66ee248796c8..5c510f4ba0ce 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -183,4 +183,9 @@ extern const struct dsa_device_ops qca_netdev_ops;
/* tag_trailer.c */
extern const struct dsa_device_ops trailer_netdev_ops;
+static inline struct net_device *dsa_master_netdev(struct dsa_slave_priv *p)
+{
+ return p->dp->ds->dst->cpu_dp->netdev;
+}
+
#endif
diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c
index 3a56de8f51a8..5d4f6ffa3424 100644
--- a/net/dsa/legacy.c
+++ b/net/dsa/legacy.c
@@ -101,9 +101,12 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
struct dsa_switch_tree *dst = ds->dst;
struct dsa_chip_data *cd = ds->cd;
bool valid_name_found = false;
+ struct net_device *master;
int index = ds->index;
int i, ret;
+ master = dst->cpu_dp->netdev;
+
/*
* Validate supplied switch configuration.
*/
@@ -116,7 +119,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
if (!strcmp(name, "cpu")) {
if (dst->cpu_dp) {
- netdev_err(dst->master_netdev,
+ netdev_err(master,
"multiple cpu ports?!\n");
return -EINVAL;
}
@@ -168,7 +171,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
return ret;
if (ops->set_addr) {
- ret = ops->set_addr(ds, dst->master_netdev->dev_addr);
+ ret = ops->set_addr(ds, master->dev_addr);
if (ret < 0)
return ret;
}
@@ -195,14 +198,14 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
ret = dsa_slave_create(ds, parent, i, cd->port_names[i]);
if (ret < 0)
- netdev_err(dst->master_netdev, "[%d]: can't create dsa slave device for port %d(%s): %d\n",
+ netdev_err(master, "[%d]: can't create dsa slave device for port %d(%s): %d\n",
index, i, cd->port_names[i], ret);
}
/* Perform configuration of the CPU and DSA ports */
ret = dsa_cpu_dsa_setups(ds, parent);
if (ret < 0)
- netdev_err(dst->master_netdev, "[%d] : can't configure CPU and DSA ports\n",
+ netdev_err(master, "[%d] : can't configure CPU and DSA ports\n",
index);
ret = dsa_cpu_port_ethtool_setup(ds->dst->cpu_dp);
@@ -217,6 +220,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
struct device *parent, struct device *host_dev)
{
struct dsa_chip_data *cd = dst->pd->chip + index;
+ struct net_device *master = dst->cpu_dp->netdev;
const struct dsa_switch_ops *ops;
struct dsa_switch *ds;
int ret;
@@ -228,11 +232,11 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
*/
ops = dsa_switch_probe(parent, host_dev, cd->sw_addr, &name, &priv);
if (!ops) {
- netdev_err(dst->master_netdev, "[%d]: could not detect attached switch\n",
+ netdev_err(master, "[%d]: could not detect attached switch\n",
index);
return ERR_PTR(-EINVAL);
}
- netdev_info(dst->master_netdev, "[%d]: detected a %s switch\n",
+ netdev_info(master, "[%d]: detected a %s switch\n",
index, name);
@@ -575,7 +579,7 @@ static int dsa_setup_dst(struct dsa_switch_tree *dst, struct net_device *dev,
unsigned configured = 0;
dst->pd = pd;
- dst->master_netdev = dev;
+ dst->cpu_dp->netdev = dev;
for (i = 0; i < pd->nr_chips; i++) {
struct dsa_switch *ds;
@@ -671,7 +675,7 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)
{
int i;
- dst->master_netdev->dsa_ptr = NULL;
+ dst->cpu_dp->netdev->dsa_ptr = NULL;
/* If we used a tagging format that doesn't have an ethertype
* field, make sure that all packets from this point get sent
@@ -688,7 +692,7 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)
dsa_cpu_port_ethtool_restore(dst->cpu_dp);
- dev_put(dst->master_netdev);
+ dev_put(dst->cpu_dp->netdev);
}
static int dsa_remove(struct platform_device *pdev)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 5e45ae5c3f71..95031b31d64b 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -66,7 +66,7 @@ static int dsa_slave_get_iflink(const struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
- return p->dp->ds->dst->master_netdev->ifindex;
+ return dsa_master_netdev(p)->ifindex;
}
static int dsa_slave_open(struct net_device *dev)
@@ -74,7 +74,7 @@ static int dsa_slave_open(struct net_device *dev)
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_port *dp = p->dp;
struct dsa_switch *ds = dp->ds;
- struct net_device *master = ds->dst->master_netdev;
+ struct net_device *master = dsa_master_netdev(p);
u8 stp_state = dp->bridge_dev ? BR_STATE_BLOCKING : BR_STATE_FORWARDING;
int err;
@@ -127,7 +127,7 @@ static int dsa_slave_open(struct net_device *dev)
static int dsa_slave_close(struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
- struct net_device *master = p->dp->ds->dst->master_netdev;
+ struct net_device *master = dsa_master_netdev(p);
struct dsa_switch *ds = p->dp->ds;
if (p->phy)
@@ -154,7 +154,7 @@ static int dsa_slave_close(struct net_device *dev)
static void dsa_slave_change_rx_flags(struct net_device *dev, int change)
{
struct dsa_slave_priv *p = netdev_priv(dev);
- struct net_device *master = p->dp->ds->dst->master_netdev;
+ struct net_device *master = dsa_master_netdev(p);
if (change & IFF_ALLMULTI)
dev_set_allmulti(master, dev->flags & IFF_ALLMULTI ? 1 : -1);
@@ -165,7 +165,7 @@ static void dsa_slave_change_rx_flags(struct net_device *dev, int change)
static void dsa_slave_set_rx_mode(struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
- struct net_device *master = p->dp->ds->dst->master_netdev;
+ struct net_device *master = dsa_master_netdev(p);
dev_mc_sync(master, dev);
dev_uc_sync(master, dev);
@@ -174,7 +174,7 @@ static void dsa_slave_set_rx_mode(struct net_device *dev)
static int dsa_slave_set_mac_address(struct net_device *dev, void *a)
{
struct dsa_slave_priv *p = netdev_priv(dev);
- struct net_device *master = p->dp->ds->dst->master_netdev;
+ struct net_device *master = dsa_master_netdev(p);
struct sockaddr *addr = a;
int err;
@@ -375,7 +375,7 @@ static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
/* Queue the SKB for transmission on the parent interface, but
* do not modify its EtherType
*/
- nskb->dev = p->dp->ds->dst->master_netdev;
+ nskb->dev = dsa_master_netdev(p);
dev_queue_xmit(nskb);
return NETDEV_TX_OK;
@@ -685,7 +685,7 @@ static int dsa_slave_netpoll_setup(struct net_device *dev,
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_switch *ds = p->dp->ds;
- struct net_device *master = ds->dst->master_netdev;
+ struct net_device *master = dsa_master_netdev(p);
struct netpoll *netpoll;
int err = 0;
@@ -1143,9 +1143,7 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
struct dsa_slave_priv *p;
int ret;
- master = ds->dst->master_netdev;
- if (ds->master_netdev)
- master = ds->master_netdev;
+ master = ds->dst->cpu_dp->netdev;
slave_dev = alloc_netdev(sizeof(struct dsa_slave_priv), name,
NET_NAME_UNKNOWN, ether_setup);
--
2.9.3
^ permalink raw reply related
* [PATCH 2/4] net: dsa: Relocate master ethtool operations
From: Florian Fainelli @ 2017-06-13 19:17 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, john, Florian Fainelli
In-Reply-To: <20170613191725.26625-1-f.fainelli@gmail.com>
Relocate master_ethtool_ops and master_orig_ethtool_ops into struct
dsa_port in order to be both consistent, and make things self contained
within the dsa_port structure.
This is a preliminary change to supporting multiple CPU port interfaces.
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/net/dsa.h | 17 +++++------------
net/dsa/dsa.c | 16 ++++++----------
net/dsa/slave.c | 16 ++++++++--------
3 files changed, 19 insertions(+), 30 deletions(-)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index b2fb53f5e28e..7e93869819f9 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -122,12 +122,6 @@ struct dsa_switch_tree {
*/
struct dsa_platform_data *pd;
- /*
- * Reference to network device to use, and which tagging
- * protocol to use.
- */
- struct net_device *master_netdev;
-
/* Copy of tag_ops->rcv for faster access in hot path */
struct sk_buff * (*rcv)(struct sk_buff *skb,
struct net_device *dev,
@@ -135,12 +129,6 @@ struct dsa_switch_tree {
struct net_device *orig_dev);
/*
- * Original copy of the master netdev ethtool_ops
- */
- struct ethtool_ops master_ethtool_ops;
- const struct ethtool_ops *master_orig_ethtool_ops;
-
- /*
* The switch port to which the CPU is attached.
*/
struct dsa_port *cpu_dp;
@@ -189,6 +177,11 @@ struct dsa_port {
u8 stp_state;
struct net_device *bridge_dev;
struct devlink_port devlink_port;
+ /*
+ * Original copy of the master netdev ethtool_ops
+ */
+ struct ethtool_ops ethtool_ops;
+ const struct ethtool_ops *orig_ethtool_ops;
};
struct dsa_switch {
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 6aacc2314a8f..416ac4ef9ba9 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -118,15 +118,16 @@ int dsa_cpu_port_ethtool_setup(struct dsa_port *cpu_dp)
struct net_device *master;
struct ethtool_ops *cpu_ops;
- master = ds->dst->cpu_dp->netdev;
+ master = cpu_dp->netdev;
+
cpu_ops = devm_kzalloc(ds->dev, sizeof(*cpu_ops), GFP_KERNEL);
if (!cpu_ops)
return -ENOMEM;
- memcpy(&ds->dst->master_ethtool_ops, master->ethtool_ops,
+ memcpy(&cpu_dp->ethtool_ops, master->ethtool_ops,
sizeof(struct ethtool_ops));
- ds->dst->master_orig_ethtool_ops = master->ethtool_ops;
- memcpy(cpu_ops, &ds->dst->master_ethtool_ops,
+ cpu_dp->orig_ethtool_ops = master->ethtool_ops;
+ memcpy(cpu_ops, &cpu_dp->ethtool_ops,
sizeof(struct ethtool_ops));
dsa_cpu_port_ethtool_init(cpu_ops);
master->ethtool_ops = cpu_ops;
@@ -136,12 +137,7 @@ int dsa_cpu_port_ethtool_setup(struct dsa_port *cpu_dp)
void dsa_cpu_port_ethtool_restore(struct dsa_port *cpu_dp)
{
- struct dsa_switch *ds = cpu_dp->ds;
- struct net_device *master;
-
- master = ds->dst->cpu_dp->netdev;
-
- master->ethtool_ops = ds->dst->master_orig_ethtool_ops;
+ cpu_dp->netdev->ethtool_ops = cpu_dp->orig_ethtool_ops;
}
void dsa_cpu_dsa_destroy(struct dsa_port *port)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 95031b31d64b..c33db4e3b445 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -524,10 +524,10 @@ static void dsa_cpu_port_get_ethtool_stats(struct net_device *dev,
s8 cpu_port = dst->cpu_dp->index;
int count = 0;
- if (dst->master_ethtool_ops.get_sset_count) {
- count = dst->master_ethtool_ops.get_sset_count(dev,
+ if (dst->cpu_dp->ethtool_ops.get_sset_count) {
+ count = dst->cpu_dp->ethtool_ops.get_sset_count(dev,
ETH_SS_STATS);
- dst->master_ethtool_ops.get_ethtool_stats(dev, stats, data);
+ dst->cpu_dp->ethtool_ops.get_ethtool_stats(dev, stats, data);
}
if (ds->ops->get_ethtool_stats)
@@ -540,8 +540,8 @@ static int dsa_cpu_port_get_sset_count(struct net_device *dev, int sset)
struct dsa_switch *ds = dst->cpu_dp->ds;
int count = 0;
- if (dst->master_ethtool_ops.get_sset_count)
- count += dst->master_ethtool_ops.get_sset_count(dev, sset);
+ if (dst->cpu_dp->ethtool_ops.get_sset_count)
+ count += dst->cpu_dp->ethtool_ops.get_sset_count(dev, sset);
if (sset == ETH_SS_STATS && ds->ops->get_sset_count)
count += ds->ops->get_sset_count(ds);
@@ -565,10 +565,10 @@ static void dsa_cpu_port_get_strings(struct net_device *dev,
/* We do not want to be NULL-terminated, since this is a prefix */
pfx[sizeof(pfx) - 1] = '_';
- if (dst->master_ethtool_ops.get_sset_count) {
- mcount = dst->master_ethtool_ops.get_sset_count(dev,
+ if (dst->cpu_dp->ethtool_ops.get_sset_count) {
+ mcount = dst->cpu_dp->ethtool_ops.get_sset_count(dev,
ETH_SS_STATS);
- dst->master_ethtool_ops.get_strings(dev, stringset, data);
+ dst->cpu_dp->ethtool_ops.get_strings(dev, stringset, data);
}
if (stringset == ETH_SS_STATS && ds->ops->get_strings) {
--
2.9.3
^ permalink raw reply related
* [PATCH 3/4] net: dsa: Associate slave network device with CPU port
From: Florian Fainelli @ 2017-06-13 19:17 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, john, Florian Fainelli
In-Reply-To: <20170613191725.26625-1-f.fainelli@gmail.com>
In preparation for supporting multiple CPU ports with DSA, have the
dsa_port structure know which CPU it is associated with. This will be
important in order to make sure the correct CPU is used for transmission
of the frames. If not for functional reasons, for performance (e.g: load
balancing) and forwarding decisions.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/net/dsa.h | 1 +
net/dsa/dsa2.c | 11 +++++++++++
net/dsa/dsa_priv.h | 2 +-
net/dsa/legacy.c | 1 +
net/dsa/slave.c | 4 +++-
5 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 7e93869819f9..58969b9a090c 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -171,6 +171,7 @@ struct dsa_port {
struct dsa_switch *ds;
unsigned int index;
const char *name;
+ struct dsa_port *cpu_dp;
struct net_device *netdev;
struct device_node *dn;
unsigned int ageing_time;
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index ab48c4f989da..52af8401af07 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -490,6 +490,8 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index,
enum dsa_tag_protocol tag_protocol;
struct net_device *ethernet_dev;
struct device_node *ethernet;
+ struct dsa_port *p;
+ unsigned int i;
if (port->dn) {
ethernet = of_parse_phandle(port->dn, "ethernet", 0);
@@ -507,6 +509,15 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index,
if (!dst->cpu_dp) {
dst->cpu_dp = port;
dst->cpu_dp->netdev = ethernet_dev;
+
+ for (i = 0; i < ds->num_ports; i++) {
+ p = &ds->ports[i];
+ if (!dsa_port_is_valid(p) ||
+ i == index)
+ continue;
+
+ p->cpu_dp = port;
+ }
}
tag_protocol = ds->ops->get_tag_protocol(ds);
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 5c510f4ba0ce..7c2326f3b538 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -185,7 +185,7 @@ extern const struct dsa_device_ops trailer_netdev_ops;
static inline struct net_device *dsa_master_netdev(struct dsa_slave_priv *p)
{
- return p->dp->ds->dst->cpu_dp->netdev;
+ return p->dp->cpu_dp->netdev;
}
#endif
diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c
index 5d4f6ffa3424..e60906125375 100644
--- a/net/dsa/legacy.c
+++ b/net/dsa/legacy.c
@@ -129,6 +129,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
ds->dsa_port_mask |= 1 << i;
} else {
ds->enabled_port_mask |= 1 << i;
+ ds->ports[i].cpu_dp = dst->cpu_dp;
}
valid_name_found = true;
}
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index c33db4e3b445..427f8afcfaf3 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1141,9 +1141,11 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
struct net_device *master;
struct net_device *slave_dev;
struct dsa_slave_priv *p;
+ struct dsa_port *cpu_dp;
int ret;
- master = ds->dst->cpu_dp->netdev;
+ cpu_dp = ds->dst->cpu_dp;
+ master = cpu_dp->netdev;
slave_dev = alloc_netdev(sizeof(struct dsa_slave_priv), name,
NET_NAME_UNKNOWN, ether_setup);
--
2.9.3
^ permalink raw reply related
* [PATCH 4/4] net: dsa: Introduce dsa_get_cpu_port()
From: Florian Fainelli @ 2017-06-13 19:17 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, john, Florian Fainelli
In-Reply-To: <20170613191725.26625-1-f.fainelli@gmail.com>
Introduce a helper function which will return a reference to the CPU
port used in a dsa_switch_tree. Right now this is a singleton, but this
will change once we introduce multi-CPU port support, so ease the
transition by converting the affected code paths.
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/dsa_priv.h | 5 +++++
net/dsa/slave.c | 31 ++++++++++++++++---------------
net/dsa/tag_brcm.c | 5 ++---
net/dsa/tag_ksz.c | 5 ++---
net/dsa/tag_qca.c | 3 ++-
net/dsa/tag_trailer.c | 5 ++---
6 files changed, 29 insertions(+), 25 deletions(-)
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 7c2326f3b538..55982cc39b24 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -188,4 +188,9 @@ static inline struct net_device *dsa_master_netdev(struct dsa_slave_priv *p)
return p->dp->cpu_dp->netdev;
}
+static inline struct dsa_port *dsa_get_cpu_port(struct dsa_switch_tree *dst)
+{
+ return dst->cpu_dp;
+}
+
#endif
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 427f8afcfaf3..845e0c3f871e 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -520,14 +520,14 @@ static void dsa_cpu_port_get_ethtool_stats(struct net_device *dev,
uint64_t *data)
{
struct dsa_switch_tree *dst = dev->dsa_ptr;
- struct dsa_switch *ds = dst->cpu_dp->ds;
- s8 cpu_port = dst->cpu_dp->index;
+ struct dsa_port *cpu_dp = dsa_get_cpu_port(dst);
+ struct dsa_switch *ds = cpu_dp->ds;
+ s8 cpu_port = cpu_dp->index;
int count = 0;
- if (dst->cpu_dp->ethtool_ops.get_sset_count) {
- count = dst->cpu_dp->ethtool_ops.get_sset_count(dev,
- ETH_SS_STATS);
- dst->cpu_dp->ethtool_ops.get_ethtool_stats(dev, stats, data);
+ if (cpu_dp->ethtool_ops.get_sset_count) {
+ count = cpu_dp->ethtool_ops.get_sset_count(dev, ETH_SS_STATS);
+ cpu_dp->ethtool_ops.get_ethtool_stats(dev, stats, data);
}
if (ds->ops->get_ethtool_stats)
@@ -537,11 +537,12 @@ static void dsa_cpu_port_get_ethtool_stats(struct net_device *dev,
static int dsa_cpu_port_get_sset_count(struct net_device *dev, int sset)
{
struct dsa_switch_tree *dst = dev->dsa_ptr;
- struct dsa_switch *ds = dst->cpu_dp->ds;
+ struct dsa_port *cpu_dp = dsa_get_cpu_port(dst);
+ struct dsa_switch *ds = cpu_dp->ds;
int count = 0;
- if (dst->cpu_dp->ethtool_ops.get_sset_count)
- count += dst->cpu_dp->ethtool_ops.get_sset_count(dev, sset);
+ if (cpu_dp->ethtool_ops.get_sset_count)
+ count += cpu_dp->ethtool_ops.get_sset_count(dev, sset);
if (sset == ETH_SS_STATS && ds->ops->get_sset_count)
count += ds->ops->get_sset_count(ds);
@@ -553,8 +554,9 @@ static void dsa_cpu_port_get_strings(struct net_device *dev,
uint32_t stringset, uint8_t *data)
{
struct dsa_switch_tree *dst = dev->dsa_ptr;
- struct dsa_switch *ds = dst->cpu_dp->ds;
- s8 cpu_port = dst->cpu_dp->index;
+ struct dsa_port *cpu_dp = dsa_get_cpu_port(dst);
+ struct dsa_switch *ds = cpu_dp->ds;
+ s8 cpu_port = cpu_dp->index;
int len = ETH_GSTRING_LEN;
int mcount = 0, count;
unsigned int i;
@@ -565,10 +567,9 @@ static void dsa_cpu_port_get_strings(struct net_device *dev,
/* We do not want to be NULL-terminated, since this is a prefix */
pfx[sizeof(pfx) - 1] = '_';
- if (dst->cpu_dp->ethtool_ops.get_sset_count) {
- mcount = dst->cpu_dp->ethtool_ops.get_sset_count(dev,
- ETH_SS_STATS);
- dst->cpu_dp->ethtool_ops.get_strings(dev, stringset, data);
+ if (cpu_dp->ethtool_ops.get_sset_count) {
+ mcount = cpu_dp->ethtool_ops.get_sset_count(dev, ETH_SS_STATS);
+ cpu_dp->ethtool_ops.get_strings(dev, stringset, data);
}
if (stringset == ETH_SS_STATS && ds->ops->get_strings) {
diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
index c03860907f28..c697d9815177 100644
--- a/net/dsa/tag_brcm.c
+++ b/net/dsa/tag_brcm.c
@@ -93,12 +93,11 @@ static struct sk_buff *brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,
struct net_device *orig_dev)
{
struct dsa_switch_tree *dst = dev->dsa_ptr;
- struct dsa_switch *ds;
+ struct dsa_port *cpu_dp = dsa_get_cpu_port(dst);
+ struct dsa_switch *ds = cpu_dp->ds;
int source_port;
u8 *brcm_tag;
- ds = dst->cpu_dp->ds;
-
if (unlikely(!pskb_may_pull(skb, BRCM_TAG_LEN)))
return NULL;
diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
index b94a334a1d02..fab41de8e983 100644
--- a/net/dsa/tag_ksz.c
+++ b/net/dsa/tag_ksz.c
@@ -75,12 +75,11 @@ static struct sk_buff *ksz_rcv(struct sk_buff *skb, struct net_device *dev,
struct net_device *orig_dev)
{
struct dsa_switch_tree *dst = dev->dsa_ptr;
- struct dsa_switch *ds;
+ struct dsa_port *cpu_dp = dsa_get_cpu_port(dst);
+ struct dsa_switch *ds = cpu_dp->ds;
u8 *tag;
int source_port;
- ds = dst->cpu_dp->ds;
-
tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
source_port = tag[0] & 7;
diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c
index 4f43cf0b4eff..1867a3d11f28 100644
--- a/net/dsa/tag_qca.c
+++ b/net/dsa/tag_qca.c
@@ -67,6 +67,7 @@ static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev,
struct net_device *orig_dev)
{
struct dsa_switch_tree *dst = dev->dsa_ptr;
+ struct dsa_port *cpu_dp = dsa_get_cpu_port(dst);
struct dsa_switch *ds;
u8 ver;
int port;
@@ -95,7 +96,7 @@ static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev,
/* This protocol doesn't support cascading multiple switches so it's
* safe to assume the switch is first in the tree
*/
- ds = dst->cpu_dp->ds;
+ ds = cpu_dp->ds;
if (!ds)
return NULL;
diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c
index b4f6db094409..172f13167896 100644
--- a/net/dsa/tag_trailer.c
+++ b/net/dsa/tag_trailer.c
@@ -61,12 +61,11 @@ static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev,
struct net_device *orig_dev)
{
struct dsa_switch_tree *dst = dev->dsa_ptr;
- struct dsa_switch *ds;
+ struct dsa_port *cpu_dp = dsa_get_cpu_port(dst);
+ struct dsa_switch *ds = cpu_dp->ds;
u8 *trailer;
int source_port;
- ds = dst->cpu_dp->ds;
-
if (skb_linearize(skb))
return NULL;
--
2.9.3
^ permalink raw reply related
* Re: [PATCH][netdev-next] net: hns: make guid hns_dsaf_acpi_dsm_guid static
From: Andy Shevchenko @ 2017-06-13 19:24 UTC (permalink / raw)
To: David Miller, Christoph Hellwig
Cc: Colin King, Yisen Zhuang, salil.mehta, huangdaode, yankejian,
Andy Shevchenko, oulijun, netdev, kernel-janitors,
linux-kernel@vger.kernel.org
In-Reply-To: <20170613.135619.350474759117231721.davem@davemloft.net>
On Tue, Jun 13, 2017 at 8:56 PM, David Miller <davem@davemloft.net> wrote:
> From: Colin King <colin.king@canonical.com>
> Date: Tue, 13 Jun 2017 14:03:21 +0100
>
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The guid hns_dsaf_acpi_dsm_guid does not need to be in global
>> scope, so make it static.
>>
>> Cleans up sparse warning:
>> "symbol 'hns_dsaf_acpi_dsm_guid' was not declared. Should it be static?"
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>
> That symbol doesn't even exist in th net-next tree.
It looks like the patch is done against UUID tree.
Cc'ed Christoph.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH 3/4] net: dsa: Associate slave network device with CPU port
From: Vivien Didelot @ 2017-06-13 19:23 UTC (permalink / raw)
To: Florian Fainelli, netdev; +Cc: davem, andrew, john, Florian Fainelli
In-Reply-To: <20170613191725.26625-4-f.fainelli@gmail.com>
Florian Fainelli <f.fainelli@gmail.com> writes:
> In preparation for supporting multiple CPU ports with DSA, have the
> dsa_port structure know which CPU it is associated with. This will be
> important in order to make sure the correct CPU is used for transmission
> of the frames. If not for functional reasons, for performance (e.g: load
> balancing) and forwarding decisions.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
^ permalink raw reply
* Re: [PATCH nf-next] netns: add and use net_ns_barrier
From: Joe Stringer @ 2017-06-13 19:27 UTC (permalink / raw)
To: Florian Westphal
Cc: Cong Wang, Eric W. Biederman, netfilter-devel,
Linux Kernel Network Developers
In-Reply-To: <20170613180713.GA10130@breakpoint.cc>
On 13 June 2017 at 11:07, Florian Westphal <fw@strlen.de> wrote:
> Cong Wang <xiyou.wangcong@gmail.com> wrote:
>> On Mon, Jun 12, 2017 at 11:16 PM, Florian Westphal <fw@strlen.de> wrote:
>> > Cong Wang <xiyou.wangcong@gmail.com> wrote:
>> >> On Thu, Jun 1, 2017 at 1:52 AM, Florian Westphal <fw@strlen.de> wrote:
>> >> > Joe described it nicely, problem is that after unload we may have
>> >> > conntracks that still have a nf_conn_help extension attached that
>> >> > has a pointer to a structure that resided in the (unloaded) module.
>> >>
>> >> Why not hold a refcnt for its module?
>> >
>> > That would work as well.
>> >
>> > I'm not sure its nice to disallow rmmod of helper modules if they are
>> > used by a connection however.
>>
>> I am _not_ suggesting to disallow rmmod.
>
> My point was that if you hold reference counts to the module users
> will need to manually flush conntrack table (or at least manually
> remove affected connections), else rmmod won't work as refcount might be
> gt 0.
>
>> > Right now you can "rmmod nf_conntrack_foo" at any time and this should
>> > work just fine without first having to flush affected conntracks
>> > manually.
>>
>> My point is that since netns wq could invoke code of that module,
>> why it doesn't hold a refcnt of that module?
>
> *shrug*, I did not write this stuff.
>
> Historically it wasn't needed because we just clear out the helper area
> in the affected conntracks (i.e, future packets are not inspected by
> the helper anymore).
>
> When conntracks were made per-netns this problem was added as we're not
> guaranteed to see all net namespace because module_exit and netns cleanup
> can run concurrently.
>
> We can still use the "old" model if we guarantee that we wait for
> netns cleanup to finish (which is what this patch does).
>
> The alternative, as you pointed out, is to take a module reference for
> each conntrack that uses the helper (and put again when connection is
> destroyed).
>
> I don't really care that much except that if we go for the latter
> solution users cannot "just rmmod" the module anymore but might have
> to manually remove the affected connections first.
The barrier approach sounds less surprising from user perspective for
this very reason.
^ permalink raw reply
* Re: [PATCH net-next] cxgb4: handle serial flash interrupt
From: David Miller @ 2017-06-13 19:57 UTC (permalink / raw)
To: ganeshgr; +Cc: netdev, nirranjan, indranil, venkatesh, rahul.lakkireddy
In-Reply-To: <1497381343-31705-1-git-send-email-ganeshgr@chelsio.com>
From: Ganesh Goudar <ganeshgr@chelsio.com>
Date: Wed, 14 Jun 2017 00:45:43 +0530
> If SF bit is not cleared in PL_INT_CAUSE, subsequent non-data
> interrupts are not raised. Enable SF bit in Global Interrupt
> Mask and handle it as non-fatal and hence eventually clear it.
>
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Applied, thank you.
^ permalink raw reply
* Re: [PATCH net-next v3 0/4] net: dsa: Multi-CPU ground work (v3)
From: David Miller @ 2017-06-13 20:11 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev, andrew, vivien.didelot, john
In-Reply-To: <20170613191725.26625-1-f.fainelli@gmail.com>
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Tue, 13 Jun 2017 12:17:21 -0700
> This patch series prepares the ground for adding mutliple CPU port support to
> DSA, and starts by removing redundant pieces of information such as
> master_netdev which is cpu_dp->ethernet. Finally drivers are moved away from
> directly accessing ds->dst->cpu_dp and use appropriate helper functions.
>
> Note that if you have Device Tree blobs/platform configurations that are
> currently listing multiple CPU ports, the proposed behavior in
> dsa_ds_get_cpu_dp() will be to return the last bit set in ds->cpu_port_mask.
>
> Future plans include:
> - making dst->cpu_dp a flexible data structure (array, list, you name it)
> - having the ability for drivers to return a default/preferred CPU port (if
> necessary)
...
Series applied, thanks Florian.
^ permalink raw reply
* Re: [PATCH net-next] cxgb4: handle serial flash interrupt
From: David Miller @ 2017-06-13 20:11 UTC (permalink / raw)
To: ganeshgr; +Cc: netdev, nirranjan, indranil, venkatesh, rahul.lakkireddy
In-Reply-To: <1497381343-31705-1-git-send-email-ganeshgr@chelsio.com>
From: Ganesh Goudar <ganeshgr@chelsio.com>
Date: Wed, 14 Jun 2017 00:45:43 +0530
> If SF bit is not cleared in PL_INT_CAUSE, subsequent non-data
> interrupts are not raised. Enable SF bit in Global Interrupt
> Mask and handle it as non-fatal and hence eventually clear it.
>
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next v3 0/4] net: dsa: Multi-CPU ground work (v3)
From: David Miller @ 2017-06-13 20:13 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev, andrew, vivien.didelot, john
In-Reply-To: <20170613.161113.1646399895545825339.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Tue, 13 Jun 2017 16:11:13 -0400 (EDT)
> From: Florian Fainelli <f.fainelli@gmail.com>
> Date: Tue, 13 Jun 2017 12:17:21 -0700
>
>> This patch series prepares the ground for adding mutliple CPU port support to
>> DSA, and starts by removing redundant pieces of information such as
>> master_netdev which is cpu_dp->ethernet. Finally drivers are moved away from
>> directly accessing ds->dst->cpu_dp and use appropriate helper functions.
>>
>> Note that if you have Device Tree blobs/platform configurations that are
>> currently listing multiple CPU ports, the proposed behavior in
>> dsa_ds_get_cpu_dp() will be to return the last bit set in ds->cpu_port_mask.
>>
>> Future plans include:
>> - making dst->cpu_dp a flexible data structure (array, list, you name it)
>> - having the ability for drivers to return a default/preferred CPU port (if
>> necessary)
> ...
>
> Series applied, thanks Florian.
Actually, I reverted, this introduced a warning, please build with NETPOLL
enabled:
net/dsa/slave.c: In function ‘dsa_slave_netpoll_setup’:
net/dsa/slave.c:688:21: warning: unused variable ‘ds’ [-Wunused-variable]
struct dsa_switch *ds = p->dp->ds;
^ permalink raw reply
* Re: [PATCH] af_iucv: Move sockaddr length checks to before accessing sa_family in bind and connect handlers
From: David Miller @ 2017-06-13 20:15 UTC (permalink / raw)
To: mjurczyk; +Cc: jwi, ubraun, linux-s390, netdev, linux-kernel
In-Reply-To: <20170613174228.9218-1-mjurczyk@google.com>
From: Mateusz Jurczyk <mjurczyk@google.com>
Date: Tue, 13 Jun 2017 19:42:28 +0200
> Verify that the caller-provided sockaddr structure is large enough to
> contain the sa_family field, before accessing it in bind() and connect()
> handlers of the AF_IUCV socket. Since neither syscall enforces a minimum
> size of the corresponding memory region, very short sockaddrs (zero or
> one byte long) result in operating on uninitialized memory while
> referencing .sa_family.
>
> Signed-off-by: Mateusz Jurczyk <mjurczyk@google.com>
...
> /* Verify the input sockaddr */
> - if (!addr || addr->sa_family != AF_IUCV)
> - return -EINVAL;
> -
> - if (addr_len < sizeof(struct sockaddr_iucv))
> + if (!addr || addr_len < sizeof(struct sockaddr_iucv) ||
> + addr->sa_family != AF_IUCV)
The 'addr' can never be NULL so please remove that check, thank you.
^ permalink raw reply
* Re: Repeatable inet6_dump_fib crash in stock 4.12.0-rc4+
From: Ben Greear @ 2017-06-13 20:16 UTC (permalink / raw)
To: Eric Dumazet, David Ahern; +Cc: Cong Wang, netdev
In-Reply-To: <1497043557.736.94.camel@edumazet-glaptop3.roam.corp.google.com>
On 06/09/2017 02:25 PM, Eric Dumazet wrote:
> On Fri, 2017-06-09 at 07:27 -0600, David Ahern wrote:
>> On 6/8/17 11:55 PM, Cong Wang wrote:
>>> On Thu, Jun 8, 2017 at 2:27 PM, Ben Greear <greearb@candelatech.com> wrote:
>>>>
>>>> As far as I can tell, the patch did not help, or at least we still reproduce
>>>> the
>>>> crash easily.
>>>
>>> netlink dump is serialized by nlk->cb_mutex so I don't think that
>>> patch makes any sense w.r.t race condition.
>>
>> From what I can see fn_sernum should be accessed under table lock, so
>> when saving and checking it during a walk make sure it the lock is held.
>> That has nothing to do with the netlink dump, but the table changing
>> during a walk.
>
>
> Yes, your patch makes total sense, of course.
I guess someone should go ahead and make an official patch and
submit it, even if it doesn't fix my problem.
>>>> (gdb) l *(fib6_walk_continue+0x76)
>>>> 0x188c6 is in fib6_walk_continue
>>>> (/home/greearb/git/linux-2.6/net/ipv6/ip6_fib.c:1593).
>>>> 1588 if (fn == w->root)
>>>> 1589 return 0;
>>>> 1590 pn = fn->parent;
>>>> 1591 w->node = pn;
>>>> 1592 #ifdef CONFIG_IPV6_SUBTREES
>>>> 1593 if (FIB6_SUBTREE(pn) == fn) {
>>>
>>> Apparently fn->parent is NULL here for some reason, but
>>> I don't know if that is expected or not. If a simple NULL check
>>> is not enough here, we have to trace why it is NULL.
>>
>> From my understanding, parent should not be null hence the attempts to
>> fix access to table nodes under a lock. ie., figuring out why it is null
>> here.
If someone has more suggestions, I'll be happy to test.
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: [PATCH net-next] networking: use skb_put_zero()
From: kbuild test robot @ 2017-06-13 20:18 UTC (permalink / raw)
To: Johannes Berg; +Cc: kbuild-all, netdev, Johannes Berg
In-Reply-To: <20170613122818.3523-1-johannes@sipsolutions.net>
[-- Attachment #1: Type: text/plain, Size: 1911 bytes --]
Hi Johannes,
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Johannes-Berg/networking-use-skb_put_zero/20170614-035553
config: x86_64-randconfig-x019-201724 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All error/warnings (new ones prefixed by >>):
drivers/nfc/pn533/pn533.c: In function 'pn533_alloc_poll_tg_frame':
>> drivers/nfc/pn533/pn533.c:1046:11: error: implicit declaration of function 'skb_put_zero' [-Werror=implicit-function-declaration]
nfcid3 = skb_put_zero(skb, 10);
^~~~~~~~~~~~
>> drivers/nfc/pn533/pn533.c:1046:9: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
nfcid3 = skb_put_zero(skb, 10);
^
cc1: some warnings being treated as errors
--
net/sctp/sm_make_chunk.c: In function 'sctp_make_auth':
>> net/sctp/sm_make_chunk.c:1299:9: error: implicit declaration of function 'skb_put_zero' [-Werror=implicit-function-declaration]
hmac = skb_put_zero(retval->skb, hmac_desc->hmac_len);
^~~~~~~~~~~~
>> net/sctp/sm_make_chunk.c:1299:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
hmac = skb_put_zero(retval->skb, hmac_desc->hmac_len);
^
cc1: some warnings being treated as errors
vim +/skb_put_zero +1046 drivers/nfc/pn533/pn533.c
1040 /* Felica params */
1041 felica = skb_put(skb, 18);
1042 memcpy(felica, felica_params, 18);
1043 get_random_bytes(felica + 2, 6);
1044
1045 /* NFCID3 */
> 1046 nfcid3 = skb_put_zero(skb, 10);
1047 memcpy(nfcid3, felica, 8);
1048
1049 /* General bytes */
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33788 bytes --]
^ permalink raw reply
* Re: [PATCH net-next] networking: use skb_put_zero()
From: kbuild test robot @ 2017-06-13 20:23 UTC (permalink / raw)
To: Johannes Berg; +Cc: kbuild-all, netdev, Johannes Berg
In-Reply-To: <20170613122818.3523-1-johannes@sipsolutions.net>
[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]
Hi Johannes,
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Johannes-Berg/networking-use-skb_put_zero/20170614-035553
config: x86_64-randconfig-x010-201724 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All error/warnings (new ones prefixed by >>):
lib/nlattr.c: In function '__nla_reserve_nohdr':
>> lib/nlattr.c:403:10: error: implicit declaration of function 'skb_put_zero' [-Werror=implicit-function-declaration]
start = skb_put_zero(skb, NLA_ALIGN(attrlen));
^~~~~~~~~~~~
>> lib/nlattr.c:403:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
start = skb_put_zero(skb, NLA_ALIGN(attrlen));
^
cc1: some warnings being treated as errors
vim +/skb_put_zero +403 lib/nlattr.c
397 * tailroom for the payload.
398 */
399 void *__nla_reserve_nohdr(struct sk_buff *skb, int attrlen)
400 {
401 void *start;
402
> 403 start = skb_put_zero(skb, NLA_ALIGN(attrlen));
404
405 return start;
406 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 22864 bytes --]
^ permalink raw reply
* [PATCH net-next v4 0/4] net: dsa: Multi-CPU ground work (v4)
From: Florian Fainelli @ 2017-06-13 20:27 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, john, Florian Fainelli
Hi all,
This patch series prepares the ground for adding mutliple CPU port support to
DSA, and starts by removing redundant pieces of information such as
master_netdev which is cpu_dp->ethernet. Finally drivers are moved away from
directly accessing ds->dst->cpu_dp and use appropriate helper functions.
Note that if you have Device Tree blobs/platform configurations that are
currently listing multiple CPU ports, the proposed behavior in
dsa_ds_get_cpu_dp() will be to return the last bit set in ds->cpu_port_mask.
Future plans include:
- making dst->cpu_dp a flexible data structure (array, list, you name it)
- having the ability for drivers to return a default/preferred CPU port (if
necessary)
Changes in v4:
- fixed build warning with NETPOLL enabled
Changes in v3:
- removed the last patch since it causes problems with bcm_sf2/b53 in a
dual-CPU case (root cause known, proper fix underway)
- removed dsa_ds_get_cpu_dp()
Changes in v2:
- added Reviewed-by tags
- assign port->cpu_dp earlier before ops->setup() has run
Florian Fainelli (5):
net: dsa: Remove master_netdev and use dst->cpu_dp->netdev
net: dsa: Relocate master ethtool operations
net: dsa: Associate slave network device with CPU port
net: dsa: Introduce dsa_dst_get_cpu_dp()
net: dsa: Stop accessing ds->dst->cpu_dp in drivers
drivers/net/dsa/b53/b53_common.c | 4 +--
drivers/net/dsa/bcm_sf2.c | 10 +++++---
drivers/net/dsa/mt7530.c | 6 +++--
drivers/net/dsa/mv88e6060.c | 2 +-
drivers/net/dsa/qca8k.c | 2 +-
include/net/dsa.h | 29 +++++++++-------------
net/dsa/dsa.c | 19 ++++----------
net/dsa/dsa2.c | 27 ++++++++++++--------
net/dsa/dsa_priv.h | 10 ++++++++
net/dsa/legacy.c | 23 ++++++++++-------
net/dsa/slave.c | 53 ++++++++++++++++++++--------------------
net/dsa/tag_brcm.c | 5 ++--
net/dsa/tag_ksz.c | 5 ++--
net/dsa/tag_qca.c | 3 ++-
net/dsa/tag_trailer.c | 5 ++--
15 files changed, 107 insertions(+), 96 deletions(-)
--
2.9.3
^ permalink raw reply
* [PATCH v4 1/4] net: dsa: Remove master_netdev and use dst->cpu_dp->netdev
From: Florian Fainelli @ 2017-06-13 20:27 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, john, Florian Fainelli
In-Reply-To: <20170613202722.17598-1-f.fainelli@gmail.com>
In preparation for supporting multiple CPU ports, remove
dst->master_netdev and ds->master_netdev and replace them with only one
instance of the common object we have for a port: struct
dsa_port::netdev. ds->master_netdev is currently write only and would be
helpful in the case where we have two switches, both with CPU ports, and
also connected within each other, which the multi-CPU port patch series
would address.
While at it, introduce a helper function used in net/dsa/slave.c to
immediately get a reference on the master network device called
dsa_master_netdev().
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/bcm_sf2.c | 4 ++--
drivers/net/dsa/mt7530.c | 4 ++--
include/net/dsa.h | 5 -----
net/dsa/dsa.c | 9 ++-------
net/dsa/dsa2.c | 18 +++++++-----------
net/dsa/dsa_priv.h | 5 +++++
net/dsa/legacy.c | 22 +++++++++++++---------
net/dsa/slave.c | 21 +++++++++------------
8 files changed, 40 insertions(+), 48 deletions(-)
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 687a8bae5d73..76e98e8ed315 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -806,7 +806,7 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds)
static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port,
struct ethtool_wolinfo *wol)
{
- struct net_device *p = ds->dst[ds->index].master_netdev;
+ struct net_device *p = ds->dst[ds->index].cpu_dp->netdev;
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
struct ethtool_wolinfo pwol;
@@ -829,7 +829,7 @@ static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port,
static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port,
struct ethtool_wolinfo *wol)
{
- struct net_device *p = ds->dst[ds->index].master_netdev;
+ struct net_device *p = ds->dst[ds->index].cpu_dp->netdev;
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
s8 cpu_port = ds->dst->cpu_dp->index;
struct ethtool_wolinfo pwol;
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 25e00d5e0eec..1e46418a3b74 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -912,11 +912,11 @@ mt7530_setup(struct dsa_switch *ds)
struct device_node *dn;
struct mt7530_dummy_poll p;
- /* The parent node of master_netdev which holds the common system
+ /* The parent node of cpu_dp->netdev which holds the common system
* controller also is the container for two GMACs nodes representing
* as two netdev instances.
*/
- dn = ds->master_netdev->dev.of_node->parent;
+ dn = ds->dst->cpu_dp->netdev->dev.of_node->parent;
priv->ethernet = syscon_node_to_regmap(dn);
if (IS_ERR(priv->ethernet))
return PTR_ERR(priv->ethernet);
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 2effb0af9d7c..b2fb53f5e28e 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -227,11 +227,6 @@ struct dsa_switch {
s8 rtable[DSA_MAX_SWITCHES];
/*
- * The lower device this switch uses to talk to the host
- */
- struct net_device *master_netdev;
-
- /*
* Slave mii_bus and devices for the individual ports.
*/
u32 dsa_port_mask;
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 517215391514..6aacc2314a8f 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -118,10 +118,7 @@ int dsa_cpu_port_ethtool_setup(struct dsa_port *cpu_dp)
struct net_device *master;
struct ethtool_ops *cpu_ops;
- master = ds->dst->master_netdev;
- if (ds->master_netdev)
- master = ds->master_netdev;
-
+ master = ds->dst->cpu_dp->netdev;
cpu_ops = devm_kzalloc(ds->dev, sizeof(*cpu_ops), GFP_KERNEL);
if (!cpu_ops)
return -ENOMEM;
@@ -142,9 +139,7 @@ void dsa_cpu_port_ethtool_restore(struct dsa_port *cpu_dp)
struct dsa_switch *ds = cpu_dp->ds;
struct net_device *master;
- master = ds->dst->master_netdev;
- if (ds->master_netdev)
- master = ds->master_netdev;
+ master = ds->dst->cpu_dp->netdev;
master->ethtool_ops = ds->dst->master_orig_ethtool_ops;
}
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index f88e1dddb74a..ab48c4f989da 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -337,7 +337,7 @@ static int dsa_ds_apply(struct dsa_switch_tree *dst, struct dsa_switch *ds)
return err;
if (ds->ops->set_addr) {
- err = ds->ops->set_addr(ds, dst->master_netdev->dev_addr);
+ err = ds->ops->set_addr(ds, dst->cpu_dp->netdev->dev_addr);
if (err < 0)
return err;
}
@@ -444,7 +444,7 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst)
* sent to the tag format's receive function.
*/
wmb();
- dst->master_netdev->dsa_ptr = dst;
+ dst->cpu_dp->netdev->dsa_ptr = dst;
dst->applied = true;
return 0;
@@ -458,7 +458,7 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst)
if (!dst->applied)
return;
- dst->master_netdev->dsa_ptr = NULL;
+ dst->cpu_dp->netdev->dsa_ptr = NULL;
/* If we used a tagging format that doesn't have an ethertype
* field, make sure that all packets from this point get sent
@@ -504,14 +504,10 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index,
if (!ethernet_dev)
return -EPROBE_DEFER;
- if (!ds->master_netdev)
- ds->master_netdev = ethernet_dev;
-
- if (!dst->master_netdev)
- dst->master_netdev = ethernet_dev;
-
- if (!dst->cpu_dp)
+ if (!dst->cpu_dp) {
dst->cpu_dp = port;
+ dst->cpu_dp->netdev = ethernet_dev;
+ }
tag_protocol = ds->ops->get_tag_protocol(ds);
dst->tag_ops = dsa_resolve_tag_protocol(tag_protocol);
@@ -578,7 +574,7 @@ static int dsa_dst_parse(struct dsa_switch_tree *dst)
return err;
}
- if (!dst->master_netdev) {
+ if (!dst->cpu_dp->netdev) {
pr_warn("Tree has no master device\n");
return -EINVAL;
}
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 66ee248796c8..5c510f4ba0ce 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -183,4 +183,9 @@ extern const struct dsa_device_ops qca_netdev_ops;
/* tag_trailer.c */
extern const struct dsa_device_ops trailer_netdev_ops;
+static inline struct net_device *dsa_master_netdev(struct dsa_slave_priv *p)
+{
+ return p->dp->ds->dst->cpu_dp->netdev;
+}
+
#endif
diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c
index 3a56de8f51a8..5d4f6ffa3424 100644
--- a/net/dsa/legacy.c
+++ b/net/dsa/legacy.c
@@ -101,9 +101,12 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
struct dsa_switch_tree *dst = ds->dst;
struct dsa_chip_data *cd = ds->cd;
bool valid_name_found = false;
+ struct net_device *master;
int index = ds->index;
int i, ret;
+ master = dst->cpu_dp->netdev;
+
/*
* Validate supplied switch configuration.
*/
@@ -116,7 +119,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
if (!strcmp(name, "cpu")) {
if (dst->cpu_dp) {
- netdev_err(dst->master_netdev,
+ netdev_err(master,
"multiple cpu ports?!\n");
return -EINVAL;
}
@@ -168,7 +171,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
return ret;
if (ops->set_addr) {
- ret = ops->set_addr(ds, dst->master_netdev->dev_addr);
+ ret = ops->set_addr(ds, master->dev_addr);
if (ret < 0)
return ret;
}
@@ -195,14 +198,14 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
ret = dsa_slave_create(ds, parent, i, cd->port_names[i]);
if (ret < 0)
- netdev_err(dst->master_netdev, "[%d]: can't create dsa slave device for port %d(%s): %d\n",
+ netdev_err(master, "[%d]: can't create dsa slave device for port %d(%s): %d\n",
index, i, cd->port_names[i], ret);
}
/* Perform configuration of the CPU and DSA ports */
ret = dsa_cpu_dsa_setups(ds, parent);
if (ret < 0)
- netdev_err(dst->master_netdev, "[%d] : can't configure CPU and DSA ports\n",
+ netdev_err(master, "[%d] : can't configure CPU and DSA ports\n",
index);
ret = dsa_cpu_port_ethtool_setup(ds->dst->cpu_dp);
@@ -217,6 +220,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
struct device *parent, struct device *host_dev)
{
struct dsa_chip_data *cd = dst->pd->chip + index;
+ struct net_device *master = dst->cpu_dp->netdev;
const struct dsa_switch_ops *ops;
struct dsa_switch *ds;
int ret;
@@ -228,11 +232,11 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
*/
ops = dsa_switch_probe(parent, host_dev, cd->sw_addr, &name, &priv);
if (!ops) {
- netdev_err(dst->master_netdev, "[%d]: could not detect attached switch\n",
+ netdev_err(master, "[%d]: could not detect attached switch\n",
index);
return ERR_PTR(-EINVAL);
}
- netdev_info(dst->master_netdev, "[%d]: detected a %s switch\n",
+ netdev_info(master, "[%d]: detected a %s switch\n",
index, name);
@@ -575,7 +579,7 @@ static int dsa_setup_dst(struct dsa_switch_tree *dst, struct net_device *dev,
unsigned configured = 0;
dst->pd = pd;
- dst->master_netdev = dev;
+ dst->cpu_dp->netdev = dev;
for (i = 0; i < pd->nr_chips; i++) {
struct dsa_switch *ds;
@@ -671,7 +675,7 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)
{
int i;
- dst->master_netdev->dsa_ptr = NULL;
+ dst->cpu_dp->netdev->dsa_ptr = NULL;
/* If we used a tagging format that doesn't have an ethertype
* field, make sure that all packets from this point get sent
@@ -688,7 +692,7 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)
dsa_cpu_port_ethtool_restore(dst->cpu_dp);
- dev_put(dst->master_netdev);
+ dev_put(dst->cpu_dp->netdev);
}
static int dsa_remove(struct platform_device *pdev)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 5e45ae5c3f71..658bc67c5320 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -66,7 +66,7 @@ static int dsa_slave_get_iflink(const struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
- return p->dp->ds->dst->master_netdev->ifindex;
+ return dsa_master_netdev(p)->ifindex;
}
static int dsa_slave_open(struct net_device *dev)
@@ -74,7 +74,7 @@ static int dsa_slave_open(struct net_device *dev)
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_port *dp = p->dp;
struct dsa_switch *ds = dp->ds;
- struct net_device *master = ds->dst->master_netdev;
+ struct net_device *master = dsa_master_netdev(p);
u8 stp_state = dp->bridge_dev ? BR_STATE_BLOCKING : BR_STATE_FORWARDING;
int err;
@@ -127,7 +127,7 @@ static int dsa_slave_open(struct net_device *dev)
static int dsa_slave_close(struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
- struct net_device *master = p->dp->ds->dst->master_netdev;
+ struct net_device *master = dsa_master_netdev(p);
struct dsa_switch *ds = p->dp->ds;
if (p->phy)
@@ -154,7 +154,7 @@ static int dsa_slave_close(struct net_device *dev)
static void dsa_slave_change_rx_flags(struct net_device *dev, int change)
{
struct dsa_slave_priv *p = netdev_priv(dev);
- struct net_device *master = p->dp->ds->dst->master_netdev;
+ struct net_device *master = dsa_master_netdev(p);
if (change & IFF_ALLMULTI)
dev_set_allmulti(master, dev->flags & IFF_ALLMULTI ? 1 : -1);
@@ -165,7 +165,7 @@ static void dsa_slave_change_rx_flags(struct net_device *dev, int change)
static void dsa_slave_set_rx_mode(struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
- struct net_device *master = p->dp->ds->dst->master_netdev;
+ struct net_device *master = dsa_master_netdev(p);
dev_mc_sync(master, dev);
dev_uc_sync(master, dev);
@@ -174,7 +174,7 @@ static void dsa_slave_set_rx_mode(struct net_device *dev)
static int dsa_slave_set_mac_address(struct net_device *dev, void *a)
{
struct dsa_slave_priv *p = netdev_priv(dev);
- struct net_device *master = p->dp->ds->dst->master_netdev;
+ struct net_device *master = dsa_master_netdev(p);
struct sockaddr *addr = a;
int err;
@@ -375,7 +375,7 @@ static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
/* Queue the SKB for transmission on the parent interface, but
* do not modify its EtherType
*/
- nskb->dev = p->dp->ds->dst->master_netdev;
+ nskb->dev = dsa_master_netdev(p);
dev_queue_xmit(nskb);
return NETDEV_TX_OK;
@@ -684,8 +684,7 @@ static int dsa_slave_netpoll_setup(struct net_device *dev,
struct netpoll_info *ni)
{
struct dsa_slave_priv *p = netdev_priv(dev);
- struct dsa_switch *ds = p->dp->ds;
- struct net_device *master = ds->dst->master_netdev;
+ struct net_device *master = dsa_master_netdev(p);
struct netpoll *netpoll;
int err = 0;
@@ -1143,9 +1142,7 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
struct dsa_slave_priv *p;
int ret;
- master = ds->dst->master_netdev;
- if (ds->master_netdev)
- master = ds->master_netdev;
+ master = ds->dst->cpu_dp->netdev;
slave_dev = alloc_netdev(sizeof(struct dsa_slave_priv), name,
NET_NAME_UNKNOWN, ether_setup);
--
2.9.3
^ permalink raw reply related
* [PATCH v4 2/4] net: dsa: Relocate master ethtool operations
From: Florian Fainelli @ 2017-06-13 20:27 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, john, Florian Fainelli
In-Reply-To: <20170613202722.17598-1-f.fainelli@gmail.com>
Relocate master_ethtool_ops and master_orig_ethtool_ops into struct
dsa_port in order to be both consistent, and make things self contained
within the dsa_port structure.
This is a preliminary change to supporting multiple CPU port interfaces.
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/net/dsa.h | 17 +++++------------
net/dsa/dsa.c | 16 ++++++----------
net/dsa/slave.c | 16 ++++++++--------
3 files changed, 19 insertions(+), 30 deletions(-)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index b2fb53f5e28e..7e93869819f9 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -122,12 +122,6 @@ struct dsa_switch_tree {
*/
struct dsa_platform_data *pd;
- /*
- * Reference to network device to use, and which tagging
- * protocol to use.
- */
- struct net_device *master_netdev;
-
/* Copy of tag_ops->rcv for faster access in hot path */
struct sk_buff * (*rcv)(struct sk_buff *skb,
struct net_device *dev,
@@ -135,12 +129,6 @@ struct dsa_switch_tree {
struct net_device *orig_dev);
/*
- * Original copy of the master netdev ethtool_ops
- */
- struct ethtool_ops master_ethtool_ops;
- const struct ethtool_ops *master_orig_ethtool_ops;
-
- /*
* The switch port to which the CPU is attached.
*/
struct dsa_port *cpu_dp;
@@ -189,6 +177,11 @@ struct dsa_port {
u8 stp_state;
struct net_device *bridge_dev;
struct devlink_port devlink_port;
+ /*
+ * Original copy of the master netdev ethtool_ops
+ */
+ struct ethtool_ops ethtool_ops;
+ const struct ethtool_ops *orig_ethtool_ops;
};
struct dsa_switch {
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 6aacc2314a8f..416ac4ef9ba9 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -118,15 +118,16 @@ int dsa_cpu_port_ethtool_setup(struct dsa_port *cpu_dp)
struct net_device *master;
struct ethtool_ops *cpu_ops;
- master = ds->dst->cpu_dp->netdev;
+ master = cpu_dp->netdev;
+
cpu_ops = devm_kzalloc(ds->dev, sizeof(*cpu_ops), GFP_KERNEL);
if (!cpu_ops)
return -ENOMEM;
- memcpy(&ds->dst->master_ethtool_ops, master->ethtool_ops,
+ memcpy(&cpu_dp->ethtool_ops, master->ethtool_ops,
sizeof(struct ethtool_ops));
- ds->dst->master_orig_ethtool_ops = master->ethtool_ops;
- memcpy(cpu_ops, &ds->dst->master_ethtool_ops,
+ cpu_dp->orig_ethtool_ops = master->ethtool_ops;
+ memcpy(cpu_ops, &cpu_dp->ethtool_ops,
sizeof(struct ethtool_ops));
dsa_cpu_port_ethtool_init(cpu_ops);
master->ethtool_ops = cpu_ops;
@@ -136,12 +137,7 @@ int dsa_cpu_port_ethtool_setup(struct dsa_port *cpu_dp)
void dsa_cpu_port_ethtool_restore(struct dsa_port *cpu_dp)
{
- struct dsa_switch *ds = cpu_dp->ds;
- struct net_device *master;
-
- master = ds->dst->cpu_dp->netdev;
-
- master->ethtool_ops = ds->dst->master_orig_ethtool_ops;
+ cpu_dp->netdev->ethtool_ops = cpu_dp->orig_ethtool_ops;
}
void dsa_cpu_dsa_destroy(struct dsa_port *port)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 658bc67c5320..9bf4c27f3393 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -524,10 +524,10 @@ static void dsa_cpu_port_get_ethtool_stats(struct net_device *dev,
s8 cpu_port = dst->cpu_dp->index;
int count = 0;
- if (dst->master_ethtool_ops.get_sset_count) {
- count = dst->master_ethtool_ops.get_sset_count(dev,
+ if (dst->cpu_dp->ethtool_ops.get_sset_count) {
+ count = dst->cpu_dp->ethtool_ops.get_sset_count(dev,
ETH_SS_STATS);
- dst->master_ethtool_ops.get_ethtool_stats(dev, stats, data);
+ dst->cpu_dp->ethtool_ops.get_ethtool_stats(dev, stats, data);
}
if (ds->ops->get_ethtool_stats)
@@ -540,8 +540,8 @@ static int dsa_cpu_port_get_sset_count(struct net_device *dev, int sset)
struct dsa_switch *ds = dst->cpu_dp->ds;
int count = 0;
- if (dst->master_ethtool_ops.get_sset_count)
- count += dst->master_ethtool_ops.get_sset_count(dev, sset);
+ if (dst->cpu_dp->ethtool_ops.get_sset_count)
+ count += dst->cpu_dp->ethtool_ops.get_sset_count(dev, sset);
if (sset == ETH_SS_STATS && ds->ops->get_sset_count)
count += ds->ops->get_sset_count(ds);
@@ -565,10 +565,10 @@ static void dsa_cpu_port_get_strings(struct net_device *dev,
/* We do not want to be NULL-terminated, since this is a prefix */
pfx[sizeof(pfx) - 1] = '_';
- if (dst->master_ethtool_ops.get_sset_count) {
- mcount = dst->master_ethtool_ops.get_sset_count(dev,
+ if (dst->cpu_dp->ethtool_ops.get_sset_count) {
+ mcount = dst->cpu_dp->ethtool_ops.get_sset_count(dev,
ETH_SS_STATS);
- dst->master_ethtool_ops.get_strings(dev, stringset, data);
+ dst->cpu_dp->ethtool_ops.get_strings(dev, stringset, data);
}
if (stringset == ETH_SS_STATS && ds->ops->get_strings) {
--
2.9.3
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox