Re: [PATCH net-next 10/10] net: hns3: Add mqprio support when interacting with network stack

From: Jiri Pirko
Date: Fri Sep 22 2017 - 08:55:53 EST


Thu, Sep 21, 2017 at 01:21:53PM CEST, linyunsheng@xxxxxxxxxx wrote:
>When using tc qdisc to configure DCB parameter, dcb_ops->setup_tc
>is used to tell hclge_dcb module to do the setup.
>When using lldptool to configure DCB parameter, hclge_dcb module
>call the client_ops->setup_tc to tell network stack which queue
>and priority is using for specific tc.
>
>Signed-off-by: Yunsheng Lin <linyunsheng@xxxxxxxxxx>

[...]



>-static int hns3_setup_tc(struct net_device *netdev, u8 tc)
>+static int hns3_setup_tc(struct net_device *netdev, u8 tc, u8 *prio_tc)
> {
> struct hns3_nic_priv *priv = netdev_priv(netdev);
> struct hnae3_handle *h = priv->ae_handle;
> struct hnae3_knic_private_info *kinfo = &h->kinfo;
>+ bool if_running = netif_running(netdev);
> unsigned int i;
> int ret;
>
> if (tc > HNAE3_MAX_TC)
> return -EINVAL;
>
>- if (kinfo->num_tc == tc)
>- return 0;
>-
> if (!netdev)
> return -EINVAL;
>
>- if (!tc) {
>+ if (if_running) {
>+ (void)hns3_nic_net_stop(netdev);
>+ msleep(100);
>+ }
>+
>+ ret = (kinfo->dcb_ops && kinfo->dcb_ops->setup_tc) ?
>+ kinfo->dcb_ops->setup_tc(h, tc, prio_tc) : -EOPNOTSUPP;

This is most odd. Why do you call dcb_ops from ndo_setup_tc callback?
Why are you mixing this together? prio->tc mapping can be done
directly in dcbnl