slave.c (3e66fd54aeac0519de638a12d84778d8991bedad) slave.c (5077e2c8cf4d6b22a95a6c54a917f764e8887978)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * net/dsa/slave.c - Slave device handling
4 * Copyright (c) 2008-2009 Marvell Semiconductor
5 */
6
7#include <linux/list.h>
8#include <linux/etherdevice.h>

--- 97 unchanged lines hidden (view full) ---

106 dsa_schedule_work(&standalone_work->work);
107
108 return 0;
109}
110
111static int dsa_slave_sync_uc(struct net_device *dev,
112 const unsigned char *addr)
113{
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * net/dsa/slave.c - Slave device handling
4 * Copyright (c) 2008-2009 Marvell Semiconductor
5 */
6
7#include <linux/list.h>
8#include <linux/etherdevice.h>

--- 97 unchanged lines hidden (view full) ---

106 dsa_schedule_work(&standalone_work->work);
107
108 return 0;
109}
110
111static int dsa_slave_sync_uc(struct net_device *dev,
112 const unsigned char *addr)
113{
114 struct net_device *master = dsa_slave_to_master(dev);
115 struct dsa_port *dp = dsa_slave_to_port(dev);
116
117 dev_uc_add(master, addr);
118
119 if (!dsa_switch_supports_uc_filtering(dp->ds))
120 return 0;
121
114 return dsa_slave_schedule_standalone_work(dev, DSA_UC_ADD, addr, 0);
115}
116
117static int dsa_slave_unsync_uc(struct net_device *dev,
118 const unsigned char *addr)
119{
122 return dsa_slave_schedule_standalone_work(dev, DSA_UC_ADD, addr, 0);
123}
124
125static int dsa_slave_unsync_uc(struct net_device *dev,
126 const unsigned char *addr)
127{
128 struct net_device *master = dsa_slave_to_master(dev);
129 struct dsa_port *dp = dsa_slave_to_port(dev);
130
131 dev_uc_del(master, addr);
132
133 if (!dsa_switch_supports_uc_filtering(dp->ds))
134 return 0;
135
120 return dsa_slave_schedule_standalone_work(dev, DSA_UC_DEL, addr, 0);
121}
122
123static int dsa_slave_sync_mc(struct net_device *dev,
124 const unsigned char *addr)
125{
136 return dsa_slave_schedule_standalone_work(dev, DSA_UC_DEL, addr, 0);
137}
138
139static int dsa_slave_sync_mc(struct net_device *dev,
140 const unsigned char *addr)
141{
142 struct net_device *master = dsa_slave_to_master(dev);
143 struct dsa_port *dp = dsa_slave_to_port(dev);
144
145 dev_mc_add(master, addr);
146
147 if (!dsa_switch_supports_mc_filtering(dp->ds))
148 return 0;
149
126 return dsa_slave_schedule_standalone_work(dev, DSA_MC_ADD, addr, 0);
127}
128
129static int dsa_slave_unsync_mc(struct net_device *dev,
130 const unsigned char *addr)
131{
150 return dsa_slave_schedule_standalone_work(dev, DSA_MC_ADD, addr, 0);
151}
152
153static int dsa_slave_unsync_mc(struct net_device *dev,
154 const unsigned char *addr)
155{
156 struct net_device *master = dsa_slave_to_master(dev);
157 struct dsa_port *dp = dsa_slave_to_port(dev);
158
159 dev_mc_del(master, addr);
160
161 if (!dsa_switch_supports_mc_filtering(dp->ds))
162 return 0;
163
132 return dsa_slave_schedule_standalone_work(dev, DSA_MC_DEL, addr, 0);
133}
134
135/* slave mii_bus handling ***************************************************/
136static int dsa_slave_phy_read(struct mii_bus *bus, int addr, int reg)
137{
138 struct dsa_switch *ds = bus->priv;
139

--- 138 unchanged lines hidden (view full) ---

278
279 if (dsa_switch_supports_uc_filtering(ds) &&
280 dsa_switch_supports_mc_filtering(ds))
281 dsa_port_manage_cpu_flood(dp);
282}
283
284static void dsa_slave_set_rx_mode(struct net_device *dev)
285{
164 return dsa_slave_schedule_standalone_work(dev, DSA_MC_DEL, addr, 0);
165}
166
167/* slave mii_bus handling ***************************************************/
168static int dsa_slave_phy_read(struct mii_bus *bus, int addr, int reg)
169{
170 struct dsa_switch *ds = bus->priv;
171

--- 138 unchanged lines hidden (view full) ---

310
311 if (dsa_switch_supports_uc_filtering(ds) &&
312 dsa_switch_supports_mc_filtering(ds))
313 dsa_port_manage_cpu_flood(dp);
314}
315
316static void dsa_slave_set_rx_mode(struct net_device *dev)
317{
286 struct net_device *master = dsa_slave_to_master(dev);
287 struct dsa_port *dp = dsa_slave_to_port(dev);
288 struct dsa_switch *ds = dp->ds;
289
290 dev_mc_sync(master, dev);
291 dev_uc_sync(master, dev);
292 if (dsa_switch_supports_mc_filtering(ds))
293 __dev_mc_sync(dev, dsa_slave_sync_mc, dsa_slave_unsync_mc);
294 if (dsa_switch_supports_uc_filtering(ds))
295 __dev_uc_sync(dev, dsa_slave_sync_uc, dsa_slave_unsync_uc);
318 __dev_mc_sync(dev, dsa_slave_sync_mc, dsa_slave_unsync_mc);
319 __dev_uc_sync(dev, dsa_slave_sync_uc, dsa_slave_unsync_uc);
296}
297
298static int dsa_slave_set_mac_address(struct net_device *dev, void *a)
299{
300 struct net_device *master = dsa_slave_to_master(dev);
301 struct dsa_port *dp = dsa_slave_to_port(dev);
302 struct dsa_switch *ds = dp->ds;
303 struct sockaddr *addr = a;

--- 2734 unchanged lines hidden ---
320}
321
322static int dsa_slave_set_mac_address(struct net_device *dev, void *a)
323{
324 struct net_device *master = dsa_slave_to_master(dev);
325 struct dsa_port *dp = dsa_slave_to_port(dev);
326 struct dsa_switch *ds = dp->ds;
327 struct sockaddr *addr = a;

--- 2734 unchanged lines hidden ---