Skip to content

Commit

Permalink
Merge branch 'hns3-fixes'
Browse files Browse the repository at this point in the history
Huazhong Tan says:

====================
net: hns3: fixes for -net

This series includes misc fixes for the HNS3 ethernet driver.

[patch 1/3] adds a compatible handling for configuration of
MAC VLAN swithch parameter.

[patch 2/3] re-allocates SSU buffer when pfc_en changed.

[patch 3/3] fixes a bug for ETS bandwidth validation.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Nov 15, 2019
2 parents 15fb35f + c2d5689 commit 4a92e53
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
19 changes: 17 additions & 2 deletions drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static int hclge_ets_validate(struct hclge_dev *hdev, struct ieee_ets *ets,
if (ret)
return ret;

for (i = 0; i < HNAE3_MAX_TC; i++) {
for (i = 0; i < hdev->tc_max; i++) {
switch (ets->tc_tsa[i]) {
case IEEE_8021QAZ_TSA_STRICT:
if (hdev->tm_info.tc_info[i].tc_sch_mode !=
Expand Down Expand Up @@ -318,6 +318,7 @@ static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc)
struct net_device *netdev = h->kinfo.netdev;
struct hclge_dev *hdev = vport->back;
u8 i, j, pfc_map, *prio_tc;
int ret;

if (!(hdev->dcbx_cap & DCB_CAP_DCBX_VER_IEEE) ||
hdev->flag & HCLGE_FLAG_MQPRIO_ENABLE)
Expand Down Expand Up @@ -347,7 +348,21 @@ static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc)

hclge_tm_pfc_info_update(hdev);

return hclge_pause_setup_hw(hdev, false);
ret = hclge_pause_setup_hw(hdev, false);
if (ret)
return ret;

ret = hclge_notify_client(hdev, HNAE3_DOWN_CLIENT);
if (ret)
return ret;

ret = hclge_buffer_alloc(hdev);
if (ret) {
hclge_notify_client(hdev, HNAE3_UP_CLIENT);
return ret;
}

return hclge_notify_client(hdev, HNAE3_UP_CLIENT);
}

/* DCBX configuration */
Expand Down
16 changes: 14 additions & 2 deletions drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6263,11 +6263,23 @@ static int hclge_config_switch_param(struct hclge_dev *hdev, int vfid,

func_id = hclge_get_port_number(HOST_PORT, 0, vfid, 0);
req = (struct hclge_mac_vlan_switch_cmd *)desc.data;

/* read current config parameter */
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_MAC_VLAN_SWITCH_PARAM,
false);
true);
req->roce_sel = HCLGE_MAC_VLAN_NIC_SEL;
req->func_id = cpu_to_le32(func_id);
req->switch_param = switch_param;

ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) {
dev_err(&hdev->pdev->dev,
"read mac vlan switch parameter fail, ret = %d\n", ret);
return ret;
}

/* modify and write new config parameter */
hclge_cmd_reuse_desc(&desc, false);
req->switch_param = (req->switch_param & param_mask) | switch_param;
req->param_mask = param_mask;

ret = hclge_cmd_send(&hdev->hw, &desc, 1);
Expand Down

0 comments on commit 4a92e53

Please sign in to comment.