Thu, Sep 21, 2017 at 01:21:53PM CEST, linyunsh...@huawei.com 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 <linyunsh...@huawei.com>
[...] >-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