未验证 提交 4c2d8732 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!874 nic: hns3: fix pointer cast for wol and fix getting GE port lanes error and set cpu affinity

Merge Pull Request from: @svishen 
 
This pull Requests fix pointer cast for wol and fix getting GE port lanes error and set cpu affinity

issue:
https://gitee.com/openeuler/kernel/issues/I7A712 
 
Link:https://gitee.com/openeuler/kernel/pulls/874 

Reviewed-by: Jialin Zhang <zhangjialin11@huawei.com> 
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> 
...@@ -239,6 +239,13 @@ int nic_set_cpu_affinity(struct net_device *ndev, cpumask_t *affinity_mask) ...@@ -239,6 +239,13 @@ int nic_set_cpu_affinity(struct net_device *ndev, cpumask_t *affinity_mask)
goto err_unlock; goto err_unlock;
} }
if (test_bit(HNS3_NIC_STATE_DOWN, &priv->state)) {
netdev_err(ndev,
"ethernet is down, not support cpu affinity set\n");
ret = -ENETDOWN;
goto err_unlock;
}
for (i = 0; i < priv->vector_num; i++) { for (i = 0; i < priv->vector_num; i++) {
tqp_vector = &priv->tqp_vector[i]; tqp_vector = &priv->tqp_vector[i];
if (tqp_vector->irq_init_flag != HNS3_VECTOR_INITED) if (tqp_vector->irq_init_flag != HNS3_VECTOR_INITED)
......
...@@ -12083,7 +12083,7 @@ int hclge_get_wol_supported_mode(struct hclge_dev *hdev, ...@@ -12083,7 +12083,7 @@ int hclge_get_wol_supported_mode(struct hclge_dev *hdev,
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_WOL_GET_SUPPORTED_MODE, hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_WOL_GET_SUPPORTED_MODE,
true); true);
wol_supported_cmd = (struct hclge_query_wol_supported_cmd *)&desc.data; wol_supported_cmd = (struct hclge_query_wol_supported_cmd *)desc.data;
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret) {
...@@ -12111,7 +12111,7 @@ int hclge_get_wol_cfg(struct hclge_dev *hdev, u32 *mode) ...@@ -12111,7 +12111,7 @@ int hclge_get_wol_cfg(struct hclge_dev *hdev, u32 *mode)
return ret; return ret;
} }
wol_cfg_cmd = (struct hclge_wol_cfg_cmd *)&desc.data; wol_cfg_cmd = (struct hclge_wol_cfg_cmd *)desc.data;
*mode = le32_to_cpu(wol_cfg_cmd->wake_on_lan_mode); *mode = le32_to_cpu(wol_cfg_cmd->wake_on_lan_mode);
return 0; return 0;
...@@ -12125,7 +12125,7 @@ static int hclge_set_wol_cfg(struct hclge_dev *hdev, ...@@ -12125,7 +12125,7 @@ static int hclge_set_wol_cfg(struct hclge_dev *hdev,
int ret; int ret;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_WOL_CFG, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_WOL_CFG, false);
wol_cfg_cmd = (struct hclge_wol_cfg_cmd *)&desc.data; wol_cfg_cmd = (struct hclge_wol_cfg_cmd *)desc.data;
wol_cfg_cmd->wake_on_lan_mode = cpu_to_le32(wol_info->wol_current_mode); wol_cfg_cmd->wake_on_lan_mode = cpu_to_le32(wol_info->wol_current_mode);
wol_cfg_cmd->sopass_size = wol_info->wol_sopass_size; wol_cfg_cmd->sopass_size = wol_info->wol_sopass_size;
memcpy(&wol_cfg_cmd->sopass, wol_info->wol_sopass, SOPASS_MAX); memcpy(&wol_cfg_cmd->sopass, wol_info->wol_sopass, SOPASS_MAX);
......
...@@ -7,11 +7,16 @@ ...@@ -7,11 +7,16 @@
static ssize_t lane_num_show(struct device *dev, static ssize_t lane_num_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
#define HCLGE_GE_PORT_ONE_LANE 1
struct pci_dev *pdev = container_of(dev, struct pci_dev, dev); struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(pdev); struct hnae3_ae_dev *ae_dev = pci_get_drvdata(pdev);
struct hclge_dev *hdev = ae_dev->priv; struct hclge_dev *hdev = ae_dev->priv;
return scnprintf(buf, PAGE_SIZE, "%u\n", hdev->hw.mac.lane_num); if (hdev->hw.mac.media_type == HNAE3_MEDIA_TYPE_COPPER)
return scnprintf(buf, PAGE_SIZE, "%u\n",
HCLGE_GE_PORT_ONE_LANE);
else
return scnprintf(buf, PAGE_SIZE, "%u\n", hdev->hw.mac.lane_num);
} }
static ssize_t lane_num_store(struct device *dev, static ssize_t lane_num_store(struct device *dev,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册