|
|
|
@ -553,7 +553,6 @@ static int hclge_mac_update_stats(struct hclge_dev *hdev)
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
ret = hclge_mac_query_reg_num(hdev, &desc_num);
|
|
|
|
|
|
|
|
|
|
/* The firmware supports the new statistics acquisition method */
|
|
|
|
|
if (!ret)
|
|
|
|
|
ret = hclge_mac_update_stats_complete(hdev, desc_num);
|
|
|
|
@ -784,7 +783,6 @@ static int hclge_get_sset_count(struct hnae3_handle *handle, int stringset)
|
|
|
|
|
count += 1;
|
|
|
|
|
handle->flags |= HNAE3_SUPPORT_PHY_LOOPBACK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (stringset == ETH_SS_STATS) {
|
|
|
|
|
count = ARRAY_SIZE(g_mac_stats_string) +
|
|
|
|
|
hclge_tqps_get_sset_count(handle, stringset);
|
|
|
|
@ -1292,9 +1290,6 @@ static void hclge_parse_cfg(struct hclge_cfg *cfg, struct hclge_desc *desc)
|
|
|
|
|
req = (struct hclge_cfg_param_cmd *)desc[0].data;
|
|
|
|
|
|
|
|
|
|
/* get the configuration */
|
|
|
|
|
cfg->vmdq_vport_num = hnae3_get_field(__le32_to_cpu(req->param[0]),
|
|
|
|
|
HCLGE_CFG_VMDQ_M,
|
|
|
|
|
HCLGE_CFG_VMDQ_S);
|
|
|
|
|
cfg->tc_num = hnae3_get_field(__le32_to_cpu(req->param[0]),
|
|
|
|
|
HCLGE_CFG_TC_NUM_M, HCLGE_CFG_TC_NUM_S);
|
|
|
|
|
cfg->tqp_desc_num = hnae3_get_field(__le32_to_cpu(req->param[0]),
|
|
|
|
@ -1511,7 +1506,7 @@ static void hclge_init_kdump_kernel_config(struct hclge_dev *hdev)
|
|
|
|
|
"Running kdump kernel. Using minimal resources\n");
|
|
|
|
|
|
|
|
|
|
/* minimal queue pairs equals to the number of vports */
|
|
|
|
|
hdev->num_tqps = hdev->num_vmdq_vport + hdev->num_req_vfs + 1;
|
|
|
|
|
hdev->num_tqps = hdev->num_req_vfs + 1;
|
|
|
|
|
hdev->num_tx_desc = HCLGE_MIN_TX_DESC;
|
|
|
|
|
hdev->num_rx_desc = HCLGE_MIN_RX_DESC;
|
|
|
|
|
}
|
|
|
|
@ -1526,7 +1521,6 @@ static int hclge_configure(struct hclge_dev *hdev)
|
|
|
|
|
if (ret)
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
|
hdev->num_vmdq_vport = cfg.vmdq_vport_num;
|
|
|
|
|
hdev->base_tqp_pid = 0;
|
|
|
|
|
hdev->vf_rss_size_max = cfg.vf_rss_size_max;
|
|
|
|
|
hdev->pf_rss_size_max = cfg.pf_rss_size_max;
|
|
|
|
@ -1777,7 +1771,7 @@ static int hclge_map_tqp(struct hclge_dev *hdev)
|
|
|
|
|
struct hclge_vport *vport = hdev->vport;
|
|
|
|
|
u16 i, num_vport;
|
|
|
|
|
|
|
|
|
|
num_vport = hdev->num_vmdq_vport + hdev->num_req_vfs + 1;
|
|
|
|
|
num_vport = hdev->num_req_vfs + 1;
|
|
|
|
|
for (i = 0; i < num_vport; i++) {
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
@ -1819,7 +1813,7 @@ static int hclge_alloc_vport(struct hclge_dev *hdev)
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
/* We need to alloc a vport for main NIC of PF */
|
|
|
|
|
num_vport = hdev->num_vmdq_vport + hdev->num_req_vfs + 1;
|
|
|
|
|
num_vport = hdev->num_req_vfs + 1;
|
|
|
|
|
|
|
|
|
|
if (hdev->num_tqps < num_vport) {
|
|
|
|
|
dev_err(&hdev->pdev->dev, "tqps(%u) is less than vports(%d)",
|
|
|
|
@ -2195,7 +2189,6 @@ static int hclge_only_alloc_priv_buff(struct hclge_dev *hdev,
|
|
|
|
|
COMPENSATE_HALF_MPS_NUM * half_mps;
|
|
|
|
|
min_rx_priv = round_up(min_rx_priv, HCLGE_BUF_SIZE_UNIT);
|
|
|
|
|
rx_priv = round_down(rx_priv, HCLGE_BUF_SIZE_UNIT);
|
|
|
|
|
|
|
|
|
|
if (rx_priv < min_rx_priv)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
@ -2224,7 +2217,7 @@ static int hclge_only_alloc_priv_buff(struct hclge_dev *hdev,
|
|
|
|
|
/* hclge_rx_buffer_calc: calculate the rx private buffer size for all TCs
|
|
|
|
|
* @hdev: pointer to struct hclge_dev
|
|
|
|
|
* @buf_alloc: pointer to buffer calculation data
|
|
|
|
|
* @return: 0: calculate sucessful, negative: fail
|
|
|
|
|
* @return: 0: calculate successful, negative: fail
|
|
|
|
|
*/
|
|
|
|
|
static int hclge_rx_buffer_calc(struct hclge_dev *hdev,
|
|
|
|
|
struct hclge_pkt_buf_alloc *buf_alloc)
|
|
|
|
@ -2889,13 +2882,12 @@ static int hclge_get_mac_phy_link(struct hclge_dev *hdev, int *link_status)
|
|
|
|
|
|
|
|
|
|
static void hclge_update_link_status(struct hclge_dev *hdev)
|
|
|
|
|
{
|
|
|
|
|
struct hnae3_handle *rhandle = &hdev->vport[0].roce;
|
|
|
|
|
struct hnae3_handle *handle = &hdev->vport[0].nic;
|
|
|
|
|
struct hnae3_client *rclient = hdev->roce_client;
|
|
|
|
|
struct hnae3_client *client = hdev->nic_client;
|
|
|
|
|
struct hnae3_handle *rhandle;
|
|
|
|
|
struct hnae3_handle *handle;
|
|
|
|
|
int state;
|
|
|
|
|
int ret;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (!client)
|
|
|
|
|
return;
|
|
|
|
@ -2910,15 +2902,11 @@ static void hclge_update_link_status(struct hclge_dev *hdev)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (state != hdev->hw.mac.link) {
|
|
|
|
|
for (i = 0; i < hdev->num_vmdq_vport + 1; i++) {
|
|
|
|
|
handle = &hdev->vport[i].nic;
|
|
|
|
|
client->ops->link_status_change(handle, state);
|
|
|
|
|
hclge_config_mac_tnl_int(hdev, state);
|
|
|
|
|
rhandle = &hdev->vport[i].roce;
|
|
|
|
|
if (rclient && rclient->ops->link_status_change)
|
|
|
|
|
rclient->ops->link_status_change(rhandle,
|
|
|
|
|
state);
|
|
|
|
|
}
|
|
|
|
|
client->ops->link_status_change(handle, state);
|
|
|
|
|
hclge_config_mac_tnl_int(hdev, state);
|
|
|
|
|
if (rclient && rclient->ops->link_status_change)
|
|
|
|
|
rclient->ops->link_status_change(rhandle, state);
|
|
|
|
|
|
|
|
|
|
hdev->hw.mac.link = state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3370,7 +3358,7 @@ static irqreturn_t hclge_misc_irq_handle(int irq, void *data)
|
|
|
|
|
* caused this event. Therefore, we will do below for now:
|
|
|
|
|
* 1. Assert HNAE3_UNKNOWN_RESET type of reset. This means we
|
|
|
|
|
* have defered type of reset to be used.
|
|
|
|
|
* 2. Schedule the reset serivce task.
|
|
|
|
|
* 2. Schedule the reset service task.
|
|
|
|
|
* 3. When service task receives HNAE3_UNKNOWN_RESET type it
|
|
|
|
|
* will fetch the correct type of reset. This would be done
|
|
|
|
|
* by first decoding the types of errors.
|
|
|
|
@ -3498,8 +3486,9 @@ static void hclge_misc_irq_uninit(struct hclge_dev *hdev)
|
|
|
|
|
int hclge_notify_client(struct hclge_dev *hdev,
|
|
|
|
|
enum hnae3_reset_notify_type type)
|
|
|
|
|
{
|
|
|
|
|
struct hnae3_handle *handle = &hdev->vport[0].nic;
|
|
|
|
|
struct hnae3_client *client = hdev->nic_client;
|
|
|
|
|
u16 i;
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
if (!test_bit(HCLGE_STATE_NIC_REGISTERED, &hdev->state) || !client)
|
|
|
|
|
return 0;
|
|
|
|
@ -3507,27 +3496,20 @@ int hclge_notify_client(struct hclge_dev *hdev,
|
|
|
|
|
if (!client->ops->reset_notify)
|
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < hdev->num_vmdq_vport + 1; i++) {
|
|
|
|
|
struct hnae3_handle *handle = &hdev->vport[i].nic;
|
|
|
|
|
int ret;
|
|
|
|
|
ret = client->ops->reset_notify(handle, type);
|
|
|
|
|
if (ret)
|
|
|
|
|
dev_err(&hdev->pdev->dev, "notify nic client failed %d(%d)\n",
|
|
|
|
|
type, ret);
|
|
|
|
|
|
|
|
|
|
ret = client->ops->reset_notify(handle, type);
|
|
|
|
|
if (ret) {
|
|
|
|
|
dev_err(&hdev->pdev->dev,
|
|
|
|
|
"notify nic client failed %d(%d)\n", type, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int hclge_notify_roce_client(struct hclge_dev *hdev,
|
|
|
|
|
enum hnae3_reset_notify_type type)
|
|
|
|
|
{
|
|
|
|
|
struct hnae3_handle *handle = &hdev->vport[0].roce;
|
|
|
|
|
struct hnae3_client *client = hdev->roce_client;
|
|
|
|
|
int ret;
|
|
|
|
|
u16 i;
|
|
|
|
|
|
|
|
|
|
if (!test_bit(HCLGE_STATE_ROCE_REGISTERED, &hdev->state) || !client)
|
|
|
|
|
return 0;
|
|
|
|
@ -3535,17 +3517,10 @@ static int hclge_notify_roce_client(struct hclge_dev *hdev,
|
|
|
|
|
if (!client->ops->reset_notify)
|
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < hdev->num_vmdq_vport + 1; i++) {
|
|
|
|
|
struct hnae3_handle *handle = &hdev->vport[i].roce;
|
|
|
|
|
|
|
|
|
|
ret = client->ops->reset_notify(handle, type);
|
|
|
|
|
if (ret) {
|
|
|
|
|
dev_err(&hdev->pdev->dev,
|
|
|
|
|
"notify roce client failed %d(%d)",
|
|
|
|
|
type, ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ret = client->ops->reset_notify(handle, type);
|
|
|
|
|
if (ret)
|
|
|
|
|
dev_err(&hdev->pdev->dev, "notify roce client failed %d(%d)",
|
|
|
|
|
type, ret);
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
@ -3613,7 +3588,7 @@ static int hclge_set_all_vf_rst(struct hclge_dev *hdev, bool reset)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = hdev->num_vmdq_vport + 1; i < hdev->num_alloc_vport; i++) {
|
|
|
|
|
for (i = HCLGE_VF_VPORT_START_NUM; i < hdev->num_alloc_vport; i++) {
|
|
|
|
|
struct hclge_vport *vport = &hdev->vport[i];
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
@ -3694,14 +3669,12 @@ void hclge_report_hw_error(struct hclge_dev *hdev,
|
|
|
|
|
enum hnae3_hw_error_type type)
|
|
|
|
|
{
|
|
|
|
|
struct hnae3_client *client = hdev->nic_client;
|
|
|
|
|
u16 i;
|
|
|
|
|
|
|
|
|
|
if (!client || !client->ops->process_hw_error ||
|
|
|
|
|
!test_bit(HCLGE_STATE_NIC_REGISTERED, &hdev->state))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < hdev->num_vmdq_vport + 1; i++)
|
|
|
|
|
client->ops->process_hw_error(&hdev->vport[i].nic, type);
|
|
|
|
|
client->ops->process_hw_error(&hdev->vport[0].nic, type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void hclge_handle_imp_error(struct hclge_dev *hdev)
|
|
|
|
@ -3967,6 +3940,21 @@ static bool hclge_reset_err_handle(struct hclge_dev *hdev)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void hclge_update_reset_level(struct hclge_dev *hdev)
|
|
|
|
|
{
|
|
|
|
|
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(hdev->pdev);
|
|
|
|
|
enum hnae3_reset_type reset_level;
|
|
|
|
|
|
|
|
|
|
/* if default_reset_request has a higher level reset request,
|
|
|
|
|
* it should be handled as soon as possible. since some errors
|
|
|
|
|
* need this kind of reset to fix.
|
|
|
|
|
*/
|
|
|
|
|
reset_level = hclge_get_reset_level(ae_dev,
|
|
|
|
|
&hdev->default_reset_request);
|
|
|
|
|
if (reset_level != HNAE3_NONE_RESET)
|
|
|
|
|
set_bit(reset_level, &hdev->reset_request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int hclge_set_rst_done(struct hclge_dev *hdev)
|
|
|
|
|
{
|
|
|
|
|
struct hclge_pf_rst_done_cmd *req;
|
|
|
|
@ -4054,8 +4042,6 @@ static int hclge_reset_prepare(struct hclge_dev *hdev)
|
|
|
|
|
|
|
|
|
|
static int hclge_reset_rebuild(struct hclge_dev *hdev)
|
|
|
|
|
{
|
|
|
|
|
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(hdev->pdev);
|
|
|
|
|
enum hnae3_reset_type reset_level;
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
hdev->rst_stats.hw_reset_done_cnt++;
|
|
|
|
@ -4099,14 +4085,7 @@ static int hclge_reset_rebuild(struct hclge_dev *hdev)
|
|
|
|
|
hdev->rst_stats.reset_done_cnt++;
|
|
|
|
|
clear_bit(HCLGE_STATE_RST_FAIL, &hdev->state);
|
|
|
|
|
|
|
|
|
|
/* if default_reset_request has a higher level reset request,
|
|
|
|
|
* it should be handled as soon as possible. since some errors
|
|
|
|
|
* need this kind of reset to fix.
|
|
|
|
|
*/
|
|
|
|
|
reset_level = hclge_get_reset_level(ae_dev,
|
|
|
|
|
&hdev->default_reset_request);
|
|
|
|
|
if (reset_level != HNAE3_NONE_RESET)
|
|
|
|
|
set_bit(reset_level, &hdev->reset_request);
|
|
|
|
|
hclge_update_reset_level(hdev);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -4913,58 +4892,44 @@ int hclge_rss_init_hw(struct hclge_dev *hdev)
|
|
|
|
|
|
|
|
|
|
void hclge_rss_indir_init_cfg(struct hclge_dev *hdev)
|
|
|
|
|
{
|
|
|
|
|
struct hclge_vport *vport = hdev->vport;
|
|
|
|
|
int i, j;
|
|
|
|
|
struct hclge_vport *vport = &hdev->vport[0];
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < hdev->num_vmdq_vport + 1; j++) {
|
|
|
|
|
for (i = 0; i < hdev->ae_dev->dev_specs.rss_ind_tbl_size; i++)
|
|
|
|
|
vport[j].rss_indirection_tbl[i] =
|
|
|
|
|
i % vport[j].alloc_rss_size;
|
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < hdev->ae_dev->dev_specs.rss_ind_tbl_size; i++)
|
|
|
|
|
vport->rss_indirection_tbl[i] = i % vport->alloc_rss_size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int hclge_rss_init_cfg(struct hclge_dev *hdev)
|
|
|
|
|
{
|
|
|
|
|
u16 rss_ind_tbl_size = hdev->ae_dev->dev_specs.rss_ind_tbl_size;
|
|
|
|
|
int i, rss_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ;
|
|
|
|
|
struct hclge_vport *vport = hdev->vport;
|
|
|
|
|
int rss_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ;
|
|
|
|
|
struct hclge_vport *vport = &hdev->vport[0];
|
|
|
|
|
u16 *rss_ind_tbl;
|
|
|
|
|
|
|
|
|
|
if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2)
|
|
|
|
|
rss_algo = HCLGE_RSS_HASH_ALGO_SIMPLE;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < hdev->num_vmdq_vport + 1; i++) {
|
|
|
|
|
u16 *rss_ind_tbl;
|
|
|
|
|
vport->rss_tuple_sets.ipv4_tcp_en = HCLGE_RSS_INPUT_TUPLE_OTHER;
|
|
|
|
|
vport->rss_tuple_sets.ipv4_udp_en = HCLGE_RSS_INPUT_TUPLE_OTHER;
|
|
|
|
|
vport->rss_tuple_sets.ipv4_sctp_en = HCLGE_RSS_INPUT_TUPLE_SCTP;
|
|
|
|
|
vport->rss_tuple_sets.ipv4_fragment_en = HCLGE_RSS_INPUT_TUPLE_OTHER;
|
|
|
|
|
vport->rss_tuple_sets.ipv6_tcp_en = HCLGE_RSS_INPUT_TUPLE_OTHER;
|
|
|
|
|
vport->rss_tuple_sets.ipv6_udp_en = HCLGE_RSS_INPUT_TUPLE_OTHER;
|
|
|
|
|
vport->rss_tuple_sets.ipv6_sctp_en =
|
|
|
|
|
hdev->ae_dev->dev_version <= HNAE3_DEVICE_VERSION_V2 ?
|
|
|
|
|
HCLGE_RSS_INPUT_TUPLE_SCTP_NO_PORT :
|
|
|
|
|
HCLGE_RSS_INPUT_TUPLE_SCTP;
|
|
|
|
|
vport->rss_tuple_sets.ipv6_fragment_en = HCLGE_RSS_INPUT_TUPLE_OTHER;
|
|
|
|
|
|
|
|
|
|
vport[i].rss_tuple_sets.ipv4_tcp_en =
|
|
|
|
|
HCLGE_RSS_INPUT_TUPLE_OTHER;
|
|
|
|
|
vport[i].rss_tuple_sets.ipv4_udp_en =
|
|
|
|
|
HCLGE_RSS_INPUT_TUPLE_OTHER;
|
|
|
|
|
vport[i].rss_tuple_sets.ipv4_sctp_en =
|
|
|
|
|
HCLGE_RSS_INPUT_TUPLE_SCTP;
|
|
|
|
|
vport[i].rss_tuple_sets.ipv4_fragment_en =
|
|
|
|
|
HCLGE_RSS_INPUT_TUPLE_OTHER;
|
|
|
|
|
vport[i].rss_tuple_sets.ipv6_tcp_en =
|
|
|
|
|
HCLGE_RSS_INPUT_TUPLE_OTHER;
|
|
|
|
|
vport[i].rss_tuple_sets.ipv6_udp_en =
|
|
|
|
|
HCLGE_RSS_INPUT_TUPLE_OTHER;
|
|
|
|
|
vport[i].rss_tuple_sets.ipv6_sctp_en =
|
|
|
|
|
hdev->ae_dev->dev_version <= HNAE3_DEVICE_VERSION_V2 ?
|
|
|
|
|
HCLGE_RSS_INPUT_TUPLE_SCTP_NO_PORT :
|
|
|
|
|
HCLGE_RSS_INPUT_TUPLE_SCTP;
|
|
|
|
|
vport[i].rss_tuple_sets.ipv6_fragment_en =
|
|
|
|
|
HCLGE_RSS_INPUT_TUPLE_OTHER;
|
|
|
|
|
vport->rss_algo = rss_algo;
|
|
|
|
|
|
|
|
|
|
vport[i].rss_algo = rss_algo;
|
|
|
|
|
rss_ind_tbl = devm_kcalloc(&hdev->pdev->dev, rss_ind_tbl_size,
|
|
|
|
|
sizeof(*rss_ind_tbl), GFP_KERNEL);
|
|
|
|
|
if (!rss_ind_tbl)
|
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
|
|
rss_ind_tbl = devm_kcalloc(&hdev->pdev->dev, rss_ind_tbl_size,
|
|
|
|
|
sizeof(*rss_ind_tbl), GFP_KERNEL);
|
|
|
|
|
if (!rss_ind_tbl)
|
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
|
|
vport[i].rss_indirection_tbl = rss_ind_tbl;
|
|
|
|
|
memcpy(vport[i].rss_hash_key, hclge_hash_key,
|
|
|
|
|
HCLGE_RSS_KEY_SIZE);
|
|
|
|
|
}
|
|
|
|
|
vport->rss_indirection_tbl = rss_ind_tbl;
|
|
|
|
|
memcpy(vport->rss_hash_key, hclge_hash_key, HCLGE_RSS_KEY_SIZE);
|
|
|
|
|
|
|
|
|
|
hclge_rss_indir_init_cfg(hdev);
|
|
|
|
|
|
|
|
|
@ -8457,7 +8422,7 @@ int hclge_update_mac_list(struct hclge_vport *vport,
|
|
|
|
|
|
|
|
|
|
/* if the mac addr is already in the mac list, no need to add a new
|
|
|
|
|
* one into it, just check the mac addr state, convert it to a new
|
|
|
|
|
* new state, or just remove it, or do nothing.
|
|
|
|
|
* state, or just remove it, or do nothing.
|
|
|
|
|
*/
|
|
|
|
|
mac_node = hclge_find_mac_node(list, addr);
|
|
|
|
|
if (mac_node) {
|
|
|
|
@ -8646,7 +8611,6 @@ int hclge_add_mc_addr_common(struct hclge_vport *vport,
|
|
|
|
|
if (status)
|
|
|
|
|
return status;
|
|
|
|
|
status = hclge_add_mac_vlan_tbl(vport, &req, desc);
|
|
|
|
|
|
|
|
|
|
/* if already overflow, not to print each time */
|
|
|
|
|
if (status == -ENOSPC &&
|
|
|
|
|
!(vport->overflow_promisc_flags & HNAE3_OVERFLOW_MPE))
|
|
|
|
@ -8695,7 +8659,6 @@ int hclge_rm_mc_addr_common(struct hclge_vport *vport,
|
|
|
|
|
else
|
|
|
|
|
/* Not all the vfid is zero, update the vfid */
|
|
|
|
|
status = hclge_add_mac_vlan_tbl(vport, &req, desc);
|
|
|
|
|
|
|
|
|
|
} else if (status == -ENOENT) {
|
|
|
|
|
status = 0;
|
|
|
|
|
}
|
|
|
|
@ -9130,7 +9093,7 @@ static bool hclge_check_vf_mac_exist(struct hclge_vport *vport, int vf_idx,
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
vf_idx += HCLGE_VF_VPORT_START_NUM;
|
|
|
|
|
for (i = hdev->num_vmdq_vport + 1; i < hdev->num_alloc_vport; i++)
|
|
|
|
|
for (i = HCLGE_VF_VPORT_START_NUM; i < hdev->num_alloc_vport; i++)
|
|
|
|
|
if (i != vf_idx &&
|
|
|
|
|
ether_addr_equal(mac_addr, hdev->vport[i].vf_info.mac))
|
|
|
|
|
return true;
|
|
|
|
@ -9511,8 +9474,7 @@ static int hclge_check_vf_vlan_cmd_status(struct hclge_dev *hdev, u16 vfid,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int hclge_set_vf_vlan_common(struct hclge_dev *hdev, u16 vfid,
|
|
|
|
|
bool is_kill, u16 vlan,
|
|
|
|
|
__be16 proto)
|
|
|
|
|
bool is_kill, u16 vlan)
|
|
|
|
|
{
|
|
|
|
|
struct hclge_vport *vport = &hdev->vport[vfid];
|
|
|
|
|
struct hclge_desc desc[2];
|
|
|
|
@ -9578,8 +9540,7 @@ static int hclge_set_vlan_filter_hw(struct hclge_dev *hdev, __be16 proto,
|
|
|
|
|
if (is_kill && !vlan_id)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
ret = hclge_set_vf_vlan_common(hdev, vport_id, is_kill, vlan_id,
|
|
|
|
|
proto);
|
|
|
|
|
ret = hclge_set_vf_vlan_common(hdev, vport_id, is_kill, vlan_id);
|
|
|
|
|
if (ret) {
|
|
|
|
|
dev_err(&hdev->pdev->dev,
|
|
|
|
|
"Set %u vport vlan filter config fail, ret =%d.\n",
|
|
|
|
@ -10771,7 +10732,6 @@ static void hclge_info_show(struct hclge_dev *hdev)
|
|
|
|
|
dev_info(dev, "Desc num per TX queue: %u\n", hdev->num_tx_desc);
|
|
|
|
|
dev_info(dev, "Desc num per RX queue: %u\n", hdev->num_rx_desc);
|
|
|
|
|
dev_info(dev, "Numbers of vports: %u\n", hdev->num_alloc_vport);
|
|
|
|
|
dev_info(dev, "Numbers of vmdp vports: %u\n", hdev->num_vmdq_vport);
|
|
|
|
|
dev_info(dev, "Numbers of VF for this PF: %u\n", hdev->num_req_vfs);
|
|
|
|
|
dev_info(dev, "HW tc map: 0x%x\n", hdev->hw_tc_map);
|
|
|
|
|
dev_info(dev, "Total buffer size for TX/RX: %u\n", hdev->pkt_buf_size);
|
|
|
|
@ -10886,39 +10846,35 @@ static int hclge_init_client_instance(struct hnae3_client *client,
|
|
|
|
|
struct hnae3_ae_dev *ae_dev)
|
|
|
|
|
{
|
|
|
|
|
struct hclge_dev *hdev = ae_dev->priv;
|
|
|
|
|
struct hclge_vport *vport;
|
|
|
|
|
int i, ret;
|
|
|
|
|
struct hclge_vport *vport = &hdev->vport[0];
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < hdev->num_vmdq_vport + 1; i++) {
|
|
|
|
|
vport = &hdev->vport[i];
|
|
|
|
|
switch (client->type) {
|
|
|
|
|
case HNAE3_CLIENT_KNIC:
|
|
|
|
|
hdev->nic_client = client;
|
|
|
|
|
vport->nic.client = client;
|
|
|
|
|
ret = hclge_init_nic_client_instance(ae_dev, vport);
|
|
|
|
|
if (ret)
|
|
|
|
|
goto clear_nic;
|
|
|
|
|
|
|
|
|
|
switch (client->type) {
|
|
|
|
|
case HNAE3_CLIENT_KNIC:
|
|
|
|
|
hdev->nic_client = client;
|
|
|
|
|
vport->nic.client = client;
|
|
|
|
|
ret = hclge_init_nic_client_instance(ae_dev, vport);
|
|
|
|
|
if (ret)
|
|
|
|
|
goto clear_nic;
|
|
|
|
|
ret = hclge_init_roce_client_instance(ae_dev, vport);
|
|
|
|
|
if (ret)
|
|
|
|
|
goto clear_roce;
|
|
|
|
|
|
|
|
|
|
ret = hclge_init_roce_client_instance(ae_dev, vport);
|
|
|
|
|
if (ret)
|
|
|
|
|
goto clear_roce;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case HNAE3_CLIENT_ROCE:
|
|
|
|
|
if (hnae3_dev_roce_supported(hdev)) {
|
|
|
|
|
hdev->roce_client = client;
|
|
|
|
|
vport->roce.client = client;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret = hclge_init_roce_client_instance(ae_dev, vport);
|
|
|
|
|
if (ret)
|
|
|
|
|
goto clear_roce;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
break;
|
|
|
|
|
case HNAE3_CLIENT_ROCE:
|
|
|
|
|
if (hnae3_dev_roce_supported(hdev)) {
|
|
|
|
|
hdev->roce_client = client;
|
|
|
|
|
vport->roce.client = client;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret = hclge_init_roce_client_instance(ae_dev, vport);
|
|
|
|
|
if (ret)
|
|
|
|
|
goto clear_roce;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
@ -10937,32 +10893,27 @@ static void hclge_uninit_client_instance(struct hnae3_client *client,
|
|
|
|
|
struct hnae3_ae_dev *ae_dev)
|
|
|
|
|
{
|
|
|
|
|
struct hclge_dev *hdev = ae_dev->priv;
|
|
|
|
|
struct hclge_vport *vport;
|
|
|
|
|
int i;
|
|
|
|
|
struct hclge_vport *vport = &hdev->vport[0];
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < hdev->num_vmdq_vport + 1; i++) {
|
|
|
|
|
vport = &hdev->vport[i];
|
|
|
|
|
if (hdev->roce_client) {
|
|
|
|
|
clear_bit(HCLGE_STATE_ROCE_REGISTERED, &hdev->state);
|
|
|
|
|
while (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state))
|
|
|
|
|
msleep(HCLGE_WAIT_RESET_DONE);
|
|
|
|
|
if (hdev->roce_client) {
|
|
|
|
|
clear_bit(HCLGE_STATE_ROCE_REGISTERED, &hdev->state);
|
|
|
|
|
while (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state))
|
|
|
|
|
msleep(HCLGE_WAIT_RESET_DONE);
|
|
|
|
|
|
|
|
|
|
hdev->roce_client->ops->uninit_instance(&vport->roce,
|
|
|
|
|
0);
|
|
|
|
|
hdev->roce_client = NULL;
|
|
|
|
|
vport->roce.client = NULL;
|
|
|
|
|
}
|
|
|
|
|
if (client->type == HNAE3_CLIENT_ROCE)
|
|
|
|
|
return;
|
|
|
|
|
if (hdev->nic_client && client->ops->uninit_instance) {
|
|
|
|
|
clear_bit(HCLGE_STATE_NIC_REGISTERED, &hdev->state);
|
|
|
|
|
while (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state))
|
|
|
|
|
msleep(HCLGE_WAIT_RESET_DONE);
|
|
|
|
|
hdev->roce_client->ops->uninit_instance(&vport->roce, 0);
|
|
|
|
|
hdev->roce_client = NULL;
|
|
|
|
|
vport->roce.client = NULL;
|
|
|
|
|
}
|
|
|
|
|
if (client->type == HNAE3_CLIENT_ROCE)
|
|
|
|
|
return;
|
|
|
|
|
if (hdev->nic_client && client->ops->uninit_instance) {
|
|
|
|
|
clear_bit(HCLGE_STATE_NIC_REGISTERED, &hdev->state);
|
|
|
|
|
while (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state))
|
|
|
|
|
msleep(HCLGE_WAIT_RESET_DONE);
|
|
|
|
|
|
|
|
|
|
client->ops->uninit_instance(&vport->nic, 0);
|
|
|
|
|
hdev->nic_client = NULL;
|
|
|
|
|
vport->nic.client = NULL;
|
|
|
|
|
}
|
|
|
|
|
client->ops->uninit_instance(&vport->nic, 0);
|
|
|
|
|
hdev->nic_client = NULL;
|
|
|
|
|
vport->nic.client = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|