Skip to content

Commit b78d540

Browse files
Ariel Eliordavem330
authored andcommitted
qed: Register light L2 queues with doorbell overflow recovery mechanism
Light L2 queues are doorbelling entities. Modify the implementation to keep the doorbell data necessary for doorbelling in well known location instead of recomputing every time. Register the LL2 queue with doorbell recovery mechanism. Signed-off-by: Ariel Elior <Ariel.Elior@cavium.com> Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com> Signed-off-by: Tomer Tayar <Tomer.Tayar@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9ecd8c3 commit b78d540

2 files changed

Lines changed: 21 additions & 10 deletions

File tree

‎drivers/net/ethernet/qlogic/qed/qed_ll2.c‎

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,14 @@ static int qed_sp_ll2_tx_queue_start(struct qed_hwfn *p_hwfn,
10851085

10861086
p_ramrod->gsi_offload_flag = p_ll2_conn->input.gsi_enable;
10871087

1088-
return qed_spq_post(p_hwfn, p_ent, NULL);
1088+
rc = qed_spq_post(p_hwfn, p_ent, NULL);
1089+
if (rc)
1090+
return rc;
1091+
1092+
rc = qed_db_recovery_add(p_hwfn->cdev, p_tx->doorbell_addr,
1093+
&p_tx->db_msg, DB_REC_WIDTH_32B,
1094+
DB_REC_KERNEL);
1095+
return rc;
10891096
}
10901097

10911098
static int qed_sp_ll2_rx_queue_stop(struct qed_hwfn *p_hwfn,
@@ -1119,9 +1126,11 @@ static int qed_sp_ll2_rx_queue_stop(struct qed_hwfn *p_hwfn,
11191126
static int qed_sp_ll2_tx_queue_stop(struct qed_hwfn *p_hwfn,
11201127
struct qed_ll2_info *p_ll2_conn)
11211128
{
1129+
struct qed_ll2_tx_queue *p_tx = &p_ll2_conn->tx_queue;
11221130
struct qed_spq_entry *p_ent = NULL;
11231131
struct qed_sp_init_data init_data;
11241132
int rc = -EINVAL;
1133+
qed_db_recovery_del(p_hwfn->cdev, p_tx->doorbell_addr, &p_tx->db_msg);
11251134

11261135
/* Get SPQ entry */
11271136
memset(&init_data, 0, sizeof(init_data));
@@ -1542,6 +1551,13 @@ int qed_ll2_establish_connection(void *cxt, u8 connection_handle)
15421551
p_tx->doorbell_addr = (u8 __iomem *)p_hwfn->doorbells +
15431552
qed_db_addr(p_ll2_conn->cid,
15441553
DQ_DEMS_LEGACY);
1554+
/* prepare db data */
1555+
SET_FIELD(p_tx->db_msg.params, CORE_DB_DATA_DEST, DB_DEST_XCM);
1556+
SET_FIELD(p_tx->db_msg.params, CORE_DB_DATA_AGG_CMD, DB_AGG_CMD_SET);
1557+
SET_FIELD(p_tx->db_msg.params, CORE_DB_DATA_AGG_VAL_SEL,
1558+
DQ_XCM_CORE_TX_BD_PROD_CMD);
1559+
p_tx->db_msg.agg_flags = DQ_XCM_CORE_DQ_CF_CMD;
1560+
15451561

15461562
rc = qed_ll2_establish_connection_rx(p_hwfn, p_ll2_conn);
15471563
if (rc)
@@ -1780,7 +1796,6 @@ static void qed_ll2_tx_packet_notify(struct qed_hwfn *p_hwfn,
17801796
bool b_notify = p_ll2_conn->tx_queue.cur_send_packet->notify_fw;
17811797
struct qed_ll2_tx_queue *p_tx = &p_ll2_conn->tx_queue;
17821798
struct qed_ll2_tx_packet *p_pkt = NULL;
1783-
struct core_db_data db_msg = { 0, 0, 0 };
17841799
u16 bd_prod;
17851800

17861801
/* If there are missing BDs, don't do anything now */
@@ -1809,24 +1824,19 @@ static void qed_ll2_tx_packet_notify(struct qed_hwfn *p_hwfn,
18091824
list_move_tail(&p_pkt->list_entry, &p_tx->active_descq);
18101825
}
18111826

1812-
SET_FIELD(db_msg.params, CORE_DB_DATA_DEST, DB_DEST_XCM);
1813-
SET_FIELD(db_msg.params, CORE_DB_DATA_AGG_CMD, DB_AGG_CMD_SET);
1814-
SET_FIELD(db_msg.params, CORE_DB_DATA_AGG_VAL_SEL,
1815-
DQ_XCM_CORE_TX_BD_PROD_CMD);
1816-
db_msg.agg_flags = DQ_XCM_CORE_DQ_CF_CMD;
1817-
db_msg.spq_prod = cpu_to_le16(bd_prod);
1827+
p_tx->db_msg.spq_prod = cpu_to_le16(bd_prod);
18181828

18191829
/* Make sure the BDs data is updated before ringing the doorbell */
18201830
wmb();
18211831

1822-
DIRECT_REG_WR(p_tx->doorbell_addr, *((u32 *)&db_msg));
1832+
DIRECT_REG_WR(p_tx->doorbell_addr, *((u32 *)&p_tx->db_msg));
18231833

18241834
DP_VERBOSE(p_hwfn,
18251835
(NETIF_MSG_TX_QUEUED | QED_MSG_LL2),
18261836
"LL2 [q 0x%02x cid 0x%08x type 0x%08x] Doorbelled [producer 0x%04x]\n",
18271837
p_ll2_conn->queue_id,
18281838
p_ll2_conn->cid,
1829-
p_ll2_conn->input.conn_type, db_msg.spq_prod);
1839+
p_ll2_conn->input.conn_type, p_tx->db_msg.spq_prod);
18301840
}
18311841

18321842
int qed_ll2_prepare_tx_packet(void *cxt,

‎drivers/net/ethernet/qlogic/qed/qed_ll2.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ struct qed_ll2_tx_queue {
103103
struct qed_ll2_tx_packet cur_completing_packet;
104104
u16 cur_completing_bd_idx;
105105
void __iomem *doorbell_addr;
106+
struct core_db_data db_msg;
106107
u16 bds_idx;
107108
u16 cur_send_frag_num;
108109
u16 cur_completing_frag_num;

0 commit comments

Comments
 (0)