History

qed: Add driver API for flashing the config attributes.

The patch adds driver interface for reading the config attributes from user provided buffer, and updates these values on nvm config flash partition. This is basically an expansion of our existing ethtool -f implementation. The management FW has exposed an additional method of configuring some of the nvram options, and this makes use of that. This implementation will come into use when newer FW files which contain configuration directives employing this API will be provided to ethtool -f.

Sudarsana Reddy Kalluru committed 7 years ago

Commit 0dabbe11 parent 38eabdf2 files · +69 −0Browse files

Unified · Split

2 files
  1. drivers/net/ethernet/qlogic/qed/qed_main.c +68 −0
  2. include/linux/qed/qed_if.h +1 −0
drivers/net/ethernet/qlogic/qed/qed_main.c+68−0
@@ -67,6 +67,8 @@ · 66 unmodified lines
6767 #define QED_ROCE_QPS (8192)
6868 #define QED_ROCE_DPIS (8)
6969 #define QED_RDMA_SRQS QED_ROCE_QPS
70+#define QED_NVM_CFG_SET_FLAGS 0xE
71+#define QED_NVM_CFG_SET_PF_FLAGS 0x1E
7072
7173 static char version[] =
7274 "QLogic FastLinQ 4xxxx Core Module qed " DRV_MODULE_VERSION "\n";
@@ -2231,6 +2233,69 @@ static int qed_nvm_flash_image_validate(struct qed_dev *cdev, · 2158 unmodified lines
22312233 return 0;
22322234 }
22332235
2236+/* Binary file format -
2237+ * /----------------------------------------------------------------------\
2238+ * 0B | 0x5 [command index] |
2239+ * 4B | Entity ID | Reserved | Number of config attributes |
2240+ * 8B | Config ID | Length | Value |
2241+ * | |
2242+ * \----------------------------------------------------------------------/
2243+ * There can be several cfg_id-Length-Value sets as specified by 'Number of...'.
2244+ * Entity ID - A non zero entity value for which the config need to be updated.
2245+ *
2246+ * The API parses config attributes from the user provided buffer and flashes
2247+ * them to the respective NVM path using Management FW inerface.
2248+ */
2249+static int qed_nvm_flash_cfg_write(struct qed_dev *cdev, const u8 **data)
2250+{
2251+ struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev);
2252+ u8 entity_id, len, buf[32];
2253+ struct qed_ptt *ptt;
2254+ u16 cfg_id, count;
2255+ int rc = 0, i;
2256+ u32 flags;
2257+
2258+ ptt = qed_ptt_acquire(hwfn);
2259+ if (!ptt)
2260+ return -EAGAIN;
2261+
2262+ /* NVM CFG ID attribute header */
2263+ *data += 4;
2264+ entity_id = **data;
2265+ *data += 2;
2266+ count = *((u16 *)*data);
2267+ *data += 2;
2268+
2269+ DP_VERBOSE(cdev, NETIF_MSG_DRV,
2270+ "Read config ids: entity id %02x num _attrs = %0d\n",
2271+ entity_id, count);
2272+ /* NVM CFG ID attributes */
2273+ for (i = 0; i < count; i++) {
2274+ cfg_id = *((u16 *)*data);
2275+ *data += 2;
2276+ len = **data;
2277+ (*data)++;
2278+ memcpy(buf, *data, len);
2279+ *data += len;
2280+
2281+ flags = entity_id ? QED_NVM_CFG_SET_PF_FLAGS :
2282+ QED_NVM_CFG_SET_FLAGS;
2283+
2284+ DP_VERBOSE(cdev, NETIF_MSG_DRV,
2285+ "cfg_id = %d len = %d\n", cfg_id, len);
2286+ rc = qed_mcp_nvm_set_cfg(hwfn, ptt, cfg_id, entity_id, flags,
2287+ buf, len);
2288+ if (rc) {
2289+ DP_ERR(cdev, "Error %d configuring %d\n", rc, cfg_id);
2290+ break;
2291+ }
2292+ }
2293+
2294+ qed_ptt_release(hwfn, ptt);
2295+
2296+ return rc;
2297+}
2298+
22342299 static int qed_nvm_flash(struct qed_dev *cdev, const char *name)
22352300 {
22362301 const struct firmware *image;
@@ -2272,6 +2337,9 @@ static int qed_nvm_flash(struct qed_dev *cdev, const char *name) · 35 unmodified lines
22722337 rc = qed_nvm_flash_image_access(cdev, &data,
22732338 &check_resp);
22742339 break;
2340+ case QED_NVM_FLASH_CMD_NVM_CFG_ID:
2341+ rc = qed_nvm_flash_cfg_write(cdev, &data);
2342+ break;
22752343 default:
22762344 DP_ERR(cdev, "Unknown command %08x\n", cmd_type);
22772345 rc = -EINVAL;
include/linux/qed/qed_if.h+1−0
@@ -804,6 +804,7 @@ enum qed_nvm_flash_cmd { · 803 unmodified lines
804804 QED_NVM_FLASH_CMD_FILE_DATA = 0x2,
805805 QED_NVM_FLASH_CMD_FILE_START = 0x3,
806806 QED_NVM_FLASH_CMD_NVM_CHANGE = 0x4,
807+ QED_NVM_FLASH_CMD_NVM_CFG_ID = 0x5,
807808 QED_NVM_FLASH_CMD_NVM_MAX,
808809 };
809810

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t