]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: dsa: remove cross-chip support for MRP
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 5 Jan 2022 13:18:12 +0000 (15:18 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Jan 2022 15:04:50 +0000 (15:04 +0000)
The cross-chip notifiers for MRP are bypass operations, meaning that
even though all switches in a tree are notified, only the switch
specified in the info structure is targeted.

We can eliminate the unnecessary complexity by deleting the cross-chip
notifier logic and calling the ds->ops straight from port.c.

Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa_priv.h
net/dsa/port.c
net/dsa/switch.c

index b5ae21f172a85d80ceb3499f1fb91aadc4778f58..c593d56c94b3b47c9e402dcd6297fd069e304fc7 100644 (file)
@@ -40,10 +40,6 @@ enum {
        DSA_NOTIFIER_TAG_PROTO,
        DSA_NOTIFIER_TAG_PROTO_CONNECT,
        DSA_NOTIFIER_TAG_PROTO_DISCONNECT,
-       DSA_NOTIFIER_MRP_ADD,
-       DSA_NOTIFIER_MRP_DEL,
-       DSA_NOTIFIER_MRP_ADD_RING_ROLE,
-       DSA_NOTIFIER_MRP_DEL_RING_ROLE,
        DSA_NOTIFIER_TAG_8021Q_VLAN_ADD,
        DSA_NOTIFIER_TAG_8021Q_VLAN_DEL,
 };
@@ -107,20 +103,6 @@ struct dsa_notifier_tag_proto_info {
        const struct dsa_device_ops *tag_ops;
 };
 
-/* DSA_NOTIFIER_MRP_* */
-struct dsa_notifier_mrp_info {
-       const struct switchdev_obj_mrp *mrp;
-       int sw_index;
-       int port;
-};
-
-/* DSA_NOTIFIER_MRP_* */
-struct dsa_notifier_mrp_ring_role_info {
-       const struct switchdev_obj_ring_role_mrp *mrp;
-       int sw_index;
-       int port;
-};
-
 /* DSA_NOTIFIER_TAG_8021Q_VLAN_* */
 struct dsa_notifier_tag_8021q_vlan_info {
        int tree_index;
index 05677e016982ffc58fd85137b6dafa674f581a36..05be4577b044194f642bda7e3035424da663fefd 100644 (file)
@@ -907,49 +907,45 @@ int dsa_port_vlan_del(struct dsa_port *dp,
 int dsa_port_mrp_add(const struct dsa_port *dp,
                     const struct switchdev_obj_mrp *mrp)
 {
-       struct dsa_notifier_mrp_info info = {
-               .sw_index = dp->ds->index,
-               .port = dp->index,
-               .mrp = mrp,
-       };
+       struct dsa_switch *ds = dp->ds;
+
+       if (!ds->ops->port_mrp_add)
+               return -EOPNOTSUPP;
 
-       return dsa_port_notify(dp, DSA_NOTIFIER_MRP_ADD, &info);
+       return ds->ops->port_mrp_add(ds, dp->index, mrp);
 }
 
 int dsa_port_mrp_del(const struct dsa_port *dp,
                     const struct switchdev_obj_mrp *mrp)
 {
-       struct dsa_notifier_mrp_info info = {
-               .sw_index = dp->ds->index,
-               .port = dp->index,
-               .mrp = mrp,
-       };
+       struct dsa_switch *ds = dp->ds;
+
+       if (!ds->ops->port_mrp_del)
+               return -EOPNOTSUPP;
 
-       return dsa_port_notify(dp, DSA_NOTIFIER_MRP_DEL, &info);
+       return ds->ops->port_mrp_del(ds, dp->index, mrp);
 }
 
 int dsa_port_mrp_add_ring_role(const struct dsa_port *dp,
                               const struct switchdev_obj_ring_role_mrp *mrp)
 {
-       struct dsa_notifier_mrp_ring_role_info info = {
-               .sw_index = dp->ds->index,
-               .port = dp->index,
-               .mrp = mrp,
-       };
+       struct dsa_switch *ds = dp->ds;
+
+       if (!ds->ops->port_mrp_add_ring_role)
+               return -EOPNOTSUPP;
 
-       return dsa_port_notify(dp, DSA_NOTIFIER_MRP_ADD_RING_ROLE, &info);
+       return ds->ops->port_mrp_add_ring_role(ds, dp->index, mrp);
 }
 
 int dsa_port_mrp_del_ring_role(const struct dsa_port *dp,
                               const struct switchdev_obj_ring_role_mrp *mrp)
 {
-       struct dsa_notifier_mrp_ring_role_info info = {
-               .sw_index = dp->ds->index,
-               .port = dp->index,
-               .mrp = mrp,
-       };
+       struct dsa_switch *ds = dp->ds;
+
+       if (!ds->ops->port_mrp_del_ring_role)
+               return -EOPNOTSUPP;
 
-       return dsa_port_notify(dp, DSA_NOTIFIER_MRP_DEL_RING_ROLE, &info);
+       return ds->ops->port_mrp_del_ring_role(ds, dp->index, mrp);
 }
 
 void dsa_port_set_tag_protocol(struct dsa_port *cpu_dp,
index 260d8e7d6e5a1df12efd13c3d52910383969cd0c..a164ec02b4e96c456991196874ee46b0b24bf499 100644 (file)
@@ -701,58 +701,6 @@ dsa_switch_disconnect_tag_proto(struct dsa_switch *ds,
        return 0;
 }
 
-static int dsa_switch_mrp_add(struct dsa_switch *ds,
-                             struct dsa_notifier_mrp_info *info)
-{
-       if (!ds->ops->port_mrp_add)
-               return -EOPNOTSUPP;
-
-       if (ds->index == info->sw_index)
-               return ds->ops->port_mrp_add(ds, info->port, info->mrp);
-
-       return 0;
-}
-
-static int dsa_switch_mrp_del(struct dsa_switch *ds,
-                             struct dsa_notifier_mrp_info *info)
-{
-       if (!ds->ops->port_mrp_del)
-               return -EOPNOTSUPP;
-
-       if (ds->index == info->sw_index)
-               return ds->ops->port_mrp_del(ds, info->port, info->mrp);
-
-       return 0;
-}
-
-static int
-dsa_switch_mrp_add_ring_role(struct dsa_switch *ds,
-                            struct dsa_notifier_mrp_ring_role_info *info)
-{
-       if (!ds->ops->port_mrp_add_ring_role)
-               return -EOPNOTSUPP;
-
-       if (ds->index == info->sw_index)
-               return ds->ops->port_mrp_add_ring_role(ds, info->port,
-                                                      info->mrp);
-
-       return 0;
-}
-
-static int
-dsa_switch_mrp_del_ring_role(struct dsa_switch *ds,
-                            struct dsa_notifier_mrp_ring_role_info *info)
-{
-       if (!ds->ops->port_mrp_del_ring_role)
-               return -EOPNOTSUPP;
-
-       if (ds->index == info->sw_index)
-               return ds->ops->port_mrp_del_ring_role(ds, info->port,
-                                                      info->mrp);
-
-       return 0;
-}
-
 static int dsa_switch_event(struct notifier_block *nb,
                            unsigned long event, void *info)
 {
@@ -826,18 +774,6 @@ static int dsa_switch_event(struct notifier_block *nb,
        case DSA_NOTIFIER_TAG_PROTO_DISCONNECT:
                err = dsa_switch_disconnect_tag_proto(ds, info);
                break;
-       case DSA_NOTIFIER_MRP_ADD:
-               err = dsa_switch_mrp_add(ds, info);
-               break;
-       case DSA_NOTIFIER_MRP_DEL:
-               err = dsa_switch_mrp_del(ds, info);
-               break;
-       case DSA_NOTIFIER_MRP_ADD_RING_ROLE:
-               err = dsa_switch_mrp_add_ring_role(ds, info);
-               break;
-       case DSA_NOTIFIER_MRP_DEL_RING_ROLE:
-               err = dsa_switch_mrp_del_ring_role(ds, info);
-               break;
        case DSA_NOTIFIER_TAG_8021Q_VLAN_ADD:
                err = dsa_switch_tag_8021q_vlan_add(ds, info);
                break;