Skip to content

Commit 26ee7b0

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: install the host MDB and FDB entries in the master's RX filter
If the DSA master implements strict address filtering, then the unicast and multicast addresses kept by the DSA CPU ports should be synchronized with the address lists of the DSA master. Note that we want the synchronization of the master's address lists even if the DSA switch doesn't support unicast/multicast database operations, on the premises that the packets will be flooded to the CPU in that case, and we should still instruct the master to receive them. This is why we do the dev_uc_add() etc first, even if dsa_port_notify() returns -EOPNOTSUPP. In turn, dev_uc_add() and friends return error only if memory allocation fails, so it is probably ok to check and propagate that error code and not just ignore it. Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3f6e32f commit 26ee7b0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

net/dsa/port.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,12 @@ int dsa_port_host_fdb_add(struct dsa_port *dp, const unsigned char *addr,
655655
.addr = addr,
656656
.vid = vid,
657657
};
658+
struct dsa_port *cpu_dp = dp->cpu_dp;
659+
int err;
660+
661+
err = dev_uc_add(cpu_dp->master, addr);
662+
if (err)
663+
return err;
658664

659665
return dsa_port_notify(dp, DSA_NOTIFIER_HOST_FDB_ADD, &info);
660666
}
@@ -668,6 +674,12 @@ int dsa_port_host_fdb_del(struct dsa_port *dp, const unsigned char *addr,
668674
.addr = addr,
669675
.vid = vid,
670676
};
677+
struct dsa_port *cpu_dp = dp->cpu_dp;
678+
int err;
679+
680+
err = dev_uc_del(cpu_dp->master, addr);
681+
if (err)
682+
return err;
671683

672684
return dsa_port_notify(dp, DSA_NOTIFIER_HOST_FDB_DEL, &info);
673685
}
@@ -715,6 +727,12 @@ int dsa_port_host_mdb_add(const struct dsa_port *dp,
715727
.port = dp->index,
716728
.mdb = mdb,
717729
};
730+
struct dsa_port *cpu_dp = dp->cpu_dp;
731+
int err;
732+
733+
err = dev_mc_add(cpu_dp->master, mdb->addr);
734+
if (err)
735+
return err;
718736

719737
return dsa_port_notify(dp, DSA_NOTIFIER_HOST_MDB_ADD, &info);
720738
}
@@ -727,6 +745,12 @@ int dsa_port_host_mdb_del(const struct dsa_port *dp,
727745
.port = dp->index,
728746
.mdb = mdb,
729747
};
748+
struct dsa_port *cpu_dp = dp->cpu_dp;
749+
int err;
750+
751+
err = dev_mc_del(cpu_dp->master, mdb->addr);
752+
if (err)
753+
return err;
730754

731755
return dsa_port_notify(dp, DSA_NOTIFIER_HOST_MDB_DEL, &info);
732756
}

0 commit comments

Comments
 (0)