Skip to content

Commit

Permalink
Merge branch 'hns3-next'
Browse files Browse the repository at this point in the history
Guangbin Huang says:

====================
net: hns3: updates for -next

This series includes some updates for the HNS3 ethernet driver.

Change logs:
V1 -> V2:
 - Fix some sparse warnings of patch 3# and 4#.
 - Add patch #6 to fix sparse warnings of incorrect type of argument.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed May 9, 2022
2 parents 1728c05 + 443edfd commit 9c095bd
Show file tree
Hide file tree
Showing 11 changed files with 275 additions and 166 deletions.
62 changes: 53 additions & 9 deletions drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ enum HCLGE_MBX_OPCODE {
HCLGE_MBX_PUSH_PROMISC_INFO, /* (PF -> VF) push vf promisc info */
HCLGE_MBX_VF_UNINIT, /* (VF -> PF) vf is unintializing */
HCLGE_MBX_HANDLE_VF_TBL, /* (VF -> PF) store/clear hw table */
HCLGE_MBX_GET_RING_VECTOR_MAP, /* (VF -> PF) get ring-to-vector map */

HCLGE_MBX_GET_VF_FLR_STATUS = 200, /* (M7 -> PF) get vf flr status */
HCLGE_MBX_PUSH_LINK_STATUS, /* (M7 -> PF) get port link status */
Expand Down Expand Up @@ -92,8 +93,8 @@ struct hclge_ring_chain_param {
struct hclge_basic_info {
u8 hw_tc_map;
u8 rsv;
u16 mbx_api_version;
u32 pf_caps;
__le16 mbx_api_version;
__le32 pf_caps;
};

struct hclgevf_mbx_resp_status {
Expand Down Expand Up @@ -134,13 +135,13 @@ struct hclge_vf_to_pf_msg {
};

struct hclge_pf_to_vf_msg {
u16 code;
__le16 code;
union {
/* used for mbx response */
struct {
u16 vf_mbx_msg_code;
u16 vf_mbx_msg_subcode;
u16 resp_status;
__le16 vf_mbx_msg_code;
__le16 vf_mbx_msg_subcode;
__le16 resp_status;
u8 resp_data[HCLGE_MBX_MAX_RESP_DATA_SIZE];
};
/* used for general mbx */
Expand All @@ -157,7 +158,7 @@ struct hclge_mbx_vf_to_pf_cmd {
u8 rsv1[1];
u8 msg_len;
u8 rsv2;
u16 match_id;
__le16 match_id;
struct hclge_vf_to_pf_msg msg;
};

Expand All @@ -168,7 +169,7 @@ struct hclge_mbx_pf_to_vf_cmd {
u8 rsv[3];
u8 msg_len;
u8 rsv1;
u16 match_id;
__le16 match_id;
struct hclge_pf_to_vf_msg msg;
};

Expand All @@ -178,6 +179,49 @@ struct hclge_vf_rst_cmd {
u8 rsv[22];
};

#pragma pack(1)
struct hclge_mbx_link_status {
__le16 link_status;
__le32 speed;
__le16 duplex;
u8 flag;
};

struct hclge_mbx_link_mode {
__le16 idx;
__le64 link_mode;
};

struct hclge_mbx_port_base_vlan {
__le16 state;
__le16 vlan_proto;
__le16 qos;
__le16 vlan_tag;
};

struct hclge_mbx_vf_queue_info {
__le16 num_tqps;
__le16 rss_size;
__le16 rx_buf_len;
};

struct hclge_mbx_vf_queue_depth {
__le16 num_tx_desc;
__le16 num_rx_desc;
};

struct hclge_mbx_vlan_filter {
u8 is_kill;
__le16 vlan_id;
__le16 proto;
};

struct hclge_mbx_mtu_info {
__le32 mtu;
};

#pragma pack()

/* used by VF to store the received Async responses from PF */
struct hclgevf_mbx_arq_ring {
#define HCLGE_MBX_MAX_ARQ_MSG_SIZE 8
Expand All @@ -186,7 +230,7 @@ struct hclgevf_mbx_arq_ring {
u32 head;
u32 tail;
atomic_t count;
u16 msg_q[HCLGE_MBX_MAX_ARQ_MSG_NUM][HCLGE_MBX_MAX_ARQ_MSG_SIZE];
__le16 msg_q[HCLGE_MBX_MAX_ARQ_MSG_NUM][HCLGE_MBX_MAX_ARQ_MSG_SIZE];
};

#define hclge_mbx_ring_ptr_move_crq(crq) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int hclge_comm_parse_rss_hfunc(struct hclge_comm_rss_cfg *rss_cfg,
void hclge_comm_get_rss_hash_info(struct hclge_comm_rss_cfg *rss_cfg, u8 *key,
u8 *hfunc);
void hclge_comm_get_rss_indir_tbl(struct hclge_comm_rss_cfg *rss_cfg,
u32 *indir, __le16 rss_ind_tbl_size);
u32 *indir, u16 rss_ind_tbl_size);
int hclge_comm_set_rss_algo_key(struct hclge_comm_hw *hw, const u8 hfunc,
const u8 *key);
int hclge_comm_init_rss_tuple_cmd(struct hclge_comm_rss_cfg *rss_cfg,
Expand Down
7 changes: 5 additions & 2 deletions drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1915,8 +1915,11 @@ static int hns3_set_tunable(struct net_device *netdev,
return ret;
}

netdev_info(netdev, "the active tx spare buf size is %u, due to page order\n",
priv->ring->tx_spare->len);
if (!priv->ring->tx_spare)
netdev_info(netdev, "the active tx spare buf size is 0, disable tx spare buffer\n");
else
netdev_info(netdev, "the active tx spare buf size is %u, due to page order\n",
priv->ring->tx_spare->len);

break;
default:
Expand Down
27 changes: 1 addition & 26 deletions drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1546,9 +1546,8 @@ static void hclge_init_tc_config(struct hclge_dev *hdev)
static int hclge_configure(struct hclge_dev *hdev)
{
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(hdev->pdev);
const struct cpumask *cpumask = cpu_online_mask;
struct hclge_cfg cfg;
int node, ret;
int ret;

ret = hclge_get_cfg(hdev, &cfg);
if (ret)
Expand Down Expand Up @@ -1594,13 +1593,6 @@ static int hclge_configure(struct hclge_dev *hdev)
hclge_init_tc_config(hdev);
hclge_init_kdump_kernel_config(hdev);

/* Set the affinity based on numa node */
node = dev_to_node(&hdev->pdev->dev);
if (node != NUMA_NO_NODE)
cpumask = cpumask_of_node(node);

cpumask_copy(&hdev->affinity_mask, cpumask);

return ret;
}

Expand Down Expand Up @@ -3564,17 +3556,6 @@ static void hclge_get_misc_vector(struct hclge_dev *hdev)
hdev->num_msi_used += 1;
}

static void hclge_misc_affinity_setup(struct hclge_dev *hdev)
{
irq_set_affinity_hint(hdev->misc_vector.vector_irq,
&hdev->affinity_mask);
}

static void hclge_misc_affinity_teardown(struct hclge_dev *hdev)
{
irq_set_affinity_hint(hdev->misc_vector.vector_irq, NULL);
}

static int hclge_misc_irq_init(struct hclge_dev *hdev)
{
int ret;
Expand Down Expand Up @@ -11457,11 +11438,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
timer_setup(&hdev->reset_timer, hclge_reset_timer, 0);
INIT_DELAYED_WORK(&hdev->service_task, hclge_service_task);

/* Setup affinity after service timer setup because add_timer_on
* is called in affinity notify.
*/
hclge_misc_affinity_setup(hdev);

hclge_clear_all_event_cause(hdev);
hclge_clear_resetting_state(hdev);

Expand Down Expand Up @@ -11879,7 +11855,6 @@ static void hclge_uninit_ae_dev(struct hnae3_ae_dev *ae_dev)

hclge_reset_vf_rate(hdev);
hclge_clear_vf_vlan(hdev);
hclge_misc_affinity_teardown(hdev);
hclge_state_uninit(hdev);
hclge_ptp_uninit(hdev);
hclge_uninit_rxd_adv_layout(hdev);
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,8 @@ struct hclge_vf_vlan_cfg {
union {
struct {
u8 is_kill;
u16 vlan;
u16 proto;
__le16 vlan;
__le16 proto;
};
u8 enable;
};
Expand Down Expand Up @@ -938,8 +938,6 @@ struct hclge_dev {
DECLARE_KFIFO(mac_tnl_log, struct hclge_mac_tnl_stats,
HCLGE_MAC_TNL_LOG_SIZE);

/* affinity mask and notify for misc interrupt */
cpumask_t affinity_mask;
struct hclge_ptp *ptp;
struct devlink *devlink;
struct hclge_comm_rss_cfg rss_cfg;
Expand Down
Loading

0 comments on commit 9c095bd

Please sign in to comment.