提交 1f5517fc 编写于 作者: Y Yonglong Liu 提交者: Xie XiuQi

net: hns3: adds debug messages to identify eth down cause

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

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.

Feature or Bugfix:Feature
Signed-off-by: NYonglong Liu <liuyonglong@huawei.com>
Reviewed-by: Nshenjian <shenjian15@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 6e958db3
...@@ -466,6 +466,10 @@ static int hns3_nic_net_open(struct net_device *netdev) ...@@ -466,6 +466,10 @@ static int hns3_nic_net_open(struct net_device *netdev)
h->ae_algo->ops->enable_timer_task(priv->ae_handle, true); h->ae_algo->ops->enable_timer_task(priv->ae_handle, true);
hns3_config_xps(priv); hns3_config_xps(priv);
if (netif_msg_ifup(h))
netdev_info(netdev, "net open\n");
return 0; return 0;
} }
...@@ -505,11 +509,15 @@ static void hns3_nic_net_down(struct net_device *netdev) ...@@ -505,11 +509,15 @@ static void hns3_nic_net_down(struct net_device *netdev)
static int hns3_nic_net_stop(struct net_device *netdev) static int hns3_nic_net_stop(struct net_device *netdev)
{ {
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hns3_nic_priv *priv = netdev_priv(netdev);
struct hnae3_handle *h = hns3_get_handle(netdev);
const struct hnae3_ae_ops *ops; const struct hnae3_ae_ops *ops;
if (test_and_set_bit(HNS3_NIC_STATE_DOWN, &priv->state)) if (test_and_set_bit(HNS3_NIC_STATE_DOWN, &priv->state))
return 0; return 0;
if (netif_msg_ifdown(h))
netdev_info(netdev, "net stop\n");
ops = priv->ae_handle->ae_algo->ops; ops = priv->ae_handle->ae_algo->ops;
if (ops->enable_timer_task) if (ops->enable_timer_task)
ops->enable_timer_task(priv->ae_handle, false); ops->enable_timer_task(priv->ae_handle, false);
...@@ -1576,6 +1584,9 @@ static int hns3_setup_tc(struct net_device *netdev, void *type_data) ...@@ -1576,6 +1584,9 @@ static int hns3_setup_tc(struct net_device *netdev, void *type_data)
h = hns3_get_handle(netdev); h = hns3_get_handle(netdev);
kinfo = &h->kinfo; kinfo = &h->kinfo;
if (netif_msg_ifdown(h))
netdev_info(netdev, "setup tc: num_tc=%d\n", tc);
return (kinfo->dcb_ops && kinfo->dcb_ops->setup_tc) ? return (kinfo->dcb_ops && kinfo->dcb_ops->setup_tc) ?
kinfo->dcb_ops->setup_tc(h, tc, prio_tc) : -EOPNOTSUPP; kinfo->dcb_ops->setup_tc(h, tc, prio_tc) : -EOPNOTSUPP;
} }
...@@ -1641,6 +1652,11 @@ static int hns3_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, ...@@ -1641,6 +1652,11 @@ static int hns3_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan,
if (hns3_nic_resetting(netdev)) if (hns3_nic_resetting(netdev))
return -EBUSY; return -EBUSY;
if (netif_msg_ifdown(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) if (h->ae_algo->ops->set_vf_vlan_filter)
ret = h->ae_algo->ops->set_vf_vlan_filter(h, vf, vlan, ret = h->ae_algo->ops->set_vf_vlan_filter(h, vf, vlan,
qos, vlan_proto); qos, vlan_proto);
...@@ -1659,6 +1675,10 @@ static int hns3_nic_change_mtu(struct net_device *netdev, int new_mtu) ...@@ -1659,6 +1675,10 @@ static int hns3_nic_change_mtu(struct net_device *netdev, int new_mtu)
if (!h->ae_algo->ops->set_mtu) if (!h->ae_algo->ops->set_mtu)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (netif_msg_ifdown(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); ret = h->ae_algo->ops->set_mtu(h, new_mtu);
if (ret) if (ret)
netdev_err(netdev, "failed to change MTU in hardware %d\n", netdev_err(netdev, "failed to change MTU in hardware %d\n",
...@@ -4478,6 +4498,11 @@ int hns3_set_channels(struct net_device *netdev, ...@@ -4478,6 +4498,11 @@ int hns3_set_channels(struct net_device *netdev,
if (kinfo->rss_size == new_tqp_num) if (kinfo->rss_size == new_tqp_num)
return 0; return 0;
if (netif_msg_ifdown(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); ret = hns3_reset_notify(h, HNAE3_DOWN_CLIENT);
if (ret) if (ret)
return ret; return ret;
......
...@@ -313,6 +313,9 @@ static void hns3_self_test(struct net_device *ndev, ...@@ -313,6 +313,9 @@ static void hns3_self_test(struct net_device *ndev,
if (eth_test->flags != ETH_TEST_FL_OFFLINE) if (eth_test->flags != ETH_TEST_FL_OFFLINE)
return; return;
if (netif_msg_ifdown(h))
netdev_info(ndev, "self test start\n");
st_param[HNAE3_LOOP_APP][0] = HNAE3_LOOP_APP; st_param[HNAE3_LOOP_APP][0] = HNAE3_LOOP_APP;
st_param[HNAE3_LOOP_APP][1] = st_param[HNAE3_LOOP_APP][1] =
h->flags & HNAE3_SUPPORT_APP_LOOPBACK; h->flags & HNAE3_SUPPORT_APP_LOOPBACK;
...@@ -362,6 +365,9 @@ static void hns3_self_test(struct net_device *ndev, ...@@ -362,6 +365,9 @@ static void hns3_self_test(struct net_device *ndev,
h->ae_algo->ops->halt_autoneg(h, false); h->ae_algo->ops->halt_autoneg(h, false);
if (if_running) if (if_running)
ndev->netdev_ops->ndo_open(ndev); ndev->netdev_ops->ndo_open(ndev);
if (netif_msg_ifdown(h))
netdev_info(ndev, "self test end\n");
} }
static int hns3_get_sset_count(struct net_device *netdev, int stringset) static int hns3_get_sset_count(struct net_device *netdev, int stringset)
...@@ -585,6 +591,11 @@ static int hns3_set_pauseparam(struct net_device *netdev, ...@@ -585,6 +591,11 @@ static int hns3_set_pauseparam(struct net_device *netdev,
{ {
struct hnae3_handle *h = hns3_get_handle(netdev); struct hnae3_handle *h = hns3_get_handle(netdev);
if (netif_msg_ifdown(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) if (h->ae_algo->ops->set_pauseparam)
return h->ae_algo->ops->set_pauseparam(h, param->autoneg, return h->ae_algo->ops->set_pauseparam(h, param->autoneg,
param->rx_pause, param->rx_pause,
...@@ -726,6 +737,13 @@ static int hns3_set_link_ksettings(struct net_device *netdev, ...@@ -726,6 +737,13 @@ static int hns3_set_link_ksettings(struct net_device *netdev,
if (cmd->base.speed == SPEED_1000 && cmd->base.duplex == DUPLEX_HALF) if (cmd->base.speed == SPEED_1000 && cmd->base.duplex == DUPLEX_HALF)
return -EINVAL; return -EINVAL;
if (netif_msg_ifdown(handle))
netdev_info(netdev,
"set link(%s): autoneg=%d, speed=%d, duplex=%d\n",
netdev->phydev ? "phy" : "mac",
cmd->base.autoneg, cmd->base.speed,
cmd->base.duplex);
/* Only support ksettings_set for netdev with phy attached for now */ /* Only support ksettings_set for netdev with phy attached for now */
if (netdev->phydev) if (netdev->phydev)
return phy_ethtool_ksettings_set(netdev->phydev, cmd); return phy_ethtool_ksettings_set(netdev->phydev, cmd);
...@@ -975,6 +993,10 @@ static int hns3_nway_reset(struct net_device *netdev) ...@@ -975,6 +993,10 @@ static int hns3_nway_reset(struct net_device *netdev)
return -EINVAL; return -EINVAL;
} }
if (netif_msg_ifdown(handle))
netdev_info(netdev, "nway reset (using %s)\n",
phy ? "phy" : "mac");
if (phy) if (phy)
return genphy_restart_aneg(phy); return genphy_restart_aneg(phy);
...@@ -1299,6 +1321,10 @@ static int hns3_set_fecparam(struct net_device *netdev, ...@@ -1299,6 +1321,10 @@ static int hns3_set_fecparam(struct net_device *netdev,
if (!ops->set_fec) if (!ops->set_fec)
return -EOPNOTSUPP; return -EOPNOTSUPP;
fec_mode = eth_to_loc_fec(fec->fec); fec_mode = eth_to_loc_fec(fec->fec);
if (netif_msg_ifdown(handle))
netdev_info(netdev, "set fecparam: mode=%d\n", fec_mode);
return ops->set_fec(handle, fec_mode); return ops->set_fec(handle, fec_mode);
} }
......
...@@ -200,6 +200,7 @@ static int hclge_client_setup_tc(struct hclge_dev *hdev) ...@@ -200,6 +200,7 @@ static int hclge_client_setup_tc(struct hclge_dev *hdev)
static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets) static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets)
{ {
struct hclge_vport *vport = hclge_get_vport(h); struct hclge_vport *vport = hclge_get_vport(h);
struct net_device *netdev = h->kinfo.netdev;
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
bool map_changed = false; bool map_changed = false;
u8 num_tc = 0; u8 num_tc = 0;
...@@ -214,6 +215,9 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets) ...@@ -214,6 +215,9 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets)
return ret; return ret;
if (map_changed) { if (map_changed) {
if (netif_msg_ifdown(h))
netdev_info(netdev, "set ets\n");
ret = hclge_notify_client(hdev, HNAE3_DOWN_CLIENT); ret = hclge_notify_client(hdev, HNAE3_DOWN_CLIENT);
if (ret) if (ret)
return ret; return ret;
...@@ -299,6 +303,7 @@ static int hclge_ieee_getpfc(struct hnae3_handle *h, struct ieee_pfc *pfc) ...@@ -299,6 +303,7 @@ static int hclge_ieee_getpfc(struct hnae3_handle *h, struct ieee_pfc *pfc)
static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc) static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc)
{ {
struct hclge_vport *vport = hclge_get_vport(h); struct hclge_vport *vport = hclge_get_vport(h);
struct net_device *netdev = h->kinfo.netdev;
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
u8 i, j, pfc_map, *prio_tc; u8 i, j, pfc_map, *prio_tc;
int ret; int ret;
...@@ -325,6 +330,11 @@ static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc) ...@@ -325,6 +330,11 @@ static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc)
hdev->tm_info.hw_pfc_map = pfc_map; hdev->tm_info.hw_pfc_map = pfc_map;
hdev->tm_info.pfc_en = pfc->pfc_en; hdev->tm_info.pfc_en = pfc->pfc_en;
if (netif_msg_ifdown(h))
netdev_info(netdev,
"set pfc: pfc_en=%d, pfc_map=%d, num_tc=%d\n",
pfc->pfc_en, pfc_map, hdev->tm_info.num_tc);
hclge_tm_schd_info_update(hdev, hdev->tm_info.num_tc); hclge_tm_schd_info_update(hdev, hdev->tm_info.num_tc);
ret = hclge_pause_setup_hw(hdev, false); ret = hclge_pause_setup_hw(hdev, false);
...@@ -359,14 +369,21 @@ static u8 hclge_getdcbx(struct hnae3_handle *h) ...@@ -359,14 +369,21 @@ static u8 hclge_getdcbx(struct hnae3_handle *h)
static u8 hclge_setdcbx(struct hnae3_handle *h, u8 mode) static u8 hclge_setdcbx(struct hnae3_handle *h, u8 mode)
{ {
struct hclge_vport *vport = hclge_get_vport(h); struct hclge_vport *vport = hclge_get_vport(h);
struct net_device *netdev = h->kinfo.netdev;
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
if (netif_msg_drv(h))
netdev_info(netdev, "set dcbx: mode=%d\n", mode);
/* No support for LLD_MANAGED modes or CEE */ /* No support for LLD_MANAGED modes or CEE */
if ((mode & DCB_CAP_DCBX_LLD_MANAGED) || if ((mode & DCB_CAP_DCBX_LLD_MANAGED) ||
(mode & DCB_CAP_DCBX_VER_CEE) || (mode & DCB_CAP_DCBX_VER_CEE) ||
!(mode & DCB_CAP_DCBX_HOST)) !(mode & DCB_CAP_DCBX_HOST))
return 1; return 1;
if (hdev->dcbx_cap == mode)
return 0;
hdev->dcbx_cap = mode; hdev->dcbx_cap = mode;
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册