| 2091 | } |
| 2092 | |
| 2093 | int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq, |
| 2094 | struct rte_eth_dev *eth_dev, uint16_t queue_id, |
| 2095 | unsigned int iqid, int socket_id) |
| 2096 | { |
| 2097 | int ret, nentries; |
| 2098 | struct fw_eq_ctrl_cmd c; |
| 2099 | struct sge *s = &adap->sge; |
| 2100 | struct port_info *pi = eth_dev->data->dev_private; |
| 2101 | |
| 2102 | /* Add status entries */ |
| 2103 | nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc); |
| 2104 | |
| 2105 | txq->q.desc = alloc_ring(eth_dev, "ctrl_tx_ring", queue_id, |
| 2106 | socket_id, txq->q.size, sizeof(struct tx_desc), |
| 2107 | 0, 0, &txq->q.phys_addr, NULL); |
| 2108 | if (!txq->q.desc) |
| 2109 | return -ENOMEM; |
| 2110 | |
| 2111 | memset(&c, 0, sizeof(c)); |
| 2112 | c.op_to_vfn = htonl(V_FW_CMD_OP(FW_EQ_CTRL_CMD) | F_FW_CMD_REQUEST | |
| 2113 | F_FW_CMD_WRITE | F_FW_CMD_EXEC | |
| 2114 | V_FW_EQ_CTRL_CMD_PFN(adap->pf) | |
| 2115 | V_FW_EQ_CTRL_CMD_VFN(0)); |
| 2116 | c.alloc_to_len16 = htonl(F_FW_EQ_CTRL_CMD_ALLOC | |
| 2117 | F_FW_EQ_CTRL_CMD_EQSTART | (sizeof(c) / 16)); |
| 2118 | c.cmpliqid_eqid = htonl(V_FW_EQ_CTRL_CMD_CMPLIQID(0)); |
| 2119 | c.physeqid_pkd = htonl(0); |
| 2120 | c.fetchszm_to_iqid = |
| 2121 | htonl(V_FW_EQ_CTRL_CMD_HOSTFCMODE(X_HOSTFCMODE_NONE) | |
| 2122 | V_FW_EQ_CTRL_CMD_PCIECHN(pi->tx_chan) | |
| 2123 | F_FW_EQ_CTRL_CMD_FETCHRO | V_FW_EQ_CTRL_CMD_IQID(iqid)); |
| 2124 | c.dcaen_to_eqsize = |
| 2125 | htonl(V_FW_EQ_CTRL_CMD_FBMIN(X_FETCHBURSTMIN_64B) | |
| 2126 | V_FW_EQ_CTRL_CMD_FBMAX(X_FETCHBURSTMAX_512B) | |
| 2127 | V_FW_EQ_CTRL_CMD_EQSIZE(nentries)); |
| 2128 | c.eqaddr = cpu_to_be64(txq->q.phys_addr); |
| 2129 | |
| 2130 | ret = t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), &c); |
| 2131 | if (ret) { |
| 2132 | txq->q.desc = NULL; |
| 2133 | return ret; |
| 2134 | } |
| 2135 | |
| 2136 | init_txq(adap, &txq->q, G_FW_EQ_CTRL_CMD_EQID(ntohl(c.cmpliqid_eqid)), |
| 2137 | G_FW_EQ_CTRL_CMD_EQID(ntohl(c. physeqid_pkd))); |
| 2138 | txq->adapter = adap; |
| 2139 | txq->full = 0; |
| 2140 | return 0; |
| 2141 | } |
| 2142 | |
| 2143 | static void free_txq(struct sge_txq *q) |
| 2144 | { |
no test coverage detected