Commit 418b0866 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'hns3-new-features'



Guangbin Huang says:

====================
hns3: add some new features

This series adds some new features for the HNS3 ethernet driver.

Patches #1~#3 support configuring dscp map to tc.

Patch 4# supports querying FEC statistics by command "ethtool -I --show-fec eth0".

Patch 5# supports querying and setting Serdes lane number.

Change logs:
V1 -> V2:
 - fix build error of patch 1# reported by robot lkp@intel.com.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 2018b22a 0f032f93
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
@@ -97,6 +97,8 @@ enum HNAE3_DEV_CAP_BITS {
	HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B,
	HNAE3_DEV_SUPPORT_MC_MAC_MNG_B,
	HNAE3_DEV_SUPPORT_CQ_B,
	HNAE3_DEV_SUPPORT_FEC_STATS_B,
	HNAE3_DEV_SUPPORT_LANE_NUM_B,
};

#define hnae3_ae_dev_fd_supported(ae_dev) \
@@ -159,6 +161,12 @@ enum HNAE3_DEV_CAP_BITS {
#define hnae3_ae_dev_cq_supported(ae_dev) \
	test_bit(HNAE3_DEV_SUPPORT_CQ_B, (ae_dev)->caps)

#define hnae3_ae_dev_fec_stats_supported(ae_dev) \
	test_bit(HNAE3_DEV_SUPPORT_FEC_STATS_B, (ae_dev)->caps)

#define hnae3_ae_dev_lane_num_supported(ae_dev) \
	test_bit(HNAE3_DEV_SUPPORT_LANE_NUM_B, (ae_dev)->caps)

enum HNAE3_PF_CAP_BITS {
	HNAE3_PF_SUPPORT_VLAN_FLTR_MDF_B = 0,
};
@@ -272,6 +280,7 @@ enum hnae3_dbg_cmd {
	HNAE3_DBG_CMD_TC_SCH_INFO,
	HNAE3_DBG_CMD_QOS_PAUSE_CFG,
	HNAE3_DBG_CMD_QOS_PRI_MAP,
	HNAE3_DBG_CMD_QOS_DSCP_MAP,
	HNAE3_DBG_CMD_QOS_BUF_CFG,
	HNAE3_DBG_CMD_DEV_INFO,
	HNAE3_DBG_CMD_TX_BD,
@@ -310,6 +319,11 @@ enum hnae3_dbg_cmd {
	HNAE3_DBG_CMD_UNKNOWN,
};

enum hnae3_tc_map_mode {
	HNAE3_TC_MAP_MODE_PRIO,
	HNAE3_TC_MAP_MODE_DSCP,
};

struct hnae3_vector_info {
	u8 __iomem *io_addr;
	int vector;
@@ -562,14 +576,17 @@ struct hnae3_ae_ops {
	void (*client_stop)(struct hnae3_handle *handle);
	int (*get_status)(struct hnae3_handle *handle);
	void (*get_ksettings_an_result)(struct hnae3_handle *handle,
					u8 *auto_neg, u32 *speed, u8 *duplex);
					u8 *auto_neg, u32 *speed, u8 *duplex,
					u32 *lane_num);

	int (*cfg_mac_speed_dup_h)(struct hnae3_handle *handle, int speed,
				   u8 duplex);
				   u8 duplex, u8 lane_num);

	void (*get_media_type)(struct hnae3_handle *handle, u8 *media_type,
			       u8 *module_type);
	int (*check_port_speed)(struct hnae3_handle *handle, u32 speed);
	void (*get_fec_stats)(struct hnae3_handle *handle,
			      struct ethtool_fec_stats *fec_stats);
	void (*get_fec)(struct hnae3_handle *handle, u8 *fec_ability,
			u8 *fec_mode);
	int (*set_fec)(struct hnae3_handle *handle, u32 fec_mode);
@@ -739,6 +756,8 @@ struct hnae3_ae_ops {
	int (*get_link_diagnosis_info)(struct hnae3_handle *handle,
				       u32 *status_code);
	void (*clean_vf_config)(struct hnae3_ae_dev *ae_dev, int num_vfs);
	int (*get_dscp_prio)(struct hnae3_handle *handle, u8 dscp,
			     u8 *tc_map_mode, u8 *priority);
};

struct hnae3_dcb_ops {
@@ -747,6 +766,8 @@ struct hnae3_dcb_ops {
	int (*ieee_setets)(struct hnae3_handle *, struct ieee_ets *);
	int (*ieee_getpfc)(struct hnae3_handle *, struct ieee_pfc *);
	int (*ieee_setpfc)(struct hnae3_handle *, struct ieee_pfc *);
	int (*ieee_setapp)(struct hnae3_handle *h, struct dcb_app *app);
	int (*ieee_delapp)(struct hnae3_handle *h, struct dcb_app *app);

	/* DCBX configuration */
	u8   (*getdcbx)(struct hnae3_handle *);
@@ -786,6 +807,7 @@ struct hnae3_knic_private_info {
	u32 tx_spare_buf_size;

	struct hnae3_tc_info tc_info;
	u8 tc_map_mode;

	u16 num_tqps;		  /* total number of TQPs in this handle */
	struct hnae3_queue **tqp;  /* array base of all TQPs in this instance */
+2 −0
Original line number Diff line number Diff line
@@ -153,6 +153,8 @@ static const struct hclge_comm_caps_bit_map hclge_pf_cmd_caps[] = {
	{HCLGE_COMM_CAP_CQ_B, HNAE3_DEV_SUPPORT_CQ_B},
	{HCLGE_COMM_CAP_GRO_B, HNAE3_DEV_SUPPORT_GRO_B},
	{HCLGE_COMM_CAP_FD_B, HNAE3_DEV_SUPPORT_FD_B},
	{HCLGE_COMM_CAP_FEC_STATS_B, HNAE3_DEV_SUPPORT_FEC_STATS_B},
	{HCLGE_COMM_CAP_LANE_NUM_B, HNAE3_DEV_SUPPORT_LANE_NUM_B},
};

static const struct hclge_comm_caps_bit_map hclge_vf_cmd_caps[] = {
+3 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ enum hclge_opcode_type {
	HCLGE_OPC_MAC_TNL_INT_EN	= 0x0311,
	HCLGE_OPC_CLEAR_MAC_TNL_INT	= 0x0312,
	HCLGE_OPC_COMMON_LOOPBACK       = 0x0315,
	HCLGE_OPC_QUERY_FEC_STATS	= 0x0316,
	HCLGE_OPC_CONFIG_FEC_MODE	= 0x031A,
	HCLGE_OPC_QUERY_ROH_TYPE_INFO	= 0x0389,

@@ -342,6 +343,8 @@ enum HCLGE_COMM_CAP_BITS {
	HCLGE_COMM_CAP_CQ_B = 18,
	HCLGE_COMM_CAP_GRO_B = 20,
	HCLGE_COMM_CAP_FD_B = 21,
	HCLGE_COMM_CAP_FEC_STATS_B = 25,
	HCLGE_COMM_CAP_LANE_NUM_B = 27,
};

enum HCLGE_COMM_API_CAP_BITS {
+28 −0
Original line number Diff line number Diff line
@@ -56,6 +56,32 @@ static int hns3_dcbnl_ieee_setpfc(struct net_device *ndev, struct ieee_pfc *pfc)
	return -EOPNOTSUPP;
}

static int hns3_dcbnl_ieee_setapp(struct net_device *ndev, struct dcb_app *app)
{
	struct hnae3_handle *h = hns3_get_handle(ndev);

	if (hns3_nic_resetting(ndev))
		return -EBUSY;

	if (h->kinfo.dcb_ops->ieee_setapp)
		return h->kinfo.dcb_ops->ieee_setapp(h, app);

	return -EOPNOTSUPP;
}

static int hns3_dcbnl_ieee_delapp(struct net_device *ndev, struct dcb_app *app)
{
	struct hnae3_handle *h = hns3_get_handle(ndev);

	if (hns3_nic_resetting(ndev))
		return -EBUSY;

	if (h->kinfo.dcb_ops->ieee_setapp)
		return h->kinfo.dcb_ops->ieee_delapp(h, app);

	return -EOPNOTSUPP;
}

/* DCBX configuration */
static u8 hns3_dcbnl_getdcbx(struct net_device *ndev)
{
@@ -83,6 +109,8 @@ static const struct dcbnl_rtnl_ops hns3_dcbnl_ops = {
	.ieee_setets	= hns3_dcbnl_ieee_setets,
	.ieee_getpfc	= hns3_dcbnl_ieee_getpfc,
	.ieee_setpfc	= hns3_dcbnl_ieee_setpfc,
	.ieee_setapp    = hns3_dcbnl_ieee_setapp,
	.ieee_delapp    = hns3_dcbnl_ieee_delapp,
	.getdcbx	= hns3_dcbnl_getdcbx,
	.setdcbx	= hns3_dcbnl_setdcbx,
};
+13 −0
Original line number Diff line number Diff line
@@ -105,6 +105,13 @@ static struct hns3_dbg_cmd_info hns3_dbg_cmd[] = {
		.buf_len = HNS3_DBG_READ_LEN,
		.init = hns3_dbg_common_file_init,
	},
	{
		.name = "qos_dscp_map",
		.cmd = HNAE3_DBG_CMD_QOS_DSCP_MAP,
		.dentry = HNS3_DBG_DENTRY_TM,
		.buf_len = HNS3_DBG_READ_LEN,
		.init = hns3_dbg_common_file_init,
	},
	{
		.name = "qos_buf_cfg",
		.cmd = HNAE3_DBG_CMD_QOS_BUF_CFG,
@@ -395,6 +402,12 @@ static struct hns3_dbg_cap_info hns3_dbg_cap[] = {
	}, {
		.name = "support modify vlan filter state",
		.cap_bit = HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B,
	}, {
		.name = "support FEC statistics",
		.cap_bit = HNAE3_DEV_SUPPORT_FEC_STATS_B,
	}, {
		.name = "support lane num",
		.cap_bit = HNAE3_DEV_SUPPORT_LANE_NUM_B,
	}
};

Loading