Message ID | 20210216214205.32385-9-horatiu.vultur@microchip.com (mailing list archive) |
---|---|
State | Accepted |
Commit | a026c50b599fab8ad829f87af372866e229d8175 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | bridge: mrp: Extend br_mrp_switchdev_* | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 10 of 10 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 76 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
On Tue, Feb 16, 2021 at 10:42:05PM +0100, Horatiu Vultur wrote: > @@ -112,6 +113,7 @@ static struct sk_buff *ocelot_rcv(struct sk_buff *skb, > ocelot_xfh_get_qos_class(extraction, &qos_class); > ocelot_xfh_get_tag_type(extraction, &tag_type); > ocelot_xfh_get_vlan_tci(extraction, &vlan_tci); > + ocelot_xfh_get_cpuq(extraction, &cpuq); > > skb->dev = dsa_master_find_slave(netdev, 0, src_port); > if (!skb->dev) > @@ -126,6 +128,12 @@ static struct sk_buff *ocelot_rcv(struct sk_buff *skb, > skb->offload_fwd_mark = 1; > skb->priority = qos_class; > > +#if IS_ENABLED(CONFIG_BRIDGE_MRP) > + if (eth_hdr(skb)->h_proto == cpu_to_be16(ETH_P_MRP) && > + cpuq & BIT(OCELOT_MRP_CPUQ)) Checking the EtherType seems redundant, since those are the only frames trapped to the MRP CPU queue. Also, the cpuq variable is potentially unused when CONFIG_BRIDGE_MRP is unset. I'm concerned that static analysis people may come in and try to fix it up with even more ifdeffery, which is definitely not what I would like to go for. How about just the following, which is not conditionally compiled: if (!(cpuq & BIT(OCELOT_MRP_CPUQ))) skb->offload_fwd_mark = 1; > + skb->offload_fwd_mark = 0; > +#endif > + > /* Ocelot switches copy frames unmodified to the CPU. However, it is > * possible for the user to request a VLAN modification through > * VCAP_IS1_ACT_VID_REPLACE_ENA. In this case, what will happen is that > -- > 2.27.0 >
diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 800f27d65c6c..fa1c3f14bb88 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1561,6 +1561,40 @@ static int felix_sb_occ_tc_port_bind_get(struct dsa_switch *ds, int port, pool_type, p_cur, p_max); } +static int felix_mrp_add(struct dsa_switch *ds, int port, + const struct switchdev_obj_mrp *mrp) +{ + struct ocelot *ocelot = ds->priv; + + return ocelot_mrp_add(ocelot, port, mrp); +} + +static int felix_mrp_del(struct dsa_switch *ds, int port, + const struct switchdev_obj_mrp *mrp) +{ + struct ocelot *ocelot = ds->priv; + + return ocelot_mrp_add(ocelot, port, mrp); +} + +static int +felix_mrp_add_ring_role(struct dsa_switch *ds, int port, + const struct switchdev_obj_ring_role_mrp *mrp) +{ + struct ocelot *ocelot = ds->priv; + + return ocelot_mrp_add_ring_role(ocelot, port, mrp); +} + +static int +felix_mrp_del_ring_role(struct dsa_switch *ds, int port, + const struct switchdev_obj_ring_role_mrp *mrp) +{ + struct ocelot *ocelot = ds->priv; + + return ocelot_mrp_del_ring_role(ocelot, port, mrp); +} + const struct dsa_switch_ops felix_switch_ops = { .get_tag_protocol = felix_get_tag_protocol, .change_tag_protocol = felix_change_tag_protocol, @@ -1615,6 +1649,10 @@ const struct dsa_switch_ops felix_switch_ops = { .devlink_sb_occ_max_clear = felix_sb_occ_max_clear, .devlink_sb_occ_port_pool_get = felix_sb_occ_port_pool_get, .devlink_sb_occ_tc_port_bind_get= felix_sb_occ_tc_port_bind_get, + .port_mrp_add = felix_mrp_add, + .port_mrp_del = felix_mrp_del, + .port_mrp_add_ring_role = felix_mrp_add_ring_role, + .port_mrp_del_ring_role = felix_mrp_del_ring_role, }; struct net_device *felix_port_to_netdev(struct ocelot *ocelot, int port) diff --git a/net/dsa/tag_ocelot.c b/net/dsa/tag_ocelot.c index f9df9cac81c5..743809b5806b 100644 --- a/net/dsa/tag_ocelot.c +++ b/net/dsa/tag_ocelot.c @@ -83,6 +83,7 @@ static struct sk_buff *ocelot_rcv(struct sk_buff *skb, struct dsa_port *dp; u8 *extraction; u16 vlan_tpid; + u64 cpuq; /* Revert skb->data by the amount consumed by the DSA master, * so it points to the beginning of the frame. @@ -112,6 +113,7 @@ static struct sk_buff *ocelot_rcv(struct sk_buff *skb, ocelot_xfh_get_qos_class(extraction, &qos_class); ocelot_xfh_get_tag_type(extraction, &tag_type); ocelot_xfh_get_vlan_tci(extraction, &vlan_tci); + ocelot_xfh_get_cpuq(extraction, &cpuq); skb->dev = dsa_master_find_slave(netdev, 0, src_port); if (!skb->dev) @@ -126,6 +128,12 @@ static struct sk_buff *ocelot_rcv(struct sk_buff *skb, skb->offload_fwd_mark = 1; skb->priority = qos_class; +#if IS_ENABLED(CONFIG_BRIDGE_MRP) + if (eth_hdr(skb)->h_proto == cpu_to_be16(ETH_P_MRP) && + cpuq & BIT(OCELOT_MRP_CPUQ)) + skb->offload_fwd_mark = 0; +#endif + /* Ocelot switches copy frames unmodified to the CPU. However, it is * possible for the user to request a VLAN modification through * VCAP_IS1_ACT_VID_REPLACE_ENA. In this case, what will happen is that
Implement functions 'port_mrp_add', 'port_mrp_del', 'port_mrp_add_ring_role' and 'port_mrp_del_ring_role' to call the mrp functions from ocelot. Also all MRP frames that arrive to CPU on queue number OCELOT_MRP_CPUQ will be forward by the SW. Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> --- drivers/net/dsa/ocelot/felix.c | 38 ++++++++++++++++++++++++++++++++++ net/dsa/tag_ocelot.c | 8 +++++++ 2 files changed, 46 insertions(+)