Commit db8ddde7 authored by David S. Miller's avatar David S. Miller

Merge branch 'qed-Miscellaneous-bug-fixes'

Denis Bolotin says:

====================
qed: Miscellaneous bug fixes

This patch series fixes several unrelated bugs across the driver.
Please consider applying to net.

V1->V2:
-------
Use dma_rmb() instead of rmb().
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 11123ab9 ed4eac20
...@@ -191,7 +191,7 @@ qed_dcbx_dp_protocol(struct qed_hwfn *p_hwfn, struct qed_dcbx_results *p_data) ...@@ -191,7 +191,7 @@ qed_dcbx_dp_protocol(struct qed_hwfn *p_hwfn, struct qed_dcbx_results *p_data)
static void static void
qed_dcbx_set_params(struct qed_dcbx_results *p_data, qed_dcbx_set_params(struct qed_dcbx_results *p_data,
struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
bool enable, u8 prio, u8 tc, bool app_tlv, bool enable, u8 prio, u8 tc,
enum dcbx_protocol_type type, enum dcbx_protocol_type type,
enum qed_pci_personality personality) enum qed_pci_personality personality)
{ {
...@@ -210,7 +210,7 @@ qed_dcbx_set_params(struct qed_dcbx_results *p_data, ...@@ -210,7 +210,7 @@ qed_dcbx_set_params(struct qed_dcbx_results *p_data,
p_data->arr[type].dont_add_vlan0 = true; p_data->arr[type].dont_add_vlan0 = true;
/* QM reconf data */ /* QM reconf data */
if (p_hwfn->hw_info.personality == personality) if (app_tlv && p_hwfn->hw_info.personality == personality)
qed_hw_info_set_offload_tc(&p_hwfn->hw_info, tc); qed_hw_info_set_offload_tc(&p_hwfn->hw_info, tc);
/* Configure dcbx vlan priority in doorbell block for roce EDPM */ /* Configure dcbx vlan priority in doorbell block for roce EDPM */
...@@ -225,7 +225,7 @@ qed_dcbx_set_params(struct qed_dcbx_results *p_data, ...@@ -225,7 +225,7 @@ qed_dcbx_set_params(struct qed_dcbx_results *p_data,
static void static void
qed_dcbx_update_app_info(struct qed_dcbx_results *p_data, qed_dcbx_update_app_info(struct qed_dcbx_results *p_data,
struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
bool enable, u8 prio, u8 tc, bool app_tlv, bool enable, u8 prio, u8 tc,
enum dcbx_protocol_type type) enum dcbx_protocol_type type)
{ {
enum qed_pci_personality personality; enum qed_pci_personality personality;
...@@ -240,7 +240,7 @@ qed_dcbx_update_app_info(struct qed_dcbx_results *p_data, ...@@ -240,7 +240,7 @@ qed_dcbx_update_app_info(struct qed_dcbx_results *p_data,
personality = qed_dcbx_app_update[i].personality; personality = qed_dcbx_app_update[i].personality;
qed_dcbx_set_params(p_data, p_hwfn, p_ptt, enable, qed_dcbx_set_params(p_data, p_hwfn, p_ptt, app_tlv, enable,
prio, tc, type, personality); prio, tc, type, personality);
} }
} }
...@@ -319,8 +319,8 @@ qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, ...@@ -319,8 +319,8 @@ qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
enable = true; enable = true;
} }
qed_dcbx_update_app_info(p_data, p_hwfn, p_ptt, enable, qed_dcbx_update_app_info(p_data, p_hwfn, p_ptt, true,
priority, tc, type); enable, priority, tc, type);
} }
} }
...@@ -341,7 +341,7 @@ qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, ...@@ -341,7 +341,7 @@ qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
continue; continue;
enable = (type == DCBX_PROTOCOL_ETH) ? false : !!dcbx_version; enable = (type == DCBX_PROTOCOL_ETH) ? false : !!dcbx_version;
qed_dcbx_update_app_info(p_data, p_hwfn, p_ptt, enable, qed_dcbx_update_app_info(p_data, p_hwfn, p_ptt, false, enable,
priority, tc, type); priority, tc, type);
} }
......
...@@ -185,6 +185,10 @@ void qed_resc_free(struct qed_dev *cdev) ...@@ -185,6 +185,10 @@ void qed_resc_free(struct qed_dev *cdev)
qed_iscsi_free(p_hwfn); qed_iscsi_free(p_hwfn);
qed_ooo_free(p_hwfn); qed_ooo_free(p_hwfn);
} }
if (QED_IS_RDMA_PERSONALITY(p_hwfn))
qed_rdma_info_free(p_hwfn);
qed_iov_free(p_hwfn); qed_iov_free(p_hwfn);
qed_l2_free(p_hwfn); qed_l2_free(p_hwfn);
qed_dmae_info_free(p_hwfn); qed_dmae_info_free(p_hwfn);
...@@ -1081,6 +1085,12 @@ int qed_resc_alloc(struct qed_dev *cdev) ...@@ -1081,6 +1085,12 @@ int qed_resc_alloc(struct qed_dev *cdev)
goto alloc_err; goto alloc_err;
} }
if (QED_IS_RDMA_PERSONALITY(p_hwfn)) {
rc = qed_rdma_info_alloc(p_hwfn);
if (rc)
goto alloc_err;
}
/* DMA info initialization */ /* DMA info initialization */
rc = qed_dmae_info_alloc(p_hwfn); rc = qed_dmae_info_alloc(p_hwfn);
if (rc) if (rc)
...@@ -2102,11 +2112,8 @@ int qed_hw_start_fastpath(struct qed_hwfn *p_hwfn) ...@@ -2102,11 +2112,8 @@ int qed_hw_start_fastpath(struct qed_hwfn *p_hwfn)
if (!p_ptt) if (!p_ptt)
return -EAGAIN; return -EAGAIN;
/* If roce info is allocated it means roce is initialized and should
* be enabled in searcher.
*/
if (p_hwfn->p_rdma_info && if (p_hwfn->p_rdma_info &&
p_hwfn->b_rdma_enabled_in_prs) p_hwfn->p_rdma_info->active && p_hwfn->b_rdma_enabled_in_prs)
qed_wr(p_hwfn, p_ptt, p_hwfn->rdma_prs_search_reg, 0x1); qed_wr(p_hwfn, p_ptt, p_hwfn->rdma_prs_search_reg, 0x1);
/* Re-open incoming traffic */ /* Re-open incoming traffic */
......
...@@ -992,6 +992,8 @@ static int qed_int_attentions(struct qed_hwfn *p_hwfn) ...@@ -992,6 +992,8 @@ static int qed_int_attentions(struct qed_hwfn *p_hwfn)
*/ */
do { do {
index = p_sb_attn->sb_index; index = p_sb_attn->sb_index;
/* finish reading index before the loop condition */
dma_rmb();
attn_bits = le32_to_cpu(p_sb_attn->atten_bits); attn_bits = le32_to_cpu(p_sb_attn->atten_bits);
attn_acks = le32_to_cpu(p_sb_attn->atten_ack); attn_acks = le32_to_cpu(p_sb_attn->atten_ack);
} while (index != p_sb_attn->sb_index); } while (index != p_sb_attn->sb_index);
......
...@@ -1782,9 +1782,9 @@ static int qed_drain(struct qed_dev *cdev) ...@@ -1782,9 +1782,9 @@ static int qed_drain(struct qed_dev *cdev)
return -EBUSY; return -EBUSY;
} }
rc = qed_mcp_drain(hwfn, ptt); rc = qed_mcp_drain(hwfn, ptt);
qed_ptt_release(hwfn, ptt);
if (rc) if (rc)
return rc; return rc;
qed_ptt_release(hwfn, ptt);
} }
return 0; return 0;
......
...@@ -140,22 +140,34 @@ static u32 qed_rdma_get_sb_id(void *p_hwfn, u32 rel_sb_id) ...@@ -140,22 +140,34 @@ static u32 qed_rdma_get_sb_id(void *p_hwfn, u32 rel_sb_id)
return FEAT_NUM((struct qed_hwfn *)p_hwfn, QED_PF_L2_QUE) + rel_sb_id; return FEAT_NUM((struct qed_hwfn *)p_hwfn, QED_PF_L2_QUE) + rel_sb_id;
} }
static int qed_rdma_alloc(struct qed_hwfn *p_hwfn, int qed_rdma_info_alloc(struct qed_hwfn *p_hwfn)
struct qed_ptt *p_ptt,
struct qed_rdma_start_in_params *params)
{ {
struct qed_rdma_info *p_rdma_info; struct qed_rdma_info *p_rdma_info;
u32 num_cons, num_tasks;
int rc = -ENOMEM;
DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "Allocating RDMA\n");
/* Allocate a struct with current pf rdma info */
p_rdma_info = kzalloc(sizeof(*p_rdma_info), GFP_KERNEL); p_rdma_info = kzalloc(sizeof(*p_rdma_info), GFP_KERNEL);
if (!p_rdma_info) if (!p_rdma_info)
return rc; return -ENOMEM;
spin_lock_init(&p_rdma_info->lock);
p_hwfn->p_rdma_info = p_rdma_info; p_hwfn->p_rdma_info = p_rdma_info;
return 0;
}
void qed_rdma_info_free(struct qed_hwfn *p_hwfn)
{
kfree(p_hwfn->p_rdma_info);
p_hwfn->p_rdma_info = NULL;
}
static int qed_rdma_alloc(struct qed_hwfn *p_hwfn)
{
struct qed_rdma_info *p_rdma_info = p_hwfn->p_rdma_info;
u32 num_cons, num_tasks;
int rc = -ENOMEM;
DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "Allocating RDMA\n");
if (QED_IS_IWARP_PERSONALITY(p_hwfn)) if (QED_IS_IWARP_PERSONALITY(p_hwfn))
p_rdma_info->proto = PROTOCOLID_IWARP; p_rdma_info->proto = PROTOCOLID_IWARP;
else else
...@@ -183,7 +195,7 @@ static int qed_rdma_alloc(struct qed_hwfn *p_hwfn, ...@@ -183,7 +195,7 @@ static int qed_rdma_alloc(struct qed_hwfn *p_hwfn,
/* Allocate a struct with device params and fill it */ /* Allocate a struct with device params and fill it */
p_rdma_info->dev = kzalloc(sizeof(*p_rdma_info->dev), GFP_KERNEL); p_rdma_info->dev = kzalloc(sizeof(*p_rdma_info->dev), GFP_KERNEL);
if (!p_rdma_info->dev) if (!p_rdma_info->dev)
goto free_rdma_info; return rc;
/* Allocate a struct with port params and fill it */ /* Allocate a struct with port params and fill it */
p_rdma_info->port = kzalloc(sizeof(*p_rdma_info->port), GFP_KERNEL); p_rdma_info->port = kzalloc(sizeof(*p_rdma_info->port), GFP_KERNEL);
...@@ -298,8 +310,6 @@ static int qed_rdma_alloc(struct qed_hwfn *p_hwfn, ...@@ -298,8 +310,6 @@ static int qed_rdma_alloc(struct qed_hwfn *p_hwfn,
kfree(p_rdma_info->port); kfree(p_rdma_info->port);
free_rdma_dev: free_rdma_dev:
kfree(p_rdma_info->dev); kfree(p_rdma_info->dev);
free_rdma_info:
kfree(p_rdma_info);
return rc; return rc;
} }
...@@ -370,8 +380,6 @@ static void qed_rdma_resc_free(struct qed_hwfn *p_hwfn) ...@@ -370,8 +380,6 @@ static void qed_rdma_resc_free(struct qed_hwfn *p_hwfn)
kfree(p_rdma_info->port); kfree(p_rdma_info->port);
kfree(p_rdma_info->dev); kfree(p_rdma_info->dev);
kfree(p_rdma_info);
} }
static void qed_rdma_free_tid(void *rdma_cxt, u32 itid) static void qed_rdma_free_tid(void *rdma_cxt, u32 itid)
...@@ -679,8 +687,6 @@ static int qed_rdma_setup(struct qed_hwfn *p_hwfn, ...@@ -679,8 +687,6 @@ static int qed_rdma_setup(struct qed_hwfn *p_hwfn,
DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "RDMA setup\n"); DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "RDMA setup\n");
spin_lock_init(&p_hwfn->p_rdma_info->lock);
qed_rdma_init_devinfo(p_hwfn, params); qed_rdma_init_devinfo(p_hwfn, params);
qed_rdma_init_port(p_hwfn); qed_rdma_init_port(p_hwfn);
qed_rdma_init_events(p_hwfn, params); qed_rdma_init_events(p_hwfn, params);
...@@ -727,7 +733,7 @@ static int qed_rdma_stop(void *rdma_cxt) ...@@ -727,7 +733,7 @@ static int qed_rdma_stop(void *rdma_cxt)
/* Disable RoCE search */ /* Disable RoCE search */
qed_wr(p_hwfn, p_ptt, p_hwfn->rdma_prs_search_reg, 0); qed_wr(p_hwfn, p_ptt, p_hwfn->rdma_prs_search_reg, 0);
p_hwfn->b_rdma_enabled_in_prs = false; p_hwfn->b_rdma_enabled_in_prs = false;
p_hwfn->p_rdma_info->active = 0;
qed_wr(p_hwfn, p_ptt, PRS_REG_ROCE_DEST_QP_MAX_PF, 0); qed_wr(p_hwfn, p_ptt, PRS_REG_ROCE_DEST_QP_MAX_PF, 0);
ll2_ethertype_en = qed_rd(p_hwfn, p_ptt, PRS_REG_LIGHT_L2_ETHERTYPE_EN); ll2_ethertype_en = qed_rd(p_hwfn, p_ptt, PRS_REG_LIGHT_L2_ETHERTYPE_EN);
...@@ -1236,7 +1242,8 @@ qed_rdma_create_qp(void *rdma_cxt, ...@@ -1236,7 +1242,8 @@ qed_rdma_create_qp(void *rdma_cxt,
u8 max_stats_queues; u8 max_stats_queues;
int rc; int rc;
if (!rdma_cxt || !in_params || !out_params || !p_hwfn->p_rdma_info) { if (!rdma_cxt || !in_params || !out_params ||
!p_hwfn->p_rdma_info->active) {
DP_ERR(p_hwfn->cdev, DP_ERR(p_hwfn->cdev,
"qed roce create qp failed due to NULL entry (rdma_cxt=%p, in=%p, out=%p, roce_info=?\n", "qed roce create qp failed due to NULL entry (rdma_cxt=%p, in=%p, out=%p, roce_info=?\n",
rdma_cxt, in_params, out_params); rdma_cxt, in_params, out_params);
...@@ -1802,8 +1809,8 @@ bool qed_rdma_allocated_qps(struct qed_hwfn *p_hwfn) ...@@ -1802,8 +1809,8 @@ bool qed_rdma_allocated_qps(struct qed_hwfn *p_hwfn)
{ {
bool result; bool result;
/* if rdma info has not been allocated, naturally there are no qps */ /* if rdma wasn't activated yet, naturally there are no qps */
if (!p_hwfn->p_rdma_info) if (!p_hwfn->p_rdma_info->active)
return false; return false;
spin_lock_bh(&p_hwfn->p_rdma_info->lock); spin_lock_bh(&p_hwfn->p_rdma_info->lock);
...@@ -1849,7 +1856,7 @@ static int qed_rdma_start(void *rdma_cxt, ...@@ -1849,7 +1856,7 @@ static int qed_rdma_start(void *rdma_cxt,
if (!p_ptt) if (!p_ptt)
goto err; goto err;
rc = qed_rdma_alloc(p_hwfn, p_ptt, params); rc = qed_rdma_alloc(p_hwfn);
if (rc) if (rc)
goto err1; goto err1;
...@@ -1858,6 +1865,7 @@ static int qed_rdma_start(void *rdma_cxt, ...@@ -1858,6 +1865,7 @@ static int qed_rdma_start(void *rdma_cxt,
goto err2; goto err2;
qed_ptt_release(p_hwfn, p_ptt); qed_ptt_release(p_hwfn, p_ptt);
p_hwfn->p_rdma_info->active = 1;
return rc; return rc;
......
...@@ -102,6 +102,7 @@ struct qed_rdma_info { ...@@ -102,6 +102,7 @@ struct qed_rdma_info {
u16 max_queue_zones; u16 max_queue_zones;
enum protocol_type proto; enum protocol_type proto;
struct qed_iwarp_info iwarp; struct qed_iwarp_info iwarp;
u8 active:1;
}; };
struct qed_rdma_qp { struct qed_rdma_qp {
...@@ -176,10 +177,14 @@ struct qed_rdma_qp { ...@@ -176,10 +177,14 @@ struct qed_rdma_qp {
#if IS_ENABLED(CONFIG_QED_RDMA) #if IS_ENABLED(CONFIG_QED_RDMA)
void qed_rdma_dpm_bar(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt); void qed_rdma_dpm_bar(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
void qed_rdma_dpm_conf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt); void qed_rdma_dpm_conf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
int qed_rdma_info_alloc(struct qed_hwfn *p_hwfn);
void qed_rdma_info_free(struct qed_hwfn *p_hwfn);
#else #else
static inline void qed_rdma_dpm_conf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) {} static inline void qed_rdma_dpm_conf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) {}
static inline void qed_rdma_dpm_bar(struct qed_hwfn *p_hwfn, static inline void qed_rdma_dpm_bar(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt) {} struct qed_ptt *p_ptt) {}
static inline int qed_rdma_info_alloc(struct qed_hwfn *p_hwfn) {return -EINVAL}
static inline void qed_rdma_info_free(struct qed_hwfn *p_hwfn) {}
#endif #endif
int int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment