net: dsa: pass extack to dsa_switch_ops :: port_mirror_add()
Drivers might have error messages to propagate to user space, most common being that they support a single mirror port. Propagate the netlink extack so that they can inform user space in a verbal way of their limitations. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
f2a0e216be
commit
0148bb50b8
@@ -2110,7 +2110,8 @@ out:
|
|||||||
EXPORT_SYMBOL(b53_get_tag_protocol);
|
EXPORT_SYMBOL(b53_get_tag_protocol);
|
||||||
|
|
||||||
int b53_mirror_add(struct dsa_switch *ds, int port,
|
int b53_mirror_add(struct dsa_switch *ds, int port,
|
||||||
struct dsa_mall_mirror_tc_entry *mirror, bool ingress)
|
struct dsa_mall_mirror_tc_entry *mirror, bool ingress,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct b53_device *dev = ds->priv;
|
struct b53_device *dev = ds->priv;
|
||||||
u16 reg, loc;
|
u16 reg, loc;
|
||||||
|
|||||||
@@ -373,7 +373,8 @@ int b53_mdb_del(struct dsa_switch *ds, int port,
|
|||||||
const struct switchdev_obj_port_mdb *mdb,
|
const struct switchdev_obj_port_mdb *mdb,
|
||||||
struct dsa_db db);
|
struct dsa_db db);
|
||||||
int b53_mirror_add(struct dsa_switch *ds, int port,
|
int b53_mirror_add(struct dsa_switch *ds, int port,
|
||||||
struct dsa_mall_mirror_tc_entry *mirror, bool ingress);
|
struct dsa_mall_mirror_tc_entry *mirror, bool ingress,
|
||||||
|
struct netlink_ext_ack *extack);
|
||||||
enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
|
enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
|
||||||
enum dsa_tag_protocol mprot);
|
enum dsa_tag_protocol mprot);
|
||||||
void b53_mirror_del(struct dsa_switch *ds, int port,
|
void b53_mirror_del(struct dsa_switch *ds, int port,
|
||||||
|
|||||||
@@ -1233,7 +1233,7 @@ static int ksz8_port_vlan_del(struct dsa_switch *ds, int port,
|
|||||||
|
|
||||||
static int ksz8_port_mirror_add(struct dsa_switch *ds, int port,
|
static int ksz8_port_mirror_add(struct dsa_switch *ds, int port,
|
||||||
struct dsa_mall_mirror_tc_entry *mirror,
|
struct dsa_mall_mirror_tc_entry *mirror,
|
||||||
bool ingress)
|
bool ingress, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct ksz_device *dev = ds->priv;
|
struct ksz_device *dev = ds->priv;
|
||||||
|
|
||||||
|
|||||||
@@ -1018,7 +1018,7 @@ exit:
|
|||||||
|
|
||||||
static int ksz9477_port_mirror_add(struct dsa_switch *ds, int port,
|
static int ksz9477_port_mirror_add(struct dsa_switch *ds, int port,
|
||||||
struct dsa_mall_mirror_tc_entry *mirror,
|
struct dsa_mall_mirror_tc_entry *mirror,
|
||||||
bool ingress)
|
bool ingress, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct ksz_device *dev = ds->priv;
|
struct ksz_device *dev = ds->priv;
|
||||||
|
|
||||||
|
|||||||
@@ -1714,7 +1714,7 @@ static int mt753x_mirror_port_set(unsigned int id, u32 val)
|
|||||||
|
|
||||||
static int mt753x_port_mirror_add(struct dsa_switch *ds, int port,
|
static int mt753x_port_mirror_add(struct dsa_switch *ds, int port,
|
||||||
struct dsa_mall_mirror_tc_entry *mirror,
|
struct dsa_mall_mirror_tc_entry *mirror,
|
||||||
bool ingress)
|
bool ingress, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct mt7530_priv *priv = ds->priv;
|
struct mt7530_priv *priv = ds->priv;
|
||||||
int monitor_port;
|
int monitor_port;
|
||||||
|
|||||||
@@ -6321,7 +6321,8 @@ static int mv88e6xxx_port_mdb_del(struct dsa_switch *ds, int port,
|
|||||||
|
|
||||||
static int mv88e6xxx_port_mirror_add(struct dsa_switch *ds, int port,
|
static int mv88e6xxx_port_mirror_add(struct dsa_switch *ds, int port,
|
||||||
struct dsa_mall_mirror_tc_entry *mirror,
|
struct dsa_mall_mirror_tc_entry *mirror,
|
||||||
bool ingress)
|
bool ingress,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
enum mv88e6xxx_egress_direction direction = ingress ?
|
enum mv88e6xxx_egress_direction direction = ingress ?
|
||||||
MV88E6XXX_EGRESS_DIR_INGRESS :
|
MV88E6XXX_EGRESS_DIR_INGRESS :
|
||||||
|
|||||||
@@ -2473,7 +2473,7 @@ qca8k_port_mdb_del(struct dsa_switch *ds, int port,
|
|||||||
static int
|
static int
|
||||||
qca8k_port_mirror_add(struct dsa_switch *ds, int port,
|
qca8k_port_mirror_add(struct dsa_switch *ds, int port,
|
||||||
struct dsa_mall_mirror_tc_entry *mirror,
|
struct dsa_mall_mirror_tc_entry *mirror,
|
||||||
bool ingress)
|
bool ingress, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct qca8k_priv *priv = ds->priv;
|
struct qca8k_priv *priv = ds->priv;
|
||||||
int monitor_port, ret;
|
int monitor_port, ret;
|
||||||
|
|||||||
@@ -2847,7 +2847,7 @@ static int sja1105_mirror_apply(struct sja1105_private *priv, int from, int to,
|
|||||||
|
|
||||||
static int sja1105_mirror_add(struct dsa_switch *ds, int port,
|
static int sja1105_mirror_add(struct dsa_switch *ds, int port,
|
||||||
struct dsa_mall_mirror_tc_entry *mirror,
|
struct dsa_mall_mirror_tc_entry *mirror,
|
||||||
bool ingress)
|
bool ingress, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
return sja1105_mirror_apply(ds->priv, port, mirror->to_local_port,
|
return sja1105_mirror_apply(ds->priv, port, mirror->to_local_port,
|
||||||
ingress, true);
|
ingress, true);
|
||||||
|
|||||||
@@ -1028,7 +1028,7 @@ struct dsa_switch_ops {
|
|||||||
struct flow_cls_offload *cls, bool ingress);
|
struct flow_cls_offload *cls, bool ingress);
|
||||||
int (*port_mirror_add)(struct dsa_switch *ds, int port,
|
int (*port_mirror_add)(struct dsa_switch *ds, int port,
|
||||||
struct dsa_mall_mirror_tc_entry *mirror,
|
struct dsa_mall_mirror_tc_entry *mirror,
|
||||||
bool ingress);
|
bool ingress, struct netlink_ext_ack *extack);
|
||||||
void (*port_mirror_del)(struct dsa_switch *ds, int port,
|
void (*port_mirror_del)(struct dsa_switch *ds, int port,
|
||||||
struct dsa_mall_mirror_tc_entry *mirror);
|
struct dsa_mall_mirror_tc_entry *mirror);
|
||||||
int (*port_policer_add)(struct dsa_switch *ds, int port,
|
int (*port_policer_add)(struct dsa_switch *ds, int port,
|
||||||
|
|||||||
@@ -1173,6 +1173,7 @@ dsa_slave_add_cls_matchall_mirred(struct net_device *dev,
|
|||||||
struct tc_cls_matchall_offload *cls,
|
struct tc_cls_matchall_offload *cls,
|
||||||
bool ingress)
|
bool ingress)
|
||||||
{
|
{
|
||||||
|
struct netlink_ext_ack *extack = cls->common.extack;
|
||||||
struct dsa_port *dp = dsa_slave_to_port(dev);
|
struct dsa_port *dp = dsa_slave_to_port(dev);
|
||||||
struct dsa_slave_priv *p = netdev_priv(dev);
|
struct dsa_slave_priv *p = netdev_priv(dev);
|
||||||
struct dsa_mall_mirror_tc_entry *mirror;
|
struct dsa_mall_mirror_tc_entry *mirror;
|
||||||
@@ -1210,7 +1211,7 @@ dsa_slave_add_cls_matchall_mirred(struct net_device *dev,
|
|||||||
mirror->to_local_port = to_dp->index;
|
mirror->to_local_port = to_dp->index;
|
||||||
mirror->ingress = ingress;
|
mirror->ingress = ingress;
|
||||||
|
|
||||||
err = ds->ops->port_mirror_add(ds, dp->index, mirror, ingress);
|
err = ds->ops->port_mirror_add(ds, dp->index, mirror, ingress, extack);
|
||||||
if (err) {
|
if (err) {
|
||||||
kfree(mall_tc_entry);
|
kfree(mall_tc_entry);
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
Reference in New Issue
Block a user