* ctrl_xmit - send a packet through an SGE control Tx queue * @q: the control queue * @mbuf: the packet * * Send a packet through an SGE control Tx queue. Packets sent through * a control queue must fit entirely as immediate data. */
| 1310 | * a control queue must fit entirely as immediate data. |
| 1311 | */ |
| 1312 | static int ctrl_xmit(struct sge_ctrl_txq *q, struct rte_mbuf *mbuf) |
| 1313 | { |
| 1314 | unsigned int ndesc; |
| 1315 | struct fw_wr_hdr *wr; |
| 1316 | caddr_t dst; |
| 1317 | |
| 1318 | if (unlikely(!is_imm(mbuf))) { |
| 1319 | WARN_ON(1); |
| 1320 | rte_pktmbuf_free(mbuf); |
| 1321 | return -1; |
| 1322 | } |
| 1323 | |
| 1324 | reclaim_completed_tx_imm(&q->q); |
| 1325 | ndesc = DIV_ROUND_UP(mbuf->pkt_len, sizeof(struct tx_desc)); |
| 1326 | t4_os_lock(&q->ctrlq_lock); |
| 1327 | |
| 1328 | q->full = txq_avail(&q->q) < ndesc ? 1 : 0; |
| 1329 | if (unlikely(q->full)) { |
| 1330 | t4_os_unlock(&q->ctrlq_lock); |
| 1331 | return -1; |
| 1332 | } |
| 1333 | |
| 1334 | wr = (struct fw_wr_hdr *)&q->q.desc[q->q.pidx]; |
| 1335 | dst = (void *)wr; |
| 1336 | inline_tx_mbuf(&q->q, rte_pktmbuf_mtod(mbuf, caddr_t), |
| 1337 | &dst, mbuf->data_len); |
| 1338 | |
| 1339 | txq_advance(&q->q, ndesc); |
| 1340 | if (unlikely(txq_avail(&q->q) < 64)) |
| 1341 | wr->lo |= htonl(F_FW_WR_EQUEQ); |
| 1342 | |
| 1343 | q->txp++; |
| 1344 | |
| 1345 | ring_tx_db(q->adapter, &q->q); |
| 1346 | t4_os_unlock(&q->ctrlq_lock); |
| 1347 | |
| 1348 | rte_pktmbuf_free(mbuf); |
| 1349 | return 0; |
| 1350 | } |
| 1351 | |
| 1352 | /** |
| 1353 | * t4_mgmt_tx - send a management message |
no test coverage detected