Commit 3f843891 authored by Hao Chen's avatar Hao Chen Committed by Jiantao Xiao
Browse files

net: hns3: add support to get/set 1d torus param

driver inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I97T47


CVE: NA

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

Two network ports on a single chip can be physically connected to form
a 1d torus topology. TCP/UDP and RDMA communication between chip nodes
can be implemented without switches.The patch provide interfaces for
getting/setting 1d torus param.

Signed-off-by: default avatarHao Chen <chenhao418@huawei.com>
Signed-off-by: default avatarJiantao Xiao <xiaojiantao1@h-partners.com>
parent b606898e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
#define HNAE3_DEVICE_VERSION_V1   0x00020
#define HNAE3_DEVICE_VERSION_V2   0x00021
#define HNAE3_DEVICE_VERSION_V3   0x00030
#define HNAE3_DEVICE_VERSION_V4   0x00032

#define HNAE3_PCI_REVISION_BIT_SIZE		8

+8 −0
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ enum hnae3_ext_opcode {
	HNAE3_EXT_OPC_SET_PFC_STORM_PARA,
	HNAE3_EXT_OPC_SET_NOTIFY_PARAM,
	HNAE3_EXT_OPC_SET_NOTIFY_START,
	HNAE3_EXT_OPC_SET_TORUS_PARAM,
	HNAE3_EXT_OPC_GET_TORUS_PARAM,
};

struct hnae3_pfc_storm_para {
@@ -50,4 +52,10 @@ struct hnae3_notify_pkt_param {
	u8 init;     /* initialization flag, product does not need to set value */
	u8 data[64]; /* note packet data */
};

struct hnae3_torus_param {
	u32 enable;       /* 1d torus mode enable */
	u32 mac_id;       /* export mac id of port */
	u8 is_node0;      /* if current node is node0 */
};
#endif
+3 −0
Original line number Diff line number Diff line
@@ -312,7 +312,10 @@ enum hclge_opcode_type {
	HCLGE_OPC_QUERY_LINK_DIAGNOSIS	= 0x702A,

	/* EXT command */
	HCLGE_OPC_CONFIG_SWITCH_PARAM = 0x1033,
	HCLGE_OPC_CONFIG_VLAN_FILTER = 0x1100,
	HCLGE_OPC_SET_NOTIFY_PKT = 0x180A,
	HCLGE_OPC_CONFIG_1D_TORUS = 0x2300,
	HCLGE_OPC_CFG_PAUSE_STORM_PARA = 0x7019,
};

+17 −0
Original line number Diff line number Diff line
@@ -157,3 +157,20 @@ int nic_set_notify_pkt_start(struct net_device *ndev)
	return nic_invoke_pri_ops(ndev, HNAE3_EXT_OPC_SET_NOTIFY_START, NULL, 0);
}
EXPORT_SYMBOL(nic_set_notify_pkt_start);

int nic_set_torus_param(struct net_device *ndev, struct hnae3_torus_param *param)
{
	if (!param || (param->enable != 0 && param->enable != 1))
		return -EINVAL;

	return nic_invoke_pri_ops(ndev, HNAE3_EXT_OPC_SET_TORUS_PARAM,
				  param, sizeof(*param));
}
EXPORT_SYMBOL(nic_set_torus_param);

int nic_get_torus_param(struct net_device *ndev, struct hnae3_torus_param *param)
{
	return nic_invoke_pri_ops(ndev, HNAE3_EXT_OPC_GET_TORUS_PARAM,
				  param, sizeof(*param));
}
EXPORT_SYMBOL(nic_get_torus_param);
+2 −0
Original line number Diff line number Diff line
@@ -24,4 +24,6 @@ int nic_get_pfc_storm_para(struct net_device *ndev, u32 dir, u32 *enable,
int nic_set_notify_pkt_param(struct net_device *ndev,
			     struct hnae3_notify_pkt_param *param);
int nic_set_notify_pkt_start(struct net_device *ndev);
int nic_set_torus_param(struct net_device *ndev, struct hnae3_torus_param *param);
int nic_get_torus_param(struct net_device *ndev, struct hnae3_torus_param *param);
#endif
Loading