MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pfe_eth_open

Function pfe_eth_open

dpdk/drivers/net/pfe/pfe_ethdev.c:238–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238static int
239pfe_eth_open(struct rte_eth_dev *dev)
240{
241 struct pfe_eth_priv_s *priv = dev->data->dev_private;
242 struct hif_client_s *client;
243 struct hif_shm *hif_shm;
244 uint16_t i;
245 int rc;
246
247 /* Register client driver with HIF */
248 client = &priv->client;
249
250 if (client->pfe) {
251 hif_shm = client->pfe->hif.shm;
252 /* TODO please remove the below code of if block, once we add
253 * the proper cleanup in eth_close
254 */
255 if (!test_bit(PFE_CL_GEM0 + priv->id,
256 &hif_shm->g_client_status[0])) {
257 /* Register client driver with HIF */
258 memset(client, 0, sizeof(*client));
259 client->id = PFE_CL_GEM0 + priv->id;
260 client->tx_qn = emac_txq_cnt;
261 client->rx_qn = EMAC_RXQ_CNT;
262 client->priv = priv;
263 client->pfe = priv->pfe;
264 client->port_id = dev->data->port_id;
265 client->event_handler = pfe_eth_event_handler;
266
267 client->tx_qsize = EMAC_TXQ_DEPTH;
268 client->rx_qsize = EMAC_RXQ_DEPTH;
269
270 rc = hif_lib_client_register(client);
271 if (rc) {
272 PFE_PMD_ERR("hif_lib_client_register(%d)"
273 " failed", client->id);
274 goto err0;
275 }
276 } else {
277 /* Freeing the packets if already exists */
278 int ret = 0;
279 struct rte_mbuf *rx_pkts[32];
280 /* TODO multiqueue support */
281 ret = hif_lib_receive_pkt(&client->rx_q[0],
282 hif_shm->pool, rx_pkts, 32);
283 while (ret) {
284 int i;
285 for (i = 0; i < ret; i++)
286 rte_pktmbuf_free(rx_pkts[i]);
287 ret = hif_lib_receive_pkt(&client->rx_q[0],
288 hif_shm->pool,
289 rx_pkts, 32);
290 }
291 }
292 } else {
293 /* Register client driver with HIF */
294 memset(client, 0, sizeof(*client));
295 client->id = PFE_CL_GEM0 + priv->id;

Callers

nothing calls this directly

Calls 6

memsetFunction · 0.85
hif_lib_client_registerFunction · 0.85
hif_lib_receive_pktFunction · 0.85
rte_pktmbuf_freeFunction · 0.85
pfe_eth_startFunction · 0.85
test_bitFunction · 0.50

Tested by

no test coverage detected