Re: [PATCH net-next 5/6] net: dsa: mv88e6xxx: CBS support

From: Cedric Jehasse

Date: Wed May 27 2026 - 05:35:25 EST


> +static int mv88e6xxx_qos_port_cbs_set(struct dsa_switch *ds, int port,
> + struct tc_cbs_qopt_offload *cbs_qopt)
> +{
> + struct mv88e6xxx_chip *chip = ds->priv;
> + int err;
> +
> + if (!dsa_is_user_port(ds, port))
> + return -EINVAL;
> +
> + if (cbs_qopt->queue >= chip->info->num_tx_queues) {
> + dev_err(ds->dev, "p%d: invalid AVB queue %d\n", port, cbs_qopt->queue);
> + return -EINVAL;
> + }
> +
> + mutex_lock(&chip->reg_lock);
> +
> + if (cbs_qopt->enable &&
> + !(chip->avb_tc_policy.port_mask & BIT(port))) {
> + err = -EOPNOTSUPP;
> + goto out;
> + }
> +
> + err = mv88e6xxx_qav_set_port_cbs_qopt(chip, port, cbs_qopt);
> + if (!err)
> + err = mv88e6xxx_avb_set_port_avb_mode(chip, port, cbs_qopt->enable);
> +

Why is the avb_mode set from the cbs setter?
avb_mode is an ingress setting that controls if frames are classified as
AVB frames. Cbs configures shaping on egress.
Eg. if an AVB stream is received on port 1 and is forwarded by the switch to
port 2. AvbMode needs to be set on port 1 and cbs is configured on port 2.