Commit 5008e61d authored by Peiyang Wang's avatar Peiyang Wang Committed by Hao Chen
Browse files

net: hns3:support enable or disable pfc strom prevent

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAQ6G2



----------------------------------------------------------------------

this patch provides users with an interface to control whether to enable
the pfc strom prevent.

Fixes: 26f6cbad ("net: hns3: add supports pfc storm detection and suppression")
Signed-off-by: default avatarPeiyang Wang <wangpeiyang1@huawei.com>
Signed-off-by: default avatarHao Chen <chenhao418@huawei.com>
parent f07a54f8
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -656,6 +656,10 @@ enum hnae3_unic_addr_type {
 *   Execute debugfs read command.
 * request_flush_qb_config
 *   Request to update queue bonding configuration
 * request_pfc_storm_config
 *   Request to update pfc storm configuration
 * get_pfc_storm_config
 *   Get pfc storm config
 * query_fd_qb_state
 *   Query whether hw queue bonding enabled
 * set_tx_hwts_info
@@ -855,6 +859,9 @@ struct hnae3_ae_ops {
	int (*set_phy_link_ksettings)(struct hnae3_handle *handle,
				      const struct ethtool_link_ksettings *cmd);
	void (*request_flush_qb_config)(struct hnae3_handle *handle);
	void (*request_pfc_storm_config)(struct hnae3_handle *handle,
					 bool enable);
	int (*get_pfc_storm_config)(struct hnae3_handle *handle, bool *enable);
	bool (*query_fd_qb_state)(struct hnae3_handle *handle);
	bool (*set_tx_hwts_info)(struct hnae3_handle *handle,
				 struct sk_buff *skb);
@@ -1016,6 +1023,7 @@ enum hnae3_pflag {
	HNAE3_PFLAG_PUSH_ENABLE,
	HNAE3_PFLAG_FD_QB_ENABLE,
	HNAE3_PFLAG_ROH_ARP_PROXY_ENABLE,
	HNAE3_PFLAG_PFC_STORM_PREVENT_ENABLE,
	HNAE3_PFLAG_MAX
};

+12 −0
Original line number Diff line number Diff line
@@ -5732,6 +5732,18 @@ static void hns3_state_init(struct hnae3_handle *handle)
			&handle->supported_pflags);
		set_bit(HNAE3_PFLAG_ROH_ARP_PROXY_ENABLE, &handle->priv_flags);
	}

	if (handle->ae_algo->ops->get_pfc_storm_config) {
		bool enable = true;
		int ret = handle->ae_algo->ops->get_pfc_storm_config(handle,
								     &enable);

		set_bit(HNAE3_PFLAG_PFC_STORM_PREVENT_ENABLE,
			&handle->supported_pflags);
		if (!ret && enable)
			set_bit(HNAE3_PFLAG_PFC_STORM_PREVENT_ENABLE,
				&handle->priv_flags);
	}
}

static void hns3_state_uninit(struct hnae3_handle *handle)
+12 −0
Original line number Diff line number Diff line
@@ -548,11 +548,23 @@ static void hns3_update_roh_arp_proxy_enable(struct net_device *netdev,
		    enable ? "enable" : "disable");
}

static void hns3_update_pfc_storm_prevent_enable(struct net_device *netdev,
						 bool enable)
{
	struct hnae3_handle *handle = hns3_get_handle(netdev);

	if (!handle->ae_algo->ops->request_pfc_storm_config)
		return;

	handle->ae_algo->ops->request_pfc_storm_config(handle, enable);
}

static const struct hns3_pflag_desc hns3_priv_flags[HNAE3_PFLAG_MAX] = {
	{ "limit_promisc",	hns3_update_limit_promisc_mode },
	{ "tx_push_enable",	hns3_update_push_state },
	{ "qb_enable",		hns3_update_fd_qb_state },
	{ "roh_arp_proxy_enable",	hns3_update_roh_arp_proxy_enable },
	{ "pfc_storm_prevent_enable",	hns3_update_pfc_storm_prevent_enable },
};

static int hns3_get_sset_count(struct net_device *netdev, int stringset)
+9 −0
Original line number Diff line number Diff line
@@ -946,6 +946,15 @@ struct hclge_config_fastpath_cmd {
	u8 rsv1[8];
};

struct hclge_pfc_storm_para_cmd {
	__le32 dir;
	__le32 enable;
	__le32 period_ms;
	__le32 times;
	__le32 recovery_period_ms;
	__le32 rsv;
};

struct hclge_hw;
int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num);
enum hclge_comm_cmd_status hclge_cmd_mdio_write(struct hclge_hw *hw,
+0 −9
Original line number Diff line number Diff line
@@ -77,15 +77,6 @@ struct hclge_port_num_info_cmd {
	u8 rsv[20];
};

struct hclge_pfc_storm_para_cmd {
	__le32 dir;
	__le32 enable;
	__le32 period_ms;
	__le32 times;
	__le32 recovery_period_ms;
	__le32 rsv;
};

struct hclge_notify_pkt_param_cmd {
	__le32 cfg;
	__le32 ipg;
Loading