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

Function tap_gso_ctx_setup

dpdk/drivers/net/tap/rte_eth_tap.c:1433–1477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1431}
1432
1433static int
1434tap_gso_ctx_setup(struct rte_gso_ctx *gso_ctx, struct rte_eth_dev *dev)
1435{
1436 uint32_t gso_types;
1437 char pool_name[64];
1438 struct pmd_internals *pmd = dev->data->dev_private;
1439 int ret;
1440
1441 /* initialize GSO context */
1442 gso_types = RTE_ETH_TX_OFFLOAD_TCP_TSO;
1443 if (!pmd->gso_ctx_mp) {
1444 /*
1445 * Create private mbuf pool with TAP_GSO_MBUF_SEG_SIZE
1446 * bytes size per mbuf use this pool for both direct and
1447 * indirect mbufs
1448 */
1449 ret = snprintf(pool_name, sizeof(pool_name), "mp_%s",
1450 dev->device->name);
1451 if (ret < 0 || ret >= (int)sizeof(pool_name)) {
1452 TAP_LOG(ERR,
1453 "%s: failed to create mbuf pool name for device %s,"
1454 "device name too long or output error, ret: %d\n",
1455 pmd->name, dev->device->name, ret);
1456 return -ENAMETOOLONG;
1457 }
1458 pmd->gso_ctx_mp = rte_pktmbuf_pool_create(pool_name,
1459 TAP_GSO_MBUFS_NUM, TAP_GSO_MBUF_CACHE_SIZE, 0,
1460 RTE_PKTMBUF_HEADROOM + TAP_GSO_MBUF_SEG_SIZE,
1461 SOCKET_ID_ANY);
1462 if (!pmd->gso_ctx_mp) {
1463 TAP_LOG(ERR,
1464 "%s: failed to create mbuf pool for device %s\n",
1465 pmd->name, dev->device->name);
1466 return -1;
1467 }
1468 }
1469
1470 gso_ctx->direct_pool = pmd->gso_ctx_mp;
1471 gso_ctx->indirect_pool = pmd->gso_ctx_mp;
1472 gso_ctx->gso_types = gso_types;
1473 gso_ctx->gso_size = 0; /* gso_size is set in tx_burst() per packet */
1474 gso_ctx->flag = 0;
1475
1476 return 0;
1477}
1478
1479static int
1480tap_setup_queue(struct rte_eth_dev *dev,

Callers 1

tap_setup_queueFunction · 0.85

Calls 2

snprintfFunction · 0.85
rte_pktmbuf_pool_createFunction · 0.85

Tested by

no test coverage detected