Re: [PATCH V2 net-next 07/11] net: hns3: adds debug messages to identify eth down cause
On Sat, 2019-07-27 at 10:28 +0800, liuyonglong wrote: > On 2019/7/27 6:18, Joe Perches wrote: > > On Fri, 2019-07-26 at 22:00 +, Saeed Mahameed wrote: > > > On Fri, 2019-07-26 at 11:24 +0800, Huazhong Tan wrote: > > > > From: Yonglong Liu > > > > > > > > Some times just see the eth interface have been down/up via > > > > dmesg, but can not know why the eth down. So adds some debug > > > > messages to identify the cause for this. > > [] > > > > diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c > > > [] > > > > @@ -459,6 +459,10 @@ static int hns3_nic_net_open(struct net_device > > > > *netdev) > > > > h->ae_algo->ops->set_timer_task(priv->ae_handle, true); > > > > > > > > hns3_config_xps(priv); > > > > + > > > > + if (netif_msg_drv(h)) > > > > + netdev_info(netdev, "net open\n"); > > > > + > > > > > > to make sure this is only intended for debug, and to avoid repetition. > > > #define hns3_dbg(__dev, format, args...) \ > > > ({\ > > > if (netif_msg_drv(h)) \ > > > netdev_info(h->netdev, format, ##args); \ > > > }) > > > > netif_dbg(h, drv, h->netdev, "net open\n") > > > > Hi, Saeed && Joe: > For our cases, maybe netif_info() can be use for HNS3 drivers? > netif_dbg need to open dynamic debug options additional. Your code, your choice. I do think littering dmesg with "net open" style messages and such may be unnecessary. KERN_DEBUG seems a more appropriate log level.
Re: [PATCH V2 net-next 07/11] net: hns3: adds debug messages to identify eth down cause
On 2019/7/27 6:18, Joe Perches wrote: > On Fri, 2019-07-26 at 22:00 +, Saeed Mahameed wrote: >> On Fri, 2019-07-26 at 11:24 +0800, Huazhong Tan wrote: >>> From: Yonglong Liu >>> >>> Some times just see the eth interface have been down/up via >>> dmesg, but can not know why the eth down. So adds some debug >>> messages to identify the cause for this. > [] >>> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c >> [] >>> @@ -459,6 +459,10 @@ static int hns3_nic_net_open(struct net_device >>> *netdev) >>> h->ae_algo->ops->set_timer_task(priv->ae_handle, true); >>> >>> hns3_config_xps(priv); >>> + >>> + if (netif_msg_drv(h)) >>> + netdev_info(netdev, "net open\n"); >>> + >> >> to make sure this is only intended for debug, and to avoid repetition. >> #define hns3_dbg(__dev, format, args...) \ >> ({ \ >> if (netif_msg_drv(h)) \ >> netdev_info(h->netdev, format, ##args); \ >> }) > > netif_dbg(h, drv, h->netdev, "net open\n") > Hi, Saeed && Joe: For our cases, maybe netif_info() can be use for HNS3 drivers? netif_dbg need to open dynamic debug options additional.
Re: [PATCH V2 net-next 07/11] net: hns3: adds debug messages to identify eth down cause
On Fri, 2019-07-26 at 22:00 +, Saeed Mahameed wrote: > On Fri, 2019-07-26 at 11:24 +0800, Huazhong Tan wrote: > > From: Yonglong Liu > > > > Some times just see the eth interface have been down/up via > > dmesg, but can not know why the eth down. So adds some debug > > messages to identify the cause for this. [] > > diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c > [] > > @@ -459,6 +459,10 @@ static int hns3_nic_net_open(struct net_device > > *netdev) > > h->ae_algo->ops->set_timer_task(priv->ae_handle, true); > > > > hns3_config_xps(priv); > > + > > + if (netif_msg_drv(h)) > > + netdev_info(netdev, "net open\n"); > > + > > to make sure this is only intended for debug, and to avoid repetition. > #define hns3_dbg(__dev, format, args...) \ > ({\ > if (netif_msg_drv(h)) \ > netdev_info(h->netdev, format, ##args); \ > }) netif_dbg(h, drv, h->netdev, "net open\n")
Re: [PATCH V2 net-next 07/11] net: hns3: adds debug messages to identify eth down cause
On Fri, 2019-07-26 at 11:24 +0800, Huazhong Tan wrote: > From: Yonglong Liu > > Some times just see the eth interface have been down/up via > dmesg, but can not know why the eth down. So adds some debug > messages to identify the cause for this. > > Signed-off-by: Yonglong Liu > Signed-off-by: Peng Li > Signed-off-by: Huazhong Tan > --- > drivers/net/ethernet/hisilicon/hns3/hns3_enet.c| 24 > > drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 26 > ++ > .../net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 14 > 3 files changed, 64 insertions(+) > > diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c > b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c > index 4d58c53..2e30cfa 100644 > --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c > +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c > @@ -459,6 +459,10 @@ static int hns3_nic_net_open(struct net_device > *netdev) > h->ae_algo->ops->set_timer_task(priv->ae_handle, true); > > hns3_config_xps(priv); > + > + if (netif_msg_drv(h)) > + netdev_info(netdev, "net open\n"); > + to make sure this is only intended for debug, and to avoid repetition. #define hns3_dbg(__dev, format, args...)\ ({ \ if (netif_msg_drv(h)) \ netdev_info(h->netdev, format, ##args); \ }) #endif
[PATCH V2 net-next 07/11] net: hns3: adds debug messages to identify eth down cause
From: Yonglong Liu Some times just see the eth interface have been down/up via dmesg, but can not know why the eth down. So adds some debug messages to identify the cause for this. Signed-off-by: Yonglong Liu Signed-off-by: Peng Li Signed-off-by: Huazhong Tan --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c| 24 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 26 ++ .../net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 14 3 files changed, 64 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 4d58c53..2e30cfa 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -459,6 +459,10 @@ static int hns3_nic_net_open(struct net_device *netdev) h->ae_algo->ops->set_timer_task(priv->ae_handle, true); hns3_config_xps(priv); + + if (netif_msg_drv(h)) + netdev_info(netdev, "net open\n"); + return 0; } @@ -519,6 +523,9 @@ static int hns3_nic_net_stop(struct net_device *netdev) if (test_and_set_bit(HNS3_NIC_STATE_DOWN, >state)) return 0; + if (netif_msg_drv(h)) + netdev_info(netdev, "net stop\n"); + if (h->ae_algo->ops->set_timer_task) h->ae_algo->ops->set_timer_task(priv->ae_handle, false); @@ -1550,6 +1557,9 @@ static int hns3_setup_tc(struct net_device *netdev, void *type_data) h = hns3_get_handle(netdev); kinfo = >kinfo; + if (netif_msg_drv(h)) + netdev_info(netdev, "setup tc: num_tc=%d\n", tc); + return (kinfo->dcb_ops && kinfo->dcb_ops->setup_tc) ? kinfo->dcb_ops->setup_tc(h, tc, prio_tc) : -EOPNOTSUPP; } @@ -1593,6 +1603,11 @@ static int hns3_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, struct hnae3_handle *h = hns3_get_handle(netdev); int ret = -EIO; + if (netif_msg_drv(h)) + netdev_info(netdev, + "set vf vlan: vf=%d, vlan=%d, qos=%d, vlan_proto=%d\n", + vf, vlan, qos, vlan_proto); + if (h->ae_algo->ops->set_vf_vlan_filter) ret = h->ae_algo->ops->set_vf_vlan_filter(h, vf, vlan, qos, vlan_proto); @@ -1611,6 +1626,10 @@ static int hns3_nic_change_mtu(struct net_device *netdev, int new_mtu) if (!h->ae_algo->ops->set_mtu) return -EOPNOTSUPP; + if (netif_msg_drv(h)) + netdev_info(netdev, "change mtu from %d to %d\n", + netdev->mtu, new_mtu); + ret = h->ae_algo->ops->set_mtu(h, new_mtu); if (ret) netdev_err(netdev, "failed to change MTU in hardware %d\n", @@ -4395,6 +4414,11 @@ int hns3_set_channels(struct net_device *netdev, if (kinfo->rss_size == new_tqp_num) return 0; + if (netif_msg_drv(h)) + netdev_info(netdev, + "set channels: tqp_num=%d, rxfh=%d\n", + new_tqp_num, rxfh_configured); + ret = hns3_reset_notify(h, HNAE3_DOWN_CLIENT); if (ret) return ret; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index e71c92b..08334d7 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -311,6 +311,9 @@ static void hns3_self_test(struct net_device *ndev, if (eth_test->flags != ETH_TEST_FL_OFFLINE) return; + if (netif_msg_drv(h)) + netdev_info(ndev, "self test start\n"); + st_param[HNAE3_LOOP_APP][0] = HNAE3_LOOP_APP; st_param[HNAE3_LOOP_APP][1] = h->flags & HNAE3_SUPPORT_APP_LOOPBACK; @@ -374,6 +377,9 @@ static void hns3_self_test(struct net_device *ndev, if (if_running) ndev->netdev_ops->ndo_open(ndev); + + if (netif_msg_drv(h)) + netdev_info(ndev, "self test end\n"); } static int hns3_get_sset_count(struct net_device *netdev, int stringset) @@ -604,6 +610,11 @@ static int hns3_set_pauseparam(struct net_device *netdev, { struct hnae3_handle *h = hns3_get_handle(netdev); + if (netif_msg_drv(h)) + netdev_info(netdev, + "set pauseparam: autoneg=%d, rx:%d, tx:%d\n", + param->autoneg, param->rx_pause, param->tx_pause); + if (h->ae_algo->ops->set_pauseparam) return h->ae_algo->ops->set_pauseparam(h, param->autoneg, param->rx_pause, @@ -743,6 +754,13 @@ static int hns3_set_link_ksettings(struct net_device *netdev, if (cmd->base.speed == SPEED_1000 && cmd->base.duplex ==