Skip to content

Commit 50099c4

Browse files
committed
Merge: CNB101: ndo_fdb_add: Add a parameter to report whether notification was sent
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/509 JIRA: https://issues.redhat.com/browse/RHEL-78790 Signed-off-by: Izabela Bakollari <ibakolla@redhat.com> Approved-by: José Ignacio Tornos Martínez <jtornosm@redhat.com> Approved-by: Ivan Vecera <ivecera@redhat.com> Merged-by: Julio Faracco <jfaracco@redhat.com>
2 parents 3162dd5 + d881c3a commit 50099c4

29 files changed

+419
-267
lines changed

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13173,12 +13173,13 @@ static int i40e_get_phys_port_id(struct net_device *netdev,
1317313173
* @addr: the MAC address entry being added
1317413174
* @vid: VLAN ID
1317513175
* @flags: instructions from stack about fdb operation
13176+
* @notified: whether notification was emitted
1317613177
* @extack: netlink extended ack, unused currently
1317713178
*/
1317813179
static int i40e_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
1317913180
struct net_device *dev,
1318013181
const unsigned char *addr, u16 vid,
13181-
u16 flags,
13182+
u16 flags, bool *notified,
1318213183
struct netlink_ext_ack *extack)
1318313184
{
1318413185
struct i40e_netdev_priv *np = netdev_priv(dev);

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6079,12 +6079,14 @@ ice_set_tx_maxrate(struct net_device *netdev, int queue_index, u32 maxrate)
60796079
* @addr: the MAC address entry being added
60806080
* @vid: VLAN ID
60816081
* @flags: instructions from stack about fdb operation
6082+
* @notified: whether notification was emitted
60826083
* @extack: netlink extended ack
60836084
*/
60846085
static int
60856086
ice_fdb_add(struct ndmsg *ndm, struct nlattr __always_unused *tb[],
60866087
struct net_device *dev, const unsigned char *addr, u16 vid,
6087-
u16 flags, struct netlink_ext_ack __always_unused *extack)
6088+
u16 flags, bool *notified,
6089+
struct netlink_ext_ack __always_unused *extack)
60886090
{
60896091
int err;
60906092

@@ -6118,12 +6120,14 @@ ice_fdb_add(struct ndmsg *ndm, struct nlattr __always_unused *tb[],
61186120
* @dev: the net device pointer
61196121
* @addr: the MAC address entry being added
61206122
* @vid: VLAN ID
6123+
* @notified: whether notification was emitted
61216124
* @extack: netlink extended ack
61226125
*/
61236126
static int
61246127
ice_fdb_del(struct ndmsg *ndm, __always_unused struct nlattr *tb[],
61256128
struct net_device *dev, const unsigned char *addr,
6126-
__always_unused u16 vid, struct netlink_ext_ack *extack)
6129+
__always_unused u16 vid, bool *notified,
6130+
struct netlink_ext_ack *extack)
61276131
{
61286132
int err;
61296133

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2490,7 +2490,7 @@ static int igb_set_features(struct net_device *netdev,
24902490
static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
24912491
struct net_device *dev,
24922492
const unsigned char *addr, u16 vid,
2493-
u16 flags,
2493+
u16 flags, bool *notified,
24942494
struct netlink_ext_ack *extack)
24952495
{
24962496
/* guarantee we can provide a unique filter for the unicast address */

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9954,7 +9954,7 @@ static int ixgbe_set_features(struct net_device *netdev,
99549954
static int ixgbe_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
99559955
struct net_device *dev,
99569956
const unsigned char *addr, u16 vid,
9957-
u16 flags,
9957+
u16 flags, bool *notified,
99589958
struct netlink_ext_ack *extack)
99599959
{
99609960
/* guarantee we can provide a unique filter for the unicast address */

drivers/net/ethernet/mscc/ocelot_net.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ static void ocelot_get_stats64(struct net_device *dev,
730730
static int ocelot_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
731731
struct net_device *dev,
732732
const unsigned char *addr,
733-
u16 vid, u16 flags,
733+
u16 vid, u16 flags, bool *notified,
734734
struct netlink_ext_ack *extack)
735735
{
736736
struct ocelot_port_private *priv = netdev_priv(dev);
@@ -744,7 +744,7 @@ static int ocelot_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
744744
static int ocelot_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
745745
struct net_device *dev,
746746
const unsigned char *addr, u16 vid,
747-
struct netlink_ext_ack *extack)
747+
bool *notified, struct netlink_ext_ack *extack)
748748
{
749749
struct ocelot_port_private *priv = netdev_priv(dev);
750750
struct ocelot_port *ocelot_port = &priv->port;

drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ static int qlcnic_set_mac(struct net_device *netdev, void *p)
367367

368368
static int qlcnic_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
369369
struct net_device *netdev,
370-
const unsigned char *addr, u16 vid,
370+
const unsigned char *addr, u16 vid, bool *notified,
371371
struct netlink_ext_ack *extack)
372372
{
373373
struct qlcnic_adapter *adapter = netdev_priv(netdev);
@@ -394,7 +394,7 @@ static int qlcnic_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
394394
static int qlcnic_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
395395
struct net_device *netdev,
396396
const unsigned char *addr, u16 vid, u16 flags,
397-
struct netlink_ext_ack *extack)
397+
bool *notified, struct netlink_ext_ack *extack)
398398
{
399399
struct qlcnic_adapter *adapter = netdev_priv(netdev);
400400
int err = 0;

drivers/net/macvlan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ static int macvlan_vlan_rx_kill_vid(struct net_device *dev,
10241024
static int macvlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
10251025
struct net_device *dev,
10261026
const unsigned char *addr, u16 vid,
1027-
u16 flags,
1027+
u16 flags, bool *notified,
10281028
struct netlink_ext_ack *extack)
10291029
{
10301030
struct macvlan_dev *vlan = netdev_priv(dev);
@@ -1049,7 +1049,7 @@ static int macvlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
10491049

10501050
static int macvlan_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
10511051
struct net_device *dev,
1052-
const unsigned char *addr, u16 vid,
1052+
const unsigned char *addr, u16 vid, bool *notified,
10531053
struct netlink_ext_ack *extack)
10541054
{
10551055
struct macvlan_dev *vlan = netdev_priv(dev);

drivers/net/vxlan/vxlan_core.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,7 +1244,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,
12441244
static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
12451245
struct net_device *dev,
12461246
const unsigned char *addr, u16 vid, u16 flags,
1247-
struct netlink_ext_ack *extack)
1247+
bool *notified, struct netlink_ext_ack *extack)
12481248
{
12491249
struct vxlan_dev *vxlan = netdev_priv(dev);
12501250
/* struct net *net = dev_net(vxlan->dev); */
@@ -1280,6 +1280,9 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
12801280
nhid, true, extack);
12811281
spin_unlock_bh(&vxlan->hash_lock[hash_index]);
12821282

1283+
if (!err)
1284+
*notified = true;
1285+
12831286
return err;
12841287
}
12851288

@@ -1319,7 +1322,7 @@ int __vxlan_fdb_delete(struct vxlan_dev *vxlan,
13191322
/* Delete entry (via netlink) */
13201323
static int vxlan_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
13211324
struct net_device *dev,
1322-
const unsigned char *addr, u16 vid,
1325+
const unsigned char *addr, u16 vid, bool *notified,
13231326
struct netlink_ext_ack *extack)
13241327
{
13251328
struct vxlan_dev *vxlan = netdev_priv(dev);
@@ -1341,6 +1344,9 @@ static int vxlan_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
13411344
true);
13421345
spin_unlock_bh(&vxlan->hash_lock[hash_index]);
13431346

1347+
if (!err)
1348+
*notified = true;
1349+
13441350
return err;
13451351
}
13461352

include/linux/netdevice.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,12 +1245,17 @@ struct netdev_net_notifier {
12451245
* int (*ndo_fdb_add)(struct ndmsg *ndm, struct nlattr *tb[],
12461246
* struct net_device *dev,
12471247
* const unsigned char *addr, u16 vid, u16 flags,
1248-
* struct netlink_ext_ack *extack);
1248+
* bool *notified, struct netlink_ext_ack *extack);
12491249
* Adds an FDB entry to dev for addr.
1250+
* Callee shall set *notified to true if it sent any appropriate
1251+
* notification(s). Otherwise core will send a generic one.
12501252
* int (*ndo_fdb_del)(struct ndmsg *ndm, struct nlattr *tb[],
12511253
* struct net_device *dev,
1252-
* const unsigned char *addr, u16 vid)
1254+
* const unsigned char *addr, u16 vid
1255+
* bool *notified, struct netlink_ext_ack *extack);
12531256
* Deletes the FDB entry from dev corresponding to addr.
1257+
* Callee shall set *notified to true if it sent any appropriate
1258+
* notification(s). Otherwise core will send a generic one.
12541259
* int (*ndo_fdb_del_bulk)(struct nlmsghdr *nlh, struct net_device *dev,
12551260
* struct netlink_ext_ack *extack);
12561261
* int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
@@ -1523,12 +1528,15 @@ struct net_device_ops {
15231528
const unsigned char *addr,
15241529
u16 vid,
15251530
u16 flags,
1531+
bool *notified,
15261532
struct netlink_ext_ack *extack);
15271533
int (*ndo_fdb_del)(struct ndmsg *ndm,
15281534
struct nlattr *tb[],
15291535
struct net_device *dev,
15301536
const unsigned char *addr,
1531-
u16 vid, struct netlink_ext_ack *extack);
1537+
u16 vid,
1538+
bool *notified,
1539+
struct netlink_ext_ack *extack);
15321540
int (*ndo_fdb_del_bulk)(struct nlmsghdr *nlh,
15331541
struct net_device *dev,
15341542
struct netlink_ext_ack *extack);

net/bridge/br_fdb.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source,
11591159
static int __br_fdb_add(struct ndmsg *ndm, struct net_bridge *br,
11601160
struct net_bridge_port *p, const unsigned char *addr,
11611161
u16 nlh_flags, u16 vid, struct nlattr *nfea_tb[],
1162-
struct netlink_ext_ack *extack)
1162+
bool *notified, struct netlink_ext_ack *extack)
11631163
{
11641164
int err = 0;
11651165

@@ -1190,6 +1190,8 @@ static int __br_fdb_add(struct ndmsg *ndm, struct net_bridge *br,
11901190
spin_unlock_bh(&br->hash_lock);
11911191
}
11921192

1193+
if (!err)
1194+
*notified = true;
11931195
return err;
11941196
}
11951197

@@ -1202,7 +1204,7 @@ static const struct nla_policy br_nda_fdb_pol[NFEA_MAX + 1] = {
12021204
int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
12031205
struct net_device *dev,
12041206
const unsigned char *addr, u16 vid, u16 nlh_flags,
1205-
struct netlink_ext_ack *extack)
1207+
bool *notified, struct netlink_ext_ack *extack)
12061208
{
12071209
struct nlattr *nfea_tb[NFEA_MAX + 1], *attr;
12081210
struct net_bridge_vlan_group *vg;
@@ -1265,10 +1267,10 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
12651267

12661268
/* VID was specified, so use it. */
12671269
err = __br_fdb_add(ndm, br, p, addr, nlh_flags, vid, nfea_tb,
1268-
extack);
1270+
notified, extack);
12691271
} else {
12701272
err = __br_fdb_add(ndm, br, p, addr, nlh_flags, 0, nfea_tb,
1271-
extack);
1273+
notified, extack);
12721274
if (err || !vg || !vg->num_vlans)
12731275
goto out;
12741276

@@ -1280,7 +1282,7 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
12801282
if (!br_vlan_should_use(v))
12811283
continue;
12821284
err = __br_fdb_add(ndm, br, p, addr, nlh_flags, v->vid,
1283-
nfea_tb, extack);
1285+
nfea_tb, notified, extack);
12841286
if (err)
12851287
goto out;
12861288
}
@@ -1292,7 +1294,7 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
12921294

12931295
static int fdb_delete_by_addr_and_port(struct net_bridge *br,
12941296
const struct net_bridge_port *p,
1295-
const u8 *addr, u16 vlan)
1297+
const u8 *addr, u16 vlan, bool *notified)
12961298
{
12971299
struct net_bridge_fdb_entry *fdb;
12981300

@@ -1301,18 +1303,19 @@ static int fdb_delete_by_addr_and_port(struct net_bridge *br,
13011303
return -ENOENT;
13021304

13031305
fdb_delete(br, fdb, true);
1306+
*notified = true;
13041307

13051308
return 0;
13061309
}
13071310

13081311
static int __br_fdb_delete(struct net_bridge *br,
13091312
const struct net_bridge_port *p,
1310-
const unsigned char *addr, u16 vid)
1313+
const unsigned char *addr, u16 vid, bool *notified)
13111314
{
13121315
int err;
13131316

13141317
spin_lock_bh(&br->hash_lock);
1315-
err = fdb_delete_by_addr_and_port(br, p, addr, vid);
1318+
err = fdb_delete_by_addr_and_port(br, p, addr, vid, notified);
13161319
spin_unlock_bh(&br->hash_lock);
13171320

13181321
return err;
@@ -1321,7 +1324,7 @@ static int __br_fdb_delete(struct net_bridge *br,
13211324
/* Remove neighbor entry with RTM_DELNEIGH */
13221325
int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
13231326
struct net_device *dev,
1324-
const unsigned char *addr, u16 vid,
1327+
const unsigned char *addr, u16 vid, bool *notified,
13251328
struct netlink_ext_ack *extack)
13261329
{
13271330
struct net_bridge_vlan_group *vg;
@@ -1351,17 +1354,17 @@ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
13511354
return -EINVAL;
13521355
}
13531356

1354-
err = __br_fdb_delete(br, p, addr, vid);
1357+
err = __br_fdb_delete(br, p, addr, vid, notified);
13551358
} else {
13561359
err = -ENOENT;
1357-
err &= __br_fdb_delete(br, p, addr, 0);
1360+
err &= __br_fdb_delete(br, p, addr, 0, notified);
13581361
if (!vg || !vg->num_vlans)
13591362
return err;
13601363

13611364
list_for_each_entry(v, &vg->vlan_list, vlist) {
13621365
if (!br_vlan_should_use(v))
13631366
continue;
1364-
err &= __br_fdb_delete(br, p, addr, v->vid);
1367+
err &= __br_fdb_delete(br, p, addr, v->vid, notified);
13651368
}
13661369
}
13671370

0 commit comments

Comments
 (0)