[PATCH net-next 2/3] net: sparx5: add support for tc flower mirred action.

Daniel Machon daniel.machon at microchip.com
Thu Apr 4 00:58:13 PDT 2024


> The 04/03/2024 20:41, Daniel Machon wrote:
> 
> Hi Daniel,
> 
> ...
> 
> > +static int sparx5_tc_action_mirred(struct vcap_admin *admin,
> > +				   struct vcap_rule *vrule,
> > +				   struct flow_cls_offload *fco,
> > +				   struct flow_action_entry *act)
> > +{
> > +	struct vcap_u72_action ports = {0};
> 
> Maybe this is just a preferences, but usually we use memset instead of {0};

Yes, I think this falls under preference. I'd like to keep this one as
is.

> 
> > +	int err;
> > +
> > +	if (admin->vtype != VCAP_TYPE_IS0 && admin->vtype != VCAP_TYPE_IS2) {
> > +		NL_SET_ERR_MSG_MOD(fco->common.extack,
> > +				   "Mirror action not supported in this VCAP");
> > +		return -EOPNOTSUPP;
> > +	}
> > +
> > +	err = vcap_rule_add_action_u32(vrule, VCAP_AF_MASK_MODE,
> > +				       SPX5_PMM_OR_DSTMASK);
> > +	if (err)
> > +		return err;
> > +
> > +	sparx5_tc_flower_set_port_mask(&ports, act->dev);
> > +
> > +	err = vcap_rule_add_action_u72(vrule, VCAP_AF_PORT_MASK, &ports);
> > +	if (err)
> > +		return err;
> 
> You can just return directly the return value from vcap_rule_add_action_u72
> Something like:
> 
> return vcap_rule_add_action_u72(...)
>

Yes, seems like a reasonable change :-) I need to respin anyway, since
NIPA is complaining about something I didn't catch in my local run. Will
incorporate changes in v2 - thanks.

> > +
> > +	return 0;
> > +}
> > -- 
> > 2.34.1
> > 
> 
> -- 
> /Horatiu



More information about the linux-arm-kernel mailing list