[RFC PATCH v2 2/3] net: ti: icssg-switch: Add switchdev based driver for ethernet switch support
Andrew Lunn
andrew at lunn.ch
Fri Jan 19 06:12:04 PST 2024
> +static int prueth_switchdev_stp_state_set(struct prueth_emac *emac,
> + u8 state)
> +{
> + enum icssg_port_state_cmd emac_state;
> + int ret = 0;
> +
> + switch (state) {
> + case BR_STATE_FORWARDING:
> + emac_state = ICSSG_EMAC_PORT_FORWARD;
> + break;
> + case BR_STATE_DISABLED:
> + emac_state = ICSSG_EMAC_PORT_DISABLE;
> + break;
> + case BR_STATE_LEARNING:
> + case BR_STATE_LISTENING:
> + case BR_STATE_BLOCKING:
> + emac_state = ICSSG_EMAC_PORT_BLOCK;
> + break;
That is unusual. Does it still learn while in BLOCK? It might be you
need to flush the FDB for this port when it changes from BLOCKING to
LISTENING or LEARNING?
> +static void prueth_switchdev_event_work(struct work_struct *work)
> +{
> + struct prueth_switchdev_event_work *switchdev_work =
> + container_of(work, struct prueth_switchdev_event_work, work);
> + struct prueth_emac *emac = switchdev_work->emac;
> + struct switchdev_notifier_fdb_info *fdb;
> + int port_id = emac->port_id;
> + int ret;
> +
> + rtnl_lock();
> + switch (switchdev_work->event) {
> + case SWITCHDEV_FDB_ADD_TO_DEVICE:
> + fdb = &switchdev_work->fdb_info;
> +
> + netdev_dbg(emac->ndev, "prueth_fdb_add: MACID = %pM vid = %u flags = %u %u -- port %d\n",
> + fdb->addr, fdb->vid, fdb->added_by_user,
> + fdb->offloaded, port_id);
> +
> + if (!fdb->added_by_user)
> + break;
> + if (memcmp(emac->mac_addr, (u8 *)fdb->addr, ETH_ALEN) == 0)
> + break;
ether_addr_equal(). Please review all the code and use these helpers
when possible.
So you don't add an FDB for the interfaces own MAC address? Does the
switch know the interfaces MAC address?
Andrew
More information about the linux-arm-kernel
mailing list