Skip to contentSkip to conversation

qed*/devlink: Devlink support for config attributes.

PATCH In review Sudarsana Reddy Kalluru 2 participants 11 messages Jul 4, 2019 – Jul 9, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v2 cover qed*/devlink: Devlink support for config attributes.

The patch series adds support for managing the config attributes using devlink interfaces.

Patch (1) adds the APIs for publishing the devlink port params. Clubbing this qed patches as per the review comment (i.e., need at least one consumer for the new APIs).

Patches (2)-(4) adds the qed/qede devlink support for managing the device/port attributes.

Please consider applying it to 'net-next' tree.

Sudarsana Reddy Kalluru (4):
devlink: Add APIs to publish/unpublish the port parameters.
qed: Add APIs for device attributes configuration. qed*: Add new file for devlink implementation. qed*: Add devlink support for configuration attributes.

 Documentation/networking/devlink-params-qede.txt |  72 ++++++
 drivers/net/ethernet/qlogic/qed/qed.h            |   1 -
 drivers/net/ethernet/qlogic/qed/qed_hsi.h        |  17 ++
 drivers/net/ethernet/qlogic/qed/qed_main.c       | 160 ++++--------
 drivers/net/ethernet/qlogic/qed/qed_mcp.c        |  64 +++++
 drivers/net/ethernet/qlogic/qed/qed_mcp.h        |  14 ++
 drivers/net/ethernet/qlogic/qede/Makefile        |   2 +-
 drivers/net/ethernet/qlogic/qede/qede.h          |   5 +
 drivers/net/ethernet/qlogic/qede/qede_devlink.c  | 294 +++++++++++++++++++++++
 drivers/net/ethernet/qlogic/qede/qede_devlink.h  |  41 ++++
 drivers/net/ethernet/qlogic/qede/qede_main.c     |  13 +
 include/linux/qed/qed_if.h                       |  19 ++
 include/net/devlink.h                            |   2 +
 net/core/devlink.c                               |  42 ++++
 14 files changed, 634 insertions(+), 112 deletions(-)
 create mode 100644 Documentation/networking/devlink-params-qede.txt
 create mode 100644 drivers/net/ethernet/qlogic/qede/qede_devlink.c
 create mode 100644 drivers/net/ethernet/qlogic/qede/qede_devlink.h
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v2 1/4 devlink: Add APIs to publish/unpublish the port parameters.

Kernel has no interface to publish the devlink port parameters. This is required for exporting the port params to the user space, so that user can read or update the port params.
This patch adds devlink interfaces (for drivers) to publish/unpublish the devlink port parameters.

---
 include/net/devlink.h |  2 ++
 net/core/devlink.c    | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
include/net/devlink.h +2 -0
index 6625ea0..47a1e8f 100644
@@ -653,6 +653,8 @@ int devlink_port_params_register(struct devlink_port *devlink_port,
 void devlink_port_params_unregister(struct devlink_port *devlink_port,
 				    const struct devlink_param *params,
 				    size_t params_count);
+void devlink_port_params_publish(struct devlink_port *devlink_port);
+void devlink_port_params_unpublish(struct devlink_port *ddevlink_port);
 int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
 				       union devlink_param_value *init_val);
 int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
net/core/devlink.c +42 -0

48 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v2 2/4 qed: Add APIs for device attributes configuration.

In reply to Sudarsana Reddy Kalluru

The patch adds driver APIs for reading/configuring the device attributes.

---
 drivers/net/ethernet/qlogic/qed/qed_hsi.h | 17 ++++++++
 drivers/net/ethernet/qlogic/qed/qed_mcp.c | 64 +++++++++++++++++++++++++++++++
 drivers/net/ethernet/qlogic/qed/qed_mcp.h | 14 +++++++
 3 files changed, 95 insertions(+)
drivers/net/ethernet/qlogic/qed/qed_hsi.h +17 -0
index e054f6c..557a12e 100644
@@ -12580,6 +12580,8 @@ struct public_drv_mb {
 #define DRV_MSG_CODE_BW_UPDATE_ACK		0x32000000
 #define DRV_MSG_CODE_NIG_DRAIN			0x30000000
 #define DRV_MSG_CODE_S_TAG_UPDATE_ACK		0x3b000000
+#define DRV_MSG_CODE_GET_NVM_CFG_OPTION		0x003e0000
+#define DRV_MSG_CODE_SET_NVM_CFG_OPTION		0x003f0000
 #define DRV_MSG_CODE_INITIATE_PF_FLR            0x02010000
 #define DRV_MSG_CODE_VF_DISABLED_DONE		0xc0000000
 #define DRV_MSG_CODE_CFG_VF_MSIX		0xc0010000
@@ -12748,6 +12750,21 @@ struct public_drv_mb {
 #define DRV_MB_PARAM_FEATURE_SUPPORT_PORT_EEE		0x00000002
 #define DRV_MB_PARAM_FEATURE_SUPPORT_FUNC_VLINK		0x00010000
 
+#define DRV_MB_PARAM_NVM_CFG_OPTION_ID_SHIFT		0
+#define DRV_MB_PARAM_NVM_CFG_OPTION_ID_MASK		0x0000FFFF
+#define DRV_MB_PARAM_NVM_CFG_OPTION_ALL_SHIFT		16
+#define DRV_MB_PARAM_NVM_CFG_OPTION_ALL_MASK		0x00010000
+#define DRV_MB_PARAM_NVM_CFG_OPTION_INIT_SHIFT		17
+#define DRV_MB_PARAM_NVM_CFG_OPTION_INIT_MASK		0x00020000
+#define DRV_MB_PARAM_NVM_CFG_OPTION_COMMIT_SHIFT	18
+#define DRV_MB_PARAM_NVM_CFG_OPTION_COMMIT_MASK		0x00040000
+#define DRV_MB_PARAM_NVM_CFG_OPTION_FREE_SHIFT		19
+#define DRV_MB_PARAM_NVM_CFG_OPTION_FREE_MASK		0x00080000
+#define DRV_MB_PARAM_NVM_CFG_OPTION_ENTITY_SEL_SHIFT	20
+#define DRV_MB_PARAM_NVM_CFG_OPTION_ENTITY_SEL_MASK	0x00100000
+#define DRV_MB_PARAM_NVM_CFG_OPTION_ENTITY_ID_SHIFT	24
+#define DRV_MB_PARAM_NVM_CFG_OPTION_ENTITY_ID_MASK	0x0f000000
+
 	u32 fw_mb_header;
 #define FW_MSG_CODE_MASK			0xffff0000
 #define FW_MSG_CODE_UNSUPPORTED                 0x00000000
drivers/net/ethernet/qlogic/qed/qed_mcp.c +64 -0

67 lines not on this page · raw message

drivers/net/ethernet/qlogic/qed/qed_mcp.h +14 -0
index e4f8fe4..550b4dd 100644
@@ -251,6 +251,12 @@ struct qed_mfw_tlv_generic {
 	struct qed_mfw_tlv_iscsi iscsi;
 };
 
+#define QED_NVM_CFG_OPTION_ALL		BIT(0)
+#define QED_NVM_CFG_OPTION_INIT		BIT(1)
+#define QED_NVM_CFG_OPTION_COMMIT       BIT(2)
+#define QED_NVM_CFG_OPTION_FREE		BIT(3)
+#define QED_NVM_CFG_OPTION_ENTITY_SEL	BIT(4)
+
 /**
  * @brief - returns the link params of the hw function
  *
@@ -1202,4 +1208,12 @@ void qed_mcp_resc_lock_default_init(struct qed_resc_lock_params *p_lock,
  */
 int qed_mcp_get_ppfid_bitmap(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
 
+int qed_mcp_nvm_get_cfg(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
+			u16 option_id, u8 entity_id, u16 flags, u8 *p_buf,
+			u32 *p_len);
+
+int qed_mcp_nvm_set_cfg(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
+			u16 option_id, u8 entity_id, u16 flags, u8 *p_buf,
+			u32 len);
+
 #endif
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH v2 3/4 qed*: Add new file for devlink implementation.

In reply to Sudarsana Reddy Kalluru

Moving devlink implementation from qed to qede driver. The change is required as qede is the actual PCI driver and qed is only the control driver.

---
 drivers/net/ethernet/qlogic/qed/qed.h           |   1 -
 drivers/net/ethernet/qlogic/qed/qed_main.c      | 122 +++---------------------
 drivers/net/ethernet/qlogic/qede/Makefile       |   2 +-
 drivers/net/ethernet/qlogic/qede/qede.h         |   2 +
 drivers/net/ethernet/qlogic/qede/qede_devlink.c |  94 ++++++++++++++++++
 drivers/net/ethernet/qlogic/qede/qede_devlink.h |  18 ++++
 drivers/net/ethernet/qlogic/qede/qede_main.c    |  13 +++
 include/linux/qed/qed_if.h                      |   3 +
 8 files changed, 143 insertions(+), 112 deletions(-)
 create mode 100644 drivers/net/ethernet/qlogic/qede/qede_devlink.c
 create mode 100644 drivers/net/ethernet/qlogic/qede/qede_devlink.h
drivers/net/ethernet/qlogic/qed/qed.h +0 -1
index 89fe091..cebd822 100644
@@ -864,7 +864,6 @@ struct qed_dev {
 	u32 rdma_max_srq_sge;
 	u16 tunn_feature_mask;
 
-	struct devlink			*dl;
 	bool				iwarp_cmt;
 };
 
drivers/net/ethernet/qlogic/qed/qed_main.c +12 -110

158 lines not on this page · raw message

drivers/net/ethernet/qlogic/qede/Makefile +1 -1
index 3fc91d1..4585864 100644
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_QEDE) := qede.o
 
-qede-y := qede_main.o qede_fp.o qede_filter.o qede_ethtool.o qede_ptp.o
+qede-y := qede_main.o qede_fp.o qede_filter.o qede_ethtool.o qede_ptp.o qede_devlink.o
 qede-$(CONFIG_DCB) += qede_dcbnl.o
 qede-$(CONFIG_QED_RDMA) += qede_rdma.o
drivers/net/ethernet/qlogic/qede/qede.h +2 -0
index b972ab0..35ad5cd 100644
@@ -262,6 +262,8 @@ struct qede_dev {
 	struct qede_rdma_dev		rdma_info;
 
 	struct bpf_prog *xdp_prog;
+
+	struct devlink			*dl;
 };
 
 enum QEDE_STATE {
drivers/net/ethernet/qlogic/qede/qede_devlink.c new file +94 -0

94 lines not on this page · raw message

drivers/net/ethernet/qlogic/qede/qede_devlink.h new file +18 -0
new file mode 100644
index 0000000..5aa79dd
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _QEDE_DEVLINK_H
+#define _QEDE_DEVLINK_H
+#include <net/devlink.h>
+
+struct qede_devlink {
+	struct qede_dev *edev;
+};
+
+enum qede_devlink_param_id {
+	QEDE_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX,
+	QEDE_DEVLINK_PARAM_ID_IWARP_CMT,
+};
+
+int qede_devlink_register(struct qede_dev *edev);
+void qede_devlink_unregister(struct qede_dev *edev);
+
+#endif
drivers/net/ethernet/qlogic/qede/qede_main.c +13 -0
index d4a2966..cef946f 100644
@@ -62,6 +62,7 @@
 #include <linux/vmalloc.h>
 #include "qede.h"
 #include "qede_ptp.h"
+#include "qede_devlink.h"
 
 static char version[] =
 	"QLogic FastLinQ 4xxxx Ethernet Driver qede " DRV_MODULE_VERSION "\n";
@@ -1177,8 +1178,18 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
 	edev->rx_copybreak = QEDE_RX_HDR_SIZE;
 
 	qede_log_probe(edev);
+
+	rc = qede_devlink_register(edev);
+	if (rc) {
+		DP_INFO(edev, "Failed to register devlink.\n");
+		goto err5;
+	}
+
 	return 0;
 
+err5:
+	if (!is_vf)
+		qede_ptp_disable(edev);
 err4:
 	qede_rdma_dev_remove(edev, (mode == QEDE_PROBE_RECOVERY));
 err3:
@@ -1227,6 +1238,8 @@ static void __qede_remove(struct pci_dev *pdev, enum qede_remove_mode mode)
 
 	DP_INFO(edev, "Starting qede_remove\n");
 
+	qede_devlink_unregister(edev);
+
 	qede_rdma_dev_remove(edev, (mode == QEDE_REMOVE_RECOVERY));
 
 	if (mode != QEDE_REMOVE_RECOVERY) {
include/linux/qed/qed_if.h +3 -0
index eef02e6..7c41304 100644
@@ -1131,6 +1131,9 @@ struct qed_common_ops {
  * @param cdev
  */
 	u8 (*get_affin_hwfn_idx)(struct qed_dev *cdev);
+
+	bool (*get_iwarp_cmt)(struct qed_dev *cdev);
+	void (*set_iwarp_cmt)(struct qed_dev *cdev, bool iwarp_cmt);
 };
 
 #define MASK_FIELD(_name, _value) \
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH v2 4/4 qed*: Add devlink support for configuration attributes.

In reply to Sudarsana Reddy Kalluru

This patch adds implementation for devlink callbacks for reading and configuring the device attributes.

---
 Documentation/networking/devlink-params-qede.txt |  72 ++++++++
 drivers/net/ethernet/qlogic/qed/qed_main.c       |  38 +++++
 drivers/net/ethernet/qlogic/qede/qede.h          |   3 +
 drivers/net/ethernet/qlogic/qede/qede_devlink.c  | 202 ++++++++++++++++++++++-
 drivers/net/ethernet/qlogic/qede/qede_devlink.h  |  23 +++
 include/linux/qed/qed_if.h                       |  16 ++
 6 files changed, 353 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/networking/devlink-params-qede.txt
Documentation/networking/devlink-params-qede.txt new file +72 -0
new file mode 100644
index 0000000..f78a993
@@ -0,0 +1,72 @@
+enable_sriov		[DEVICE, GENERIC]
+			Configuration mode: Permanent
+
+iwarp_cmt		[DEVICE, DRIVER-SPECIFIC]
+			Enable iWARP support over 100G device (CMT mode).
+			Type: Boolean
+			Configuration mode: runtime
+
+entity_id		[DEVICE, DRIVER-SPECIFIC]
+			Set the entity ID value to be used for this device
+			while reading/configuring the devlink attributes.
+			Type: u8
+			Configuration mode: runtime
+
+device_capabilities	[DEVICE, DRIVER-SPECIFIC]
+			Set the entity ID value to be used for this device
+			while reading/configuring the devlink attributes.
+			Type: u8
+			Configuration mode: runtime
+
+mf_mode			[DEVICE, DRIVER-SPECIFIC]
+			Configure Multi Function mode for the device.
+			Supported MF modes and the assoicated values are,
+			    MF allowed(0), Default(1), SPIO4(2), NPAR1.0(3),
+			    NPAR1.5(4), NPAR2.0(5), BD(6) and UFP(7)
+			Type: u8
+			Configuration mode: Permanent
+
+dcbx_mode		[PORT, DRIVER-SPECIFIC]
+			Configure DCBX mode for the device.
+			Supported dcbx modes are,
+			    Disabled(0), IEEE(1), CEE(2) and Dynamic(3)
+			Type: u8
+			Configuration mode: Permanent
+
+preboot_oprom		[PORT, DRIVER-SPECIFIC]
+			Enable Preboot Option ROM.
+			Type: Boolean
+			Configuration mode: Permanent
+
+preboot_boot_protocol	[PORT, DRIVER-SPECIFIC]
+			Configure preboot Boot protocol.
+			Possible values are,
+			    PXE(0), iSCSI Boot(3), FCoE Boot(4) and NONE(7)
+			Type: u8
+			Configuration mode: Permanent
+
+preboot_vlan		[PORT, DRIVER-SPECIFIC]
+			Preboot VLAN.
+			Type: u16
+			Configuration mode: Permanent
+
+preboot_vlan_value	[PORT, DRIVER-SPECIFIC]
+			Configure Preboot VLAN value.
+			Type: u16
+			Configuration mode: Permanent
+
+mba_delay_time		[PORT, DRIVER-SPECIFIC]
+			Configure MBA Delay Time. Supported range is [0-15].
+			Type: u8
+			Configuration mode: Permanent
+
+mba_setup_hot_key	[PORT, DRIVER-SPECIFIC]
+			Configure MBA setup Hot Key. Possible values are,
+			Ctrl S(0) and Ctrl B(1).
+			Type: u8
+			Configuration mode: Permanent
+
+mba_hide_setup_prompt	[PORT, DRIVER-SPECIFIC]
+			Configure MBA hide setup prompt.
+			Type: Boolean
+			Configuration mode: Permanent
drivers/net/ethernet/qlogic/qed/qed_main.c +38 -0
index f0183e2..3d43140 100644
@@ -2388,6 +2388,42 @@ static void qed_set_iwarp_cmt(struct qed_dev *cdev, bool iwarp_cmt)
 	cdev->iwarp_cmt = iwarp_cmt;
 }
 
+static int qed_get_cfg_attr(struct qed_dev *cdev, u16 cmd, u8 entity, u32 flags,
+			    u8 *buf, int *len)
+{
+	struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev);
+	struct qed_ptt *ptt;
+	int status = 0;
+
+	ptt = qed_ptt_acquire(hwfn);
+	if (!ptt)
+		return -EAGAIN;
+
+	status = qed_mcp_nvm_get_cfg(hwfn, ptt, cmd, entity, flags, buf, len);
+
+	qed_ptt_release(hwfn, ptt);
+
+	return status;
+}
+
+static int qed_set_cfg_attr(struct qed_dev *cdev, u16 cmd, u8 entity, u32 flags,
+			    u8 *buf, int len)
+{
+	struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev);
+	struct qed_ptt *ptt;
+	int status = 0;
+
+	ptt = qed_ptt_acquire(hwfn);
+	if (!ptt)
+		return -EAGAIN;
+
+	status = qed_mcp_nvm_set_cfg(hwfn, ptt, cmd, entity, flags, buf, len);
+
+	qed_ptt_release(hwfn, ptt);
+
+	return status;
+}
+
 static struct qed_selftest_ops qed_selftest_ops_pass = {
 	.selftest_memory = &qed_selftest_memory,
 	.selftest_interrupt = &qed_selftest_interrupt,
@@ -2438,6 +2474,8 @@ static void qed_set_iwarp_cmt(struct qed_dev *cdev, bool iwarp_cmt)
 	.get_affin_hwfn_idx = &qed_get_affin_hwfn_idx,
 	.get_iwarp_cmt = &qed_get_iwarp_cmt,
 	.set_iwarp_cmt = &qed_set_iwarp_cmt,
+	.get_cfg_attr = &qed_get_cfg_attr,
+	.set_cfg_attr = &qed_set_cfg_attr,
 };
 
 void qed_get_protocol_stats(struct qed_dev *cdev,
drivers/net/ethernet/qlogic/qede/qede.h +3 -0
index 35ad5cd..e175d30 100644
@@ -54,6 +54,7 @@
 
 #include <net/pkt_cls.h>
 #include <net/tc_act/tc_gact.h>
+#include <net/devlink.h>
 
 #define QEDE_MAJOR_VERSION		8
 #define QEDE_MINOR_VERSION		37
@@ -264,6 +265,8 @@ struct qede_dev {
 	struct bpf_prog *xdp_prog;
 
 	struct devlink			*dl;
+	struct devlink_port		dl_port;
+	u8				cfg_entity_id;
 };
 
 enum QEDE_STATE {
drivers/net/ethernet/qlogic/qede/qede_devlink.c +201 -1

238 lines not on this page · raw message

drivers/net/ethernet/qlogic/qede/qede_devlink.h +23 -0
index 5aa79dd..57b5fcc 100644
@@ -3,6 +3,12 @@
 #define _QEDE_DEVLINK_H
 #include <net/devlink.h>
 
+#define QEDE_DL_PARAM_GET_FLAGS		0xA
+#define QEDE_DL_PARAM_SET_FLAGS		0xE
+#define QEDE_DL_PARAM_PF_GET_FLAGS	0x1A
+#define QEDE_DL_PARAM_PF_SET_FLAGS	0x1E
+#define QEDE_DL_PARAM_BUF_LEN		32
+
 struct qede_devlink {
 	struct qede_dev *edev;
 };
@@ -10,6 +16,23 @@ struct qede_devlink {
 enum qede_devlink_param_id {
 	QEDE_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX,
 	QEDE_DEVLINK_PARAM_ID_IWARP_CMT,
+	QEDE_DEVLINK_ENTITY_ID,
+	QEDE_DEVLINK_DEVICE_CAPABILITIES,
+	QEDE_DEVLINK_MF_MODE,
+	QEDE_DEVLINK_DCBX_MODE,
+	QEDE_DEVLINK_PREBOOT_OPROM,
+	QEDE_DEVLINK_PREBOOT_BOOT_PROTOCOL,
+	QEDE_DEVLINK_PREBOOT_VLAN,
+	QEDE_DEVLINK_PREBOOT_VLAN_VALUE,
+	QEDE_DEVLINK_MBA_DELAY_TIME,
+	QEDE_DEVLINK_MBA_SETUP_HOT_KEY,
+	QEDE_DEVLINK_MBA_HIDE_SETUP_PROMPT,
+};
+
+struct qede_devlink_cfg_param {
+	u16 id;
+	u16 cmd;
+	enum devlink_param_type type;
 };
 
 int qede_devlink_register(struct qede_dev *edev);
include/linux/qed/qed_if.h +16 -0
index 7c41304..6430762 100644
@@ -48,6 +48,18 @@
 #include <linux/qed/qed_chain.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
 
+#define QED_NVM_CFG_ID_MF_MODE			9
+#define QED_NVM_CFG_ID_DCBX_MODE		26
+#define QED_NVM_CFG_ID_PREBOOT_OPROM		59
+#define QED_NVM_CFG_ID_MBA_DELAY_TIME		61
+#define QED_NVM_CFG_ID_MBA_SETUP_HOT_KEY	62
+#define QED_NVM_CFG_ID_MBA_HIDE_SETUP_PROMPT	63
+#define QED_NVM_CFG_ID_PREBOOT_BOOT_PROTOCOL	69
+#define QED_NVM_CFG_ID_ENABLE_SRIOV		70
+#define QED_NVM_CFG_ID_DEVICE_CAPABILITIES	117
+#define QED_NVM_CFG_ID_PREBOOT_VLAN_VALUE	132
+#define QED_NVM_CFG_ID_PREBOOT_VLAN		133
+
 enum dcbx_protocol_type {
 	DCBX_PROTOCOL_ISCSI,
 	DCBX_PROTOCOL_FCOE,
@@ -1134,6 +1146,10 @@ struct qed_common_ops {
 
 	bool (*get_iwarp_cmt)(struct qed_dev *cdev);
 	void (*set_iwarp_cmt)(struct qed_dev *cdev, bool iwarp_cmt);
+	int (*get_cfg_attr)(struct qed_dev *cdev, u16 cmd, u8 entity, u32 flags,
+			    u8 *buf, int *len);
+	int (*set_cfg_attr)(struct qed_dev *cdev, u16 cmd, u8 entity, u32 flags,
+			    u8 *buf, int len);
 };
 
 #define MASK_FIELD(_name, _value) \
Signature · 1 line
1.8.3.1
#5 lore raw

Re: [PATCH net-next v2 4/4] qed*: Add devlink support for configuration attributes.

Quoted 24 lines · Sudarsana Reddy Kalluru

This patch adds implementation for devlink callbacks for reading and configuring the device attributes.

---
 Documentation/networking/devlink-params-qede.txt |  72 ++++++++
 drivers/net/ethernet/qlogic/qed/qed_main.c       |  38 +++++
 drivers/net/ethernet/qlogic/qede/qede.h          |   3 +
 drivers/net/ethernet/qlogic/qede/qede_devlink.c  | 202 ++++++++++++++++++++++-
 drivers/net/ethernet/qlogic/qede/qede_devlink.h  |  23 +++
 include/linux/qed/qed_if.h                       |  16 ++
 6 files changed, 353 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/networking/devlink-params-qede.txt
Documentation/networking/devlink-params-qede.txt new file +3 -0
new file mode 100644
index 0000000..f78a993
@@ -0,0 +1,72 @@
+enable_sriov		[DEVICE, GENERIC]
+			Configuration mode: Permanent
+

Documentation/networking/devlink-params-qede.txt line 13

Quoted 10 lines
Documentation/networking/devlink-params-qede.txt new file +10 -0
+iwarp_cmt		[DEVICE, DRIVER-SPECIFIC]
+			Enable iWARP support over 100G device (CMT mode).
+			Type: Boolean
+			Configuration mode: runtime
+
+entity_id		[DEVICE, DRIVER-SPECIFIC]
+			Set the entity ID value to be used for this device
+			while reading/configuring the devlink attributes.
+			Type: u8
+			Configuration mode: runtime

Can you explain what this is?

Documentation/networking/devlink-params-qede.txt line 19

Quoted 5 lines
Documentation/networking/devlink-params-qede.txt new file +5 -0
+device_capabilities	[DEVICE, DRIVER-SPECIFIC]
+			Set the entity ID value to be used for this device
+			while reading/configuring the devlink attributes.
+			Type: u8
+			Configuration mode: runtime

Looks like you copied the previous text here.

Documentation/networking/devlink-params-qede.txt line 25

Quoted 5 lines
Documentation/networking/devlink-params-qede.txt new file +5 -0
+mf_mode			[DEVICE, DRIVER-SPECIFIC]
+			Configure Multi Function mode for the device.
+			Supported MF modes and the assoicated values are,
+			    MF allowed(0), Default(1), SPIO4(2), NPAR1.0(3),
+			    NPAR1.5(4), NPAR2.0(5), BD(6) and UFP(7)

NPAR should have a proper API in devlink port, what are the other modes?

Documentation/networking/devlink-params-qede.txt line 34

Quoted 9 lines
Documentation/networking/devlink-params-qede.txt new file +9 -0
+			Type: u8
+			Configuration mode: Permanent
+
+dcbx_mode		[PORT, DRIVER-SPECIFIC]
+			Configure DCBX mode for the device.
+			Supported dcbx modes are,
+			    Disabled(0), IEEE(1), CEE(2) and Dynamic(3)
+			Type: u8
+			Configuration mode: Permanent

Why is this a permanent parameter?

Documentation/networking/devlink-params-qede.txt line 39

Quoted 4 lines
Documentation/networking/devlink-params-qede.txt new file +4 -0
+preboot_oprom		[PORT, DRIVER-SPECIFIC]
+			Enable Preboot Option ROM.
+			Type: Boolean
+			Configuration mode: Permanent

This should definitely not be a driver specific toggle.

Documentation/networking/devlink-params-qede.txt line 46

Quoted 6 lines
Documentation/networking/devlink-params-qede.txt new file +6 -0
+preboot_boot_protocol	[PORT, DRIVER-SPECIFIC]
+			Configure preboot Boot protocol.
+			Possible values are,
+			    PXE(0), iSCSI Boot(3), FCoE Boot(4) and NONE(7)
+			Type: u8
+			Configuration mode: Permanent

Ditto.

Documentation/networking/devlink-params-qede.txt line 56

Quoted 9 lines
Documentation/networking/devlink-params-qede.txt new file +9 -0
+preboot_vlan		[PORT, DRIVER-SPECIFIC]
+			Preboot VLAN.
+			Type: u16
+			Configuration mode: Permanent
+
+preboot_vlan_value	[PORT, DRIVER-SPECIFIC]
+			Configure Preboot VLAN value.
+			Type: u16
+			Configuration mode: Permanent

And these.

Quoted 15 lines
Documentation/networking/devlink-params-qede.txt new file +15 -0
+mba_delay_time		[PORT, DRIVER-SPECIFIC]
+			Configure MBA Delay Time. Supported range is [0-15].
+			Type: u8
+			Configuration mode: Permanent
+
+mba_setup_hot_key	[PORT, DRIVER-SPECIFIC]
+			Configure MBA setup Hot Key. Possible values are,
+			Ctrl S(0) and Ctrl B(1).
+			Type: u8
+			Configuration mode: Permanent
+
+mba_hide_setup_prompt	[PORT, DRIVER-SPECIFIC]
+			Configure MBA hide setup prompt.
+			Type: Boolean
+			Configuration mode: Permanent
#6 lore raw

RE: [EXT] Re: [PATCH net-next v2 4/4] qed*: Add devlink support for configuration attributes.

Quoted 43 lines

-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: Friday, July 5, 2019 3:38 AM
To: Sudarsana Reddy Kalluru <[email protected]>
Cc: [email protected]; [email protected]; Michal Kalderon <[email protected]>; Ariel Elior <[email protected]>; Jiri Pirko <[email protected]>
Subject: [EXT] Re: [PATCH net-next v2 4/4] qed*: Add devlink support for configuration attributes.

External Email

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

Quoted 11 lines · Sudarsana Reddy Kalluru

This patch adds implementation for devlink callbacks for reading and configuring the device attributes.

---
 Documentation/networking/devlink-params-qede.txt |  72 ++++++++
 drivers/net/ethernet/qlogic/qed/qed_main.c       |  38 +++++
 drivers/net/ethernet/qlogic/qede/qede.h          |   3 +
 drivers/net/ethernet/qlogic/qede/qede_devlink.c  | 202

++++++++++++++++++++++-

drivers/net/ethernet/qlogic/qede/qede_devlink.h | 23 +++

Quoted 11 lines
 include/linux/qed/qed_if.h                       |  16 ++
 6 files changed, 353 insertions(+), 1 deletion(-)  create mode 100644

Documentation/networking/devlink-params-qede.txt

Documentation/networking/devlink-params-qede.txt new file +0 -0
new file mode 100644
index 0000000..f78a993

Documentation/networking/devlink-params-qede.txt line 5

Quoted 5 lines
Documentation/networking/devlink-params-qede.txt new file +5 -0
@@ -0,0 +1,72 @@
+enable_sriov		[DEVICE, GENERIC]
+			Configuration mode: Permanent
+
+iwarp_cmt		[DEVICE, DRIVER-SPECIFIC]
+			Enable iWARP support over 100G device (CMT

mode).

Quoted 10 lines

Documentation/networking/devlink-params-qede.txt line 13

Quoted 8 lines
Documentation/networking/devlink-params-qede.txt new file +8 -0
+			Type: Boolean
+			Configuration mode: runtime
+
+entity_id		[DEVICE, DRIVER-SPECIFIC]
+			Set the entity ID value to be used for this device
+			while reading/configuring the devlink attributes.
+			Type: u8
+			Configuration mode: runtime

Can you explain what this is?

Hardware/mfw provides the option to modify/read the config of other PFs. A non-zero entity id represents a partition number (or simply a PF-id) for which the config need to be read/updated.

Quoted 8 lines

Documentation/networking/devlink-params-qede.txt line 19

Quoted 6 lines
Documentation/networking/devlink-params-qede.txt new file +5 -0
+device_capabilities	[DEVICE, DRIVER-SPECIFIC]
+			Set the entity ID value to be used for this device
+			while reading/configuring the devlink attributes.
+			Type: u8
+			Configuration mode: runtime

Looks like you copied the previous text here.

Will update it, thanks.

Quoted 9 lines

Documentation/networking/devlink-params-qede.txt line 25

Quoted 6 lines
Documentation/networking/devlink-params-qede.txt new file +5 -0
+mf_mode			[DEVICE, DRIVER-SPECIFIC]
+			Configure Multi Function mode for the device.
+			Supported MF modes and the assoicated values are,
+			    MF allowed(0), Default(1), SPIO4(2), NPAR1.0(3),
+			    NPAR1.5(4), NPAR2.0(5), BD(6) and UFP(7)

NPAR should have a proper API in devlink port, what are the other modes?

These are the different modes supported by the Marvell NIC. In our case the mf_mode is per adapter basis, e.g., it's not possible to configure one port in NPAR mode and the other in Default mode.

Quoted 12 lines

Documentation/networking/devlink-params-qede.txt line 34

Quoted 9 lines
Documentation/networking/devlink-params-qede.txt new file +9 -0
+			Type: u8
+			Configuration mode: Permanent
+
+dcbx_mode		[PORT, DRIVER-SPECIFIC]
+			Configure DCBX mode for the device.
+			Supported dcbx modes are,
+			    Disabled(0), IEEE(1), CEE(2) and Dynamic(3)
+			Type: u8
+			Configuration mode: Permanent

Why is this a permanent parameter?

This specifies the dcbx_mode to be configured in non-volatile memory. The value is persistent and is used in the next load of OS or the mfw.

Quoted 16 lines

Documentation/networking/devlink-params-qede.txt line 39

Quoted 4 lines
Documentation/networking/devlink-params-qede.txt new file +4 -0
+preboot_oprom		[PORT, DRIVER-SPECIFIC]
+			Enable Preboot Option ROM.
+			Type: Boolean
+			Configuration mode: Permanent

This should definitely not be a driver specific toggle.

Documentation/networking/devlink-params-qede.txt line 46

Quoted 6 lines
Documentation/networking/devlink-params-qede.txt new file +6 -0
+preboot_boot_protocol	[PORT, DRIVER-SPECIFIC]
+			Configure preboot Boot protocol.
+			Possible values are,
+			    PXE(0), iSCSI Boot(3), FCoE Boot(4) and NONE(7)
+			Type: u8
+			Configuration mode: Permanent

Ditto.

Quoted 11 lines

Documentation/networking/devlink-params-qede.txt line 56

Quoted 9 lines
Documentation/networking/devlink-params-qede.txt new file +9 -0
+preboot_vlan		[PORT, DRIVER-SPECIFIC]
+			Preboot VLAN.
+			Type: u16
+			Configuration mode: Permanent
+
+preboot_vlan_value	[PORT, DRIVER-SPECIFIC]
+			Configure Preboot VLAN value.
+			Type: u16
+			Configuration mode: Permanent

And these.

Sure, will add generic definitions for these.

Quoted 17 lines

Documentation/networking/devlink-params-qede.txt line 53

Quoted 3 lines
Documentation/networking/devlink-params-qede.txt new file +2 -0
+mba_delay_time		[PORT, DRIVER-SPECIFIC]
+			Configure MBA Delay Time. Supported range is [0-

15].

Quoted 13 lines
Documentation/networking/devlink-params-qede.txt new file +13 -0
+			Type: u8
+			Configuration mode: Permanent
+
+mba_setup_hot_key	[PORT, DRIVER-SPECIFIC]
+			Configure MBA setup Hot Key. Possible values are,
+			Ctrl S(0) and Ctrl B(1).
+			Type: u8
+			Configuration mode: Permanent
+
+mba_hide_setup_prompt	[PORT, DRIVER-SPECIFIC]
+			Configure MBA hide setup prompt.
+			Type: Boolean
+			Configuration mode: Permanent
#7 lore raw

Re: [EXT] Re: [PATCH net-next v2 4/4] qed*: Add devlink support for configuration attributes.

Quoted 30 lines · Sudarsana Reddy Kalluru
Quoted 21 lines · Sudarsana Reddy Kalluru
Quoted 20 lines

This patch adds implementation for devlink callbacks for reading and configuring the device attributes.

Documentation/networking/devlink-params-qede.txt new file +7 -0
new file mode 100644
index 0000000..f78a993
@@ -0,0 +1,72 @@
+enable_sriov		[DEVICE, GENERIC]
+			Configuration mode: Permanent
+
+iwarp_cmt		[DEVICE, DRIVER-SPECIFIC]
+			Enable iWARP support over 100G device (CMT mode).  
+			Type: Boolean
+			Configuration mode: runtime
Quoted 8 lines

Documentation/networking/devlink-params-qede.txt line 13

Quoted 6 lines
Documentation/networking/devlink-params-qede.txt new file +6 -0
+
+entity_id		[DEVICE, DRIVER-SPECIFIC]
+			Set the entity ID value to be used for this device
+			while reading/configuring the devlink attributes.
+			Type: u8
+			Configuration mode: runtime  

Can you explain what this is?

Quoted 3 lines

Hardware/mfw provides the option to modify/read the config of other PFs. A non-zero entity id represents a partition number (or simply a PF-id) for which the config need to be read/updated.

Having a parameter which changes the interpretation of other parameters makes me quite uncomfortable :( Could it be a better idea, perhaps, to use PCI ports? We have been discussing PCI ports for a while now, and they will probably become a reality soon. You could then hang the per-PF parameters off of the PF ports rather than the device instance?

Quoted 18 lines
Quoted 7 lines

Documentation/networking/devlink-params-qede.txt line 19

Quoted 5 lines
Documentation/networking/devlink-params-qede.txt new file +5 -0
+device_capabilities	[DEVICE, DRIVER-SPECIFIC]
+			Set the entity ID value to be used for this device
+			while reading/configuring the devlink attributes.
+			Type: u8
+			Configuration mode: runtime  

Looks like you copied the previous text here.

Will update it, thanks.

Quoted 9 lines

Documentation/networking/devlink-params-qede.txt line 25

Quoted 6 lines
Documentation/networking/devlink-params-qede.txt new file +5 -0
+mf_mode			[DEVICE, DRIVER-SPECIFIC]
+			Configure Multi Function mode for the device.
+			Supported MF modes and the assoicated values are,
+			    MF allowed(0), Default(1), SPIO4(2), NPAR1.0(3),
+			    NPAR1.5(4), NPAR2.0(5), BD(6) and UFP(7)  

NPAR should have a proper API in devlink port, what are the other modes?

Quoted 3 lines

These are the different modes supported by the Marvell NIC. In our case the mf_mode is per adapter basis, e.g., it's not possible to configure one port in NPAR mode and the other in Default mode.

Jiri, what are your thoughts on the NPAR support? It is effectively a PCI split. If we are going to support mdev split, should we perhaps have a "depth" or "type" of split and allow for users to configure it using the same API?

Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
Documentation/networking/devlink-params-qede.txt new file +4 -0
+			Type: u8
+			Configuration mode: Permanent
+
+dcbx_mode		[PORT, DRIVER-SPECIFIC]
Quoted 9 lines

Documentation/networking/devlink-params-qede.txt

Quoted 6 lines
Documentation/networking/devlink-params-qede.txt new file +3 -0
+			Configure DCBX mode for the device.
+			Supported dcbx modes are,
+			    Disabled(0), IEEE(1), CEE(2) and

Dynamic(3)

Documentation/networking/devlink-params-qede.txt new file +2 -0
+			Type: u8
+			Configuration mode: Permanent  

Why is this a permanent parameter?

Quoted 2 lines

This specifies the dcbx_mode to be configured in non-volatile memory. The value is persistent and is used in the next load of OS or the mfw.

And it can't be changed at runtime?

#8 lore raw

RE: [EXT] Re: [PATCH net-next v2 4/4] qed*: Add devlink support for configuration attributes.

Quoted 48 lines

-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: Saturday, July 6, 2019 1:09 AM
To: Sudarsana Reddy Kalluru <[email protected]>
Cc: [email protected]; [email protected]; Michal Kalderon <[email protected]>; Ariel Elior <[email protected]>; Jiri Pirko <[email protected]>
Subject: Re: [EXT] Re: [PATCH net-next v2 4/4] qed*: Add devlink support for configuration attributes.

Quoted 7 lines · Sudarsana Reddy Kalluru
Quoted 6 lines · Sudarsana Reddy Kalluru
Quoted 5 lines

This patch adds implementation for devlink callbacks for reading and configuring the device attributes.

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Documentation/networking/devlink-params-qede.txt new file +0 -0
new file mode 100644
index 0000000..f78a993
Quoted 8 lines

Documentation/networking/devlink-params-qede.txt line 5

Quoted 8 lines
Documentation/networking/devlink-params-qede.txt new file +5 -0
@@ -0,0 +1,72 @@
+enable_sriov		[DEVICE, GENERIC]
+			Configuration mode: Permanent
+
+iwarp_cmt		[DEVICE, DRIVER-SPECIFIC]
+			Enable iWARP support over 100G device (CMT

mode).

Quoted 11 lines
Quoted 10 lines

Documentation/networking/devlink-params-qede.txt line 13

Quoted 8 lines
Documentation/networking/devlink-params-qede.txt new file +8 -0
+			Type: Boolean
+			Configuration mode: runtime
+
+entity_id		[DEVICE, DRIVER-SPECIFIC]
+			Set the entity ID value to be used for this device
+			while reading/configuring the devlink attributes.
+			Type: u8
+			Configuration mode: runtime

Can you explain what this is?

Quoted 3 lines

Hardware/mfw provides the option to modify/read the config of other PFs. A non-zero entity id represents a partition number (or simply a PF-id) for which the config need to be read/updated.

Quoted 6 lines

Having a parameter which changes the interpretation of other parameters makes me quite uncomfortable :( Could it be a better idea, perhaps, to use PCI ports? We have been discussing PCI ports for a while now, and they will probably become a reality soon. You could then hang the per-PF parameters off of the PF ports rather than the device instance?

Agree with you, thanks.

Quoted 40 lines
Quoted 7 lines
Quoted 7 lines

Documentation/networking/devlink-params-qede.txt line 19

Quoted 5 lines
Documentation/networking/devlink-params-qede.txt new file +5 -0
+device_capabilities	[DEVICE, DRIVER-SPECIFIC]
+			Set the entity ID value to be used for this device
+			while reading/configuring the devlink attributes.
+			Type: u8
+			Configuration mode: runtime

Looks like you copied the previous text here.

Quoted 10 lines

Will update it, thanks.

Quoted 8 lines

Documentation/networking/devlink-params-qede.txt line 25

Quoted 6 lines
Documentation/networking/devlink-params-qede.txt new file +5 -0
+mf_mode			[DEVICE, DRIVER-SPECIFIC]
+			Configure Multi Function mode for the device.
+			Supported MF modes and the assoicated values are,
+			    MF allowed(0), Default(1), SPIO4(2), NPAR1.0(3),
+			    NPAR1.5(4), NPAR2.0(5), BD(6) and UFP(7)

NPAR should have a proper API in devlink port, what are the other

modes?

Quoted 4 lines
Quoted 1 line

These are the different modes supported by the Marvell NIC. In our case the mf_mode is per adapter basis, e.g., it's not possible to configure one port in NPAR mode and the other in Default mode.

Jiri, what are your thoughts on the NPAR support? It is effectively a PCI split. If we are going to support mdev split, should we perhaps have a "depth" or "type" of split and allow for users to configure it using the same API?

Quoted 13 lines
Quoted 13 lines

Documentation/networking/devlink-params-qede.txt

Quoted 10 lines
Documentation/networking/devlink-params-qede.txt new file +7 -0
+			Type: u8
+			Configuration mode: Permanent
+
+dcbx_mode		[PORT, DRIVER-SPECIFIC]
+			Configure DCBX mode for the device.
+			Supported dcbx modes are,
+			    Disabled(0), IEEE(1), CEE(2) and

Dynamic(3)

Documentation/networking/devlink-params-qede.txt new file +2 -0
+			Type: u8
+			Configuration mode: Permanent

Why is this a permanent parameter?

Quoted 4 lines
Quoted 2 lines

This specifies the dcbx_mode to be configured in non-volatile memory. The value is persistent and is used in the next load of OS or the mfw.

And it can't be changed at runtime?

Run time dcbx params are not affected via this interface, it only updates config on permanent storage of the port.

#9 lore raw

Re: [EXT] Re: [PATCH net-next v2 4/4] qed*: Add devlink support for configuration attributes.

Quoted 13 lines · Sudarsana Reddy Kalluru
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

Review

Quoted 10 lines
Documentation/networking/devlink-params-qede.txt new file +7 -0
+			Type: u8
+			Configuration mode: Permanent
+
+dcbx_mode		[PORT, DRIVER-SPECIFIC]
+			Configure DCBX mode for the device.
+			Supported dcbx modes are,
+			    Disabled(0), IEEE(1), CEE(2) and

Dynamic(3)

(quoted diff) +2 -0
+			Type: u8
+			Configuration mode: Permanent  

Why is this a permanent parameter?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

This specifies the dcbx_mode to be configured in non-volatile memory. The value is persistent and is used in the next load of OS or the mfw.

And it can't be changed at runtime?

Run time dcbx params are not affected via this interface, it only updates config on permanent storage of the port.

IOW it affects the defaults after boot? It'd be preferable to have the DCB uAPI handle "persistent"/default settings if that's the case.

#10 lore raw

RE: [EXT] Re: [PATCH net-next v2 4/4] qed*: Add devlink support for configuration attributes.

Quoted 27 lines

-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: Tuesday, July 9, 2019 3:17 AM
To: Sudarsana Reddy Kalluru <[email protected]>
Cc: [email protected]; [email protected]; Michal Kalderon <[email protected]>; Ariel Elior <[email protected]>; Jiri Pirko <[email protected]>
Subject: Re: [EXT] Re: [PATCH net-next v2 4/4] qed*: Add devlink support for configuration attributes.

Quoted 16 lines · Sudarsana Reddy Kalluru
Quoted 16 lines
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
Documentation/networking/devlink-params-qede.txt new file +4 -0
+			Type: u8
+			Configuration mode: Permanent
+
+dcbx_mode		[PORT, DRIVER-SPECIFIC]
Quoted 9 lines

Review

Quoted 6 lines
Documentation/networking/devlink-params-qede.txt new file +3 -0
+			Configure DCBX mode for the device.
+			Supported dcbx modes are,
+			    Disabled(0), IEEE(1), CEE(2) and

Dynamic(3)

(quoted diff) +2 -0
+			Type: u8
+			Configuration mode: Permanent

Why is this a permanent parameter?

This specifies the dcbx_mode to be configured in non-volatile memory. The value is persistent and is used in the next load of OS or the mfw.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

And it can't be changed at runtime?

Run time dcbx params are not affected via this interface, it only updates config on permanent storage of the port.

IOW it affects the defaults after boot? It'd be preferable to have the DCB uAPI handle "persistent"/default settings if that's the case.

Yes, it's effective after the reboot. Thanks for your suggestion.