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

Function ethdev_config

dpdk/examples/pipeline/obj.c:70–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70int
71ethdev_config(const char *name, struct ethdev_params *params)
72{
73 struct rte_eth_dev_info port_info;
74 struct rte_eth_conf port_conf;
75 struct ethdev_params_rss *rss;
76 struct rte_mempool *mempool;
77 uint32_t i;
78 int numa_node, status;
79 uint16_t port_id = 0;
80
81 /* Check input params */
82 if (!name ||
83 !name[0] ||
84 !params ||
85 !params->rx.n_queues ||
86 !params->rx.queue_size ||
87 !params->tx.n_queues ||
88 !params->tx.queue_size)
89 return -EINVAL;
90
91 status = rte_eth_dev_get_port_by_name(name, &port_id);
92 if (status)
93 return -EINVAL;
94
95 status = rte_eth_dev_info_get(port_id, &port_info);
96 if (status)
97 return -EINVAL;
98
99 mempool = rte_mempool_lookup(params->rx.mempool_name);
100 if (!mempool)
101 return -EINVAL;
102
103 rss = params->rx.rss;
104 if (rss) {
105 if (!port_info.reta_size || port_info.reta_size > RTE_ETH_RSS_RETA_SIZE_512)
106 return -EINVAL;
107
108 if (!rss->n_queues || rss->n_queues >= ETHDEV_RXQ_RSS_MAX)
109 return -EINVAL;
110
111 for (i = 0; i < rss->n_queues; i++)
112 if (rss->queue_id[i] >= port_info.max_rx_queues)
113 return -EINVAL;
114 }
115
116 /* Port */
117 memcpy(&port_conf, &port_conf_default, sizeof(port_conf));
118 if (rss) {
119 uint64_t rss_hf = RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP | RTE_ETH_RSS_UDP;
120
121 port_conf.rxmode.mq_mode = RTE_ETH_MQ_RX_RSS;
122 port_conf.rx_adv_conf.rss_conf.rss_hf = rss_hf & port_info.flow_type_rss_offloads;
123 }
124
125 numa_node = rte_eth_dev_socket_id(port_id);
126 if (numa_node == SOCKET_ID_ANY)
127 numa_node = 0;

Callers 1

cmd_ethdevFunction · 0.70

Calls 13

rte_eth_dev_info_getFunction · 0.85
rte_mempool_lookupFunction · 0.85
rte_eth_dev_socket_idFunction · 0.85
rte_eth_dev_configureFunction · 0.85
rte_eth_rx_queue_setupFunction · 0.85
rte_eth_tx_queue_setupFunction · 0.85
rte_eth_dev_startFunction · 0.85
rte_eth_dev_stopFunction · 0.85
rte_eth_dev_set_link_upFunction · 0.85
rss_setupFunction · 0.70

Tested by

no test coverage detected