Skip to content

Commit c160994

Browse files
committed
Merge branch 'qed-Fix-series'
Sudarsana Reddy Kalluru says: ==================== qed* Fix series. The patch series addresses couple of issues in the recent commits. Patch (1) populates the actual dump-size of config attribute instead of providing a fixed size value. Patch(2) updates frame format of flash config buffer as required by management FW (MFW). Please consider applying it to net-next. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 2f2fa16 + 2da244a commit c160994

File tree

3 files changed

+53
-16
lines changed

3 files changed

+53
-16
lines changed

drivers/net/ethernet/qlogic/qed/qed_main.c

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,12 +2240,13 @@ static int qed_nvm_flash_image_validate(struct qed_dev *cdev,
22402240
/* Binary file format -
22412241
* /----------------------------------------------------------------------\
22422242
* 0B | 0x5 [command index] |
2243-
* 4B | Entity ID | Reserved | Number of config attributes |
2244-
* 8B | Config ID | Length | Value |
2243+
* 4B | Number of config attributes | Reserved |
2244+
* 4B | Config ID | Entity ID | Length |
2245+
* 4B | Value |
22452246
* | |
22462247
* \----------------------------------------------------------------------/
2247-
* There can be several cfg_id-Length-Value sets as specified by 'Number of...'.
2248-
* Entity ID - A non zero entity value for which the config need to be updated.
2248+
* There can be several cfg_id-entity_id-Length-Value sets as specified by
2249+
* 'Number of config attributes'.
22492250
*
22502251
* The API parses config attributes from the user provided buffer and flashes
22512252
* them to the respective NVM path using Management FW inerface.
@@ -2265,18 +2266,17 @@ static int qed_nvm_flash_cfg_write(struct qed_dev *cdev, const u8 **data)
22652266

22662267
/* NVM CFG ID attribute header */
22672268
*data += 4;
2268-
entity_id = **data;
2269-
*data += 2;
22702269
count = *((u16 *)*data);
2271-
*data += 2;
2270+
*data += 4;
22722271

22732272
DP_VERBOSE(cdev, NETIF_MSG_DRV,
2274-
"Read config ids: entity id %02x num _attrs = %0d\n",
2275-
entity_id, count);
2273+
"Read config ids: num_attrs = %0d\n", count);
22762274
/* NVM CFG ID attributes */
22772275
for (i = 0; i < count; i++) {
22782276
cfg_id = *((u16 *)*data);
22792277
*data += 2;
2278+
entity_id = **data;
2279+
(*data)++;
22802280
len = **data;
22812281
(*data)++;
22822282
memcpy(buf, *data, len);
@@ -2286,7 +2286,8 @@ static int qed_nvm_flash_cfg_write(struct qed_dev *cdev, const u8 **data)
22862286
QED_NVM_CFG_SET_FLAGS;
22872287

22882288
DP_VERBOSE(cdev, NETIF_MSG_DRV,
2289-
"cfg_id = %d len = %d\n", cfg_id, len);
2289+
"cfg_id = %d entity = %d len = %d\n", cfg_id,
2290+
entity_id, len);
22902291
rc = qed_mcp_nvm_set_cfg(hwfn, ptt, cfg_id, entity_id, flags,
22912292
buf, len);
22922293
if (rc) {
@@ -2300,6 +2301,31 @@ static int qed_nvm_flash_cfg_write(struct qed_dev *cdev, const u8 **data)
23002301
return rc;
23012302
}
23022303

2304+
#define QED_MAX_NVM_BUF_LEN 32
2305+
static int qed_nvm_flash_cfg_len(struct qed_dev *cdev, u32 cmd)
2306+
{
2307+
struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev);
2308+
u8 buf[QED_MAX_NVM_BUF_LEN];
2309+
struct qed_ptt *ptt;
2310+
u32 len;
2311+
int rc;
2312+
2313+
ptt = qed_ptt_acquire(hwfn);
2314+
if (!ptt)
2315+
return QED_MAX_NVM_BUF_LEN;
2316+
2317+
rc = qed_mcp_nvm_get_cfg(hwfn, ptt, cmd, 0, QED_NVM_CFG_GET_FLAGS, buf,
2318+
&len);
2319+
if (rc || !len) {
2320+
DP_ERR(cdev, "Error %d reading %d\n", rc, cmd);
2321+
len = QED_MAX_NVM_BUF_LEN;
2322+
}
2323+
2324+
qed_ptt_release(hwfn, ptt);
2325+
2326+
return len;
2327+
}
2328+
23032329
static int qed_nvm_flash_cfg_read(struct qed_dev *cdev, u8 **data,
23042330
u32 cmd, u32 entity_id)
23052331
{
@@ -2657,6 +2683,7 @@ const struct qed_common_ops qed_common_ops_pass = {
26572683
.read_module_eeprom = &qed_read_module_eeprom,
26582684
.get_affin_hwfn_idx = &qed_get_affin_hwfn_idx,
26592685
.read_nvm_cfg = &qed_nvm_flash_cfg_read,
2686+
.read_nvm_cfg_len = &qed_nvm_flash_cfg_len,
26602687
.set_grc_config = &qed_set_grc_config,
26612688
};
26622689

drivers/net/ethernet/qlogic/qede/qede_ethtool.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949

5050
#define QEDE_SELFTEST_POLL_COUNT 100
5151
#define QEDE_DUMP_VERSION 0x1
52-
#define QEDE_DUMP_NVM_BUF_LEN 32
5352
#define QEDE_DUMP_NVM_ARG_COUNT 2
5453

5554
static const struct {
@@ -2026,7 +2025,8 @@ static int qede_get_dump_flag(struct net_device *dev,
20262025
switch (edev->dump_info.cmd) {
20272026
case QEDE_DUMP_CMD_NVM_CFG:
20282027
dump->flag = QEDE_DUMP_CMD_NVM_CFG;
2029-
dump->len = QEDE_DUMP_NVM_BUF_LEN;
2028+
dump->len = edev->ops->common->read_nvm_cfg_len(edev->cdev,
2029+
edev->dump_info.args[0]);
20302030
break;
20312031
case QEDE_DUMP_CMD_GRCDUMP:
20322032
dump->flag = QEDE_DUMP_CMD_GRCDUMP;
@@ -2051,9 +2051,8 @@ static int qede_get_dump_data(struct net_device *dev,
20512051

20522052
if (!edev->ops || !edev->ops->common) {
20532053
DP_ERR(edev, "Edev ops not populated\n");
2054-
edev->dump_info.cmd = QEDE_DUMP_CMD_NONE;
2055-
edev->dump_info.num_args = 0;
2056-
return -EINVAL;
2054+
rc = -EINVAL;
2055+
goto err;
20572056
}
20582057

20592058
switch (edev->dump_info.cmd) {
@@ -2062,7 +2061,8 @@ static int qede_get_dump_data(struct net_device *dev,
20622061
DP_ERR(edev, "Arg count = %d required = %d\n",
20632062
edev->dump_info.num_args,
20642063
QEDE_DUMP_NVM_ARG_COUNT);
2065-
return -EINVAL;
2064+
rc = -EINVAL;
2065+
goto err;
20662066
}
20672067
rc = edev->ops->common->read_nvm_cfg(edev->cdev, (u8 **)&buf,
20682068
edev->dump_info.args[0],
@@ -2078,8 +2078,10 @@ static int qede_get_dump_data(struct net_device *dev,
20782078
break;
20792079
}
20802080

2081+
err:
20812082
edev->dump_info.cmd = QEDE_DUMP_CMD_NONE;
20822083
edev->dump_info.num_args = 0;
2084+
memset(edev->dump_info.args, 0, sizeof(edev->dump_info.args));
20832085

20842086
return rc;
20852087
}

include/linux/qed/qed_if.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,14 @@ struct qed_common_ops {
11431143
*/
11441144
int (*read_nvm_cfg)(struct qed_dev *cdev, u8 **buf, u32 cmd,
11451145
u32 entity_id);
1146+
/**
1147+
* @brief read_nvm_cfg - Read NVM config attribute value.
1148+
* @param cdev
1149+
* @param cmd - NVM CFG command id
1150+
*
1151+
* @return config id length, 0 on error.
1152+
*/
1153+
int (*read_nvm_cfg_len)(struct qed_dev *cdev, u32 cmd);
11461154

11471155
/**
11481156
* @brief set_grc_config - Configure value for grc config id.

0 commit comments

Comments
 (0)