Re: [net-next PATCH V3 4/4] octeontx2-pf: Add support for HTB offload

From: Paolo Abeni
Date: Tue Feb 07 2023 - 07:49:19 EST


On Mon, 2023-02-06 at 11:16 +0530, Hariprasad Kelam wrote:
> +static int otx2_qos_txschq_alloc(struct otx2_nic *pfvf,
> + struct otx2_qos_cfg *cfg)
> +{
> + struct nix_txsch_alloc_req *req;
> + struct nix_txsch_alloc_rsp *rsp;
> + struct mbox *mbox = &pfvf->mbox;
> + int lvl, rc, schq;
> +
> + mutex_lock(&mbox->lock);
> + req = otx2_mbox_alloc_msg_nix_txsch_alloc(&pfvf->mbox);
> + if (!req)
> + return -ENOMEM;

This does not releases the mbox->lock mutex on error (another
occurrence below).

[...]


> +static int otx2_qos_txschq_update_config(struct otx2_nic *pfvf,
> + struct otx2_qos_node *node,
> + struct otx2_qos_cfg *cfg)
> +{
> + int ret = 0;
> +
> + otx2_qos_txschq_fill_cfg(pfvf, node, cfg);
> + ret = otx2_qos_txschq_push_cfg(pfvf, node, cfg);
> +
> + return ret;

I personally find the plain:

return <function>

more easy to read - more instances below.

[...]

> +static void otx2_reset_qdisc(struct net_device *dev, u16 qid)
> +{
> + struct netdev_queue *dev_queue = netdev_get_tx_queue(dev, qid);
> + struct Qdisc *qdisc = dev_queue->qdisc_sleeping;
> +
> + if (!qdisc)
> + return;
> +
> + spin_lock_bh(qdisc_lock(qdisc));
> + qdisc_reset(qdisc);
> + spin_unlock_bh(qdisc_lock(qdisc));
> +}

The above looks like a possible shared helper, as mlx code implements a
quite identical function.

Cheers,

Paolo