Merge branch 'qed-enhancements-series'
Sudarsana Reddy Kalluru says: ==================== qed* enhancements series The patch series add few enhancements to qed/qede drivers. Changes from previous versions: ------------------------------- v3: Revert v2 changes as the other paths (i.e. ptp) access the same data in atomic context. v2: Use __set_bit()/__clear_bit() where data access doesn't need to be atomic. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
3251a2ff95
@ -12655,6 +12655,7 @@ struct public_drv_mb {
|
||||
#define DRV_MB_PARAM_DCBX_NOTIFY_MASK 0x000000FF
|
||||
#define DRV_MB_PARAM_DCBX_NOTIFY_SHIFT 3
|
||||
|
||||
#define DRV_MB_PARAM_NVM_PUT_FILE_BEGIN_MBI 0x3
|
||||
#define DRV_MB_PARAM_NVM_LEN_OFFSET 24
|
||||
|
||||
#define DRV_MB_PARAM_CFG_VF_MSIX_VF_ID_SHIFT 0
|
||||
@ -12814,6 +12815,11 @@ struct public_drv_mb {
|
||||
union drv_union_data union_data;
|
||||
};
|
||||
|
||||
#define FW_MB_PARAM_NVM_PUT_FILE_REQ_OFFSET_MASK 0x00ffffff
|
||||
#define FW_MB_PARAM_NVM_PUT_FILE_REQ_OFFSET_SHIFT 0
|
||||
#define FW_MB_PARAM_NVM_PUT_FILE_REQ_SIZE_MASK 0xff000000
|
||||
#define FW_MB_PARAM_NVM_PUT_FILE_REQ_SIZE_SHIFT 24
|
||||
|
||||
enum MFW_DRV_MSG_TYPE {
|
||||
MFW_DRV_MSG_LINK_CHANGE,
|
||||
MFW_DRV_MSG_FLR_FW_ACK_FAILED,
|
||||
|
@ -1939,21 +1939,30 @@ exit:
|
||||
* 0B | 0x3 [command index] |
|
||||
* 4B | b'0: check_response? | b'1-31 reserved |
|
||||
* 8B | File-type | reserved |
|
||||
* 12B | Image length in bytes |
|
||||
* \----------------------------------------------------------------------/
|
||||
* Start a new file of the provided type
|
||||
*/
|
||||
static int qed_nvm_flash_image_file_start(struct qed_dev *cdev,
|
||||
const u8 **data, bool *check_resp)
|
||||
{
|
||||
u32 file_type, file_size = 0;
|
||||
int rc;
|
||||
|
||||
*data += 4;
|
||||
*check_resp = !!(**data & BIT(0));
|
||||
*data += 4;
|
||||
file_type = **data;
|
||||
|
||||
DP_VERBOSE(cdev, NETIF_MSG_DRV,
|
||||
"About to start a new file of type %02x\n", **data);
|
||||
rc = qed_mcp_nvm_put_file_begin(cdev, **data);
|
||||
"About to start a new file of type %02x\n", file_type);
|
||||
if (file_type == DRV_MB_PARAM_NVM_PUT_FILE_BEGIN_MBI) {
|
||||
*data += 4;
|
||||
file_size = *((u32 *)(*data));
|
||||
}
|
||||
|
||||
rc = qed_mcp_nvm_write(cdev, QED_PUT_FILE_BEGIN, file_type,
|
||||
(u8 *)(&file_size), 4);
|
||||
*data += 4;
|
||||
|
||||
return rc;
|
||||
|
@ -1619,7 +1619,7 @@ static void qed_mcp_update_stag(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
|
||||
qed_sp_pf_update_stag(p_hwfn);
|
||||
}
|
||||
|
||||
DP_VERBOSE(p_hwfn, QED_MSG_SP, "ovlan = %d hw_mode = 0x%x\n",
|
||||
DP_VERBOSE(p_hwfn, QED_MSG_SP, "ovlan = %d hw_mode = 0x%x\n",
|
||||
p_hwfn->mcp_info->func_info.ovlan, p_hwfn->hw_info.hw_mode);
|
||||
|
||||
/* Acknowledge the MFW */
|
||||
@ -1641,7 +1641,9 @@ void qed_mcp_read_ufp_config(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
|
||||
val = (port_cfg & OEM_CFG_CHANNEL_TYPE_MASK) >>
|
||||
OEM_CFG_CHANNEL_TYPE_OFFSET;
|
||||
if (val != OEM_CFG_CHANNEL_TYPE_STAGGED)
|
||||
DP_NOTICE(p_hwfn, "Incorrect UFP Channel type %d\n", val);
|
||||
DP_NOTICE(p_hwfn,
|
||||
"Incorrect UFP Channel type %d port_id 0x%02x\n",
|
||||
val, MFW_PORT(p_hwfn));
|
||||
|
||||
val = (port_cfg & OEM_CFG_SCHED_TYPE_MASK) >> OEM_CFG_SCHED_TYPE_OFFSET;
|
||||
if (val == OEM_CFG_SCHED_TYPE_ETS) {
|
||||
@ -1650,7 +1652,9 @@ void qed_mcp_read_ufp_config(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
|
||||
p_hwfn->ufp_info.mode = QED_UFP_MODE_VNIC_BW;
|
||||
} else {
|
||||
p_hwfn->ufp_info.mode = QED_UFP_MODE_UNKNOWN;
|
||||
DP_NOTICE(p_hwfn, "Unknown UFP scheduling mode %d\n", val);
|
||||
DP_NOTICE(p_hwfn,
|
||||
"Unknown UFP scheduling mode %d port_id 0x%02x\n",
|
||||
val, MFW_PORT(p_hwfn));
|
||||
}
|
||||
|
||||
qed_mcp_get_shmem_func(p_hwfn, p_ptt, &shmem_info, MCP_PF_ID(p_hwfn));
|
||||
@ -1665,13 +1669,15 @@ void qed_mcp_read_ufp_config(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
|
||||
p_hwfn->ufp_info.pri_type = QED_UFP_PRI_OS;
|
||||
} else {
|
||||
p_hwfn->ufp_info.pri_type = QED_UFP_PRI_UNKNOWN;
|
||||
DP_NOTICE(p_hwfn, "Unknown Host priority control %d\n", val);
|
||||
DP_NOTICE(p_hwfn,
|
||||
"Unknown Host priority control %d port_id 0x%02x\n",
|
||||
val, MFW_PORT(p_hwfn));
|
||||
}
|
||||
|
||||
DP_NOTICE(p_hwfn,
|
||||
"UFP shmem config: mode = %d tc = %d pri_type = %d\n",
|
||||
p_hwfn->ufp_info.mode,
|
||||
p_hwfn->ufp_info.tc, p_hwfn->ufp_info.pri_type);
|
||||
"UFP shmem config: mode = %d tc = %d pri_type = %d port_id 0x%02x\n",
|
||||
p_hwfn->ufp_info.mode, p_hwfn->ufp_info.tc,
|
||||
p_hwfn->ufp_info.pri_type, MFW_PORT(p_hwfn));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -2739,24 +2745,6 @@ int qed_mcp_nvm_resp(struct qed_dev *cdev, u8 *p_buf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int qed_mcp_nvm_put_file_begin(struct qed_dev *cdev, u32 addr)
|
||||
{
|
||||
struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev);
|
||||
struct qed_ptt *p_ptt;
|
||||
u32 resp, param;
|
||||
int rc;
|
||||
|
||||
p_ptt = qed_ptt_acquire(p_hwfn);
|
||||
if (!p_ptt)
|
||||
return -EBUSY;
|
||||
rc = qed_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_NVM_PUT_FILE_BEGIN, addr,
|
||||
&resp, ¶m);
|
||||
cdev->mcp_nvm_resp = resp;
|
||||
qed_ptt_release(p_hwfn, p_ptt);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int qed_mcp_nvm_write(struct qed_dev *cdev,
|
||||
u32 cmd, u32 addr, u8 *p_buf, u32 len)
|
||||
{
|
||||
@ -2770,6 +2758,9 @@ int qed_mcp_nvm_write(struct qed_dev *cdev,
|
||||
return -EBUSY;
|
||||
|
||||
switch (cmd) {
|
||||
case QED_PUT_FILE_BEGIN:
|
||||
nvm_cmd = DRV_MSG_CODE_NVM_PUT_FILE_BEGIN;
|
||||
break;
|
||||
case QED_PUT_FILE_DATA:
|
||||
nvm_cmd = DRV_MSG_CODE_NVM_PUT_FILE_DATA;
|
||||
break;
|
||||
@ -2782,10 +2773,14 @@ int qed_mcp_nvm_write(struct qed_dev *cdev,
|
||||
goto out;
|
||||
}
|
||||
|
||||
buf_size = min_t(u32, (len - buf_idx), MCP_DRV_NVM_BUF_LEN);
|
||||
while (buf_idx < len) {
|
||||
buf_size = min_t(u32, (len - buf_idx), MCP_DRV_NVM_BUF_LEN);
|
||||
nvm_offset = ((buf_size << DRV_MB_PARAM_NVM_LEN_OFFSET) |
|
||||
addr) + buf_idx;
|
||||
if (cmd == QED_PUT_FILE_BEGIN)
|
||||
nvm_offset = addr;
|
||||
else
|
||||
nvm_offset = ((buf_size <<
|
||||
DRV_MB_PARAM_NVM_LEN_OFFSET) | addr) +
|
||||
buf_idx;
|
||||
rc = qed_mcp_nvm_wr_cmd(p_hwfn, p_ptt, nvm_cmd, nvm_offset,
|
||||
&resp, ¶m, buf_size,
|
||||
(u32 *)&p_buf[buf_idx]);
|
||||
@ -2810,7 +2805,19 @@ int qed_mcp_nvm_write(struct qed_dev *cdev,
|
||||
if (buf_idx % 0x1000 > (buf_idx + buf_size) % 0x1000)
|
||||
usleep_range(1000, 2000);
|
||||
|
||||
buf_idx += buf_size;
|
||||
/* For MBI upgrade, MFW response includes the next buffer offset
|
||||
* to be delivered to MFW.
|
||||
*/
|
||||
if (param && cmd == QED_PUT_FILE_DATA) {
|
||||
buf_idx = QED_MFW_GET_FIELD(param,
|
||||
FW_MB_PARAM_NVM_PUT_FILE_REQ_OFFSET);
|
||||
buf_size = QED_MFW_GET_FIELD(param,
|
||||
FW_MB_PARAM_NVM_PUT_FILE_REQ_SIZE);
|
||||
} else {
|
||||
buf_idx += buf_size;
|
||||
buf_size = min_t(u32, (len - buf_idx),
|
||||
MCP_DRV_NVM_BUF_LEN);
|
||||
}
|
||||
}
|
||||
|
||||
cdev->mcp_nvm_resp = resp;
|
||||
|
@ -542,16 +542,6 @@ int qed_mcp_nvm_read(struct qed_dev *cdev, u32 addr, u8 *p_buf, u32 len);
|
||||
int qed_mcp_nvm_write(struct qed_dev *cdev,
|
||||
u32 cmd, u32 addr, u8 *p_buf, u32 len);
|
||||
|
||||
/**
|
||||
* @brief Put file begin
|
||||
*
|
||||
* @param cdev
|
||||
* @param addr - nvm offset
|
||||
*
|
||||
* @return int - 0 - operation was successful.
|
||||
*/
|
||||
int qed_mcp_nvm_put_file_begin(struct qed_dev *cdev, u32 addr);
|
||||
|
||||
/**
|
||||
* @brief Check latest response
|
||||
*
|
||||
|
@ -168,6 +168,13 @@ struct qede_ptp;
|
||||
|
||||
#define QEDE_RFS_MAX_FLTR 256
|
||||
|
||||
enum qede_flags_bit {
|
||||
QEDE_FLAGS_IS_VF = 0,
|
||||
QEDE_FLAGS_LINK_REQUESTED,
|
||||
QEDE_FLAGS_PTP_TX_IN_PRORGESS,
|
||||
QEDE_FLAGS_TX_TIMESTAMPING_EN
|
||||
};
|
||||
|
||||
struct qede_dev {
|
||||
struct qed_dev *cdev;
|
||||
struct net_device *ndev;
|
||||
@ -177,10 +184,7 @@ struct qede_dev {
|
||||
u8 dp_level;
|
||||
|
||||
unsigned long flags;
|
||||
#define QEDE_FLAG_IS_VF BIT(0)
|
||||
#define IS_VF(edev) (!!((edev)->flags & QEDE_FLAG_IS_VF))
|
||||
#define QEDE_TX_TIMESTAMPING_EN BIT(1)
|
||||
#define QEDE_FLAGS_PTP_TX_IN_PRORGESS BIT(2)
|
||||
#define IS_VF(edev) (test_bit(QEDE_FLAGS_IS_VF, &(edev)->flags))
|
||||
|
||||
const struct qed_eth_ops *ops;
|
||||
struct qede_ptp *ptp;
|
||||
|
@ -1086,7 +1086,7 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
|
||||
}
|
||||
|
||||
if (is_vf)
|
||||
edev->flags |= QEDE_FLAG_IS_VF;
|
||||
set_bit(QEDE_FLAGS_IS_VF, &edev->flags);
|
||||
|
||||
qede_init_ndev(edev);
|
||||
|
||||
@ -2057,6 +2057,8 @@ static void qede_unload(struct qede_dev *edev, enum qede_unload_mode mode,
|
||||
if (!is_locked)
|
||||
__qede_lock(edev);
|
||||
|
||||
clear_bit(QEDE_FLAGS_LINK_REQUESTED, &edev->flags);
|
||||
|
||||
edev->state = QEDE_STATE_CLOSED;
|
||||
|
||||
qede_rdma_dev_event_close(edev);
|
||||
@ -2163,6 +2165,8 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode,
|
||||
/* Program un-configured VLANs */
|
||||
qede_configure_vlan_filters(edev);
|
||||
|
||||
set_bit(QEDE_FLAGS_LINK_REQUESTED, &edev->flags);
|
||||
|
||||
/* Ask for link-up using current configuration */
|
||||
memset(&link_params, 0, sizeof(link_params));
|
||||
link_params.link_up = true;
|
||||
@ -2258,8 +2262,8 @@ static void qede_link_update(void *dev, struct qed_link_output *link)
|
||||
{
|
||||
struct qede_dev *edev = dev;
|
||||
|
||||
if (!netif_running(edev->ndev)) {
|
||||
DP_VERBOSE(edev, NETIF_MSG_LINK, "Interface is not running\n");
|
||||
if (!test_bit(QEDE_FLAGS_LINK_REQUESTED, &edev->flags)) {
|
||||
DP_VERBOSE(edev, NETIF_MSG_LINK, "Interface is not ready\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -223,12 +223,12 @@ static int qede_ptp_cfg_filters(struct qede_dev *edev)
|
||||
|
||||
switch (ptp->tx_type) {
|
||||
case HWTSTAMP_TX_ON:
|
||||
edev->flags |= QEDE_TX_TIMESTAMPING_EN;
|
||||
set_bit(QEDE_FLAGS_TX_TIMESTAMPING_EN, &edev->flags);
|
||||
tx_type = QED_PTP_HWTSTAMP_TX_ON;
|
||||
break;
|
||||
|
||||
case HWTSTAMP_TX_OFF:
|
||||
edev->flags &= ~QEDE_TX_TIMESTAMPING_EN;
|
||||
clear_bit(QEDE_FLAGS_TX_TIMESTAMPING_EN, &edev->flags);
|
||||
tx_type = QED_PTP_HWTSTAMP_TX_OFF;
|
||||
break;
|
||||
|
||||
@ -518,7 +518,7 @@ void qede_ptp_tx_ts(struct qede_dev *edev, struct sk_buff *skb)
|
||||
if (test_and_set_bit_lock(QEDE_FLAGS_PTP_TX_IN_PRORGESS, &edev->flags))
|
||||
return;
|
||||
|
||||
if (unlikely(!(edev->flags & QEDE_TX_TIMESTAMPING_EN))) {
|
||||
if (unlikely(!test_bit(QEDE_FLAGS_TX_TIMESTAMPING_EN, &edev->flags))) {
|
||||
DP_NOTICE(edev,
|
||||
"Tx timestamping was not enabled, this packet will not be timestamped\n");
|
||||
} else if (unlikely(ptp->tx_skb)) {
|
||||
|
Loading…
Reference in New Issue
Block a user