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

Function mlx5_dev_configure

dpdk/drivers/net/mlx5/mlx5_ethdev.c:67–156  ·  view source on GitHub ↗

* DPDK callback for Ethernet device configuration. * * @param dev * Pointer to Ethernet device structure. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */

Source from the content-addressed store, hash-verified

65 * 0 on success, a negative errno value otherwise and rte_errno is set.
66 */
67int
68mlx5_dev_configure(struct rte_eth_dev *dev)
69{
70 struct mlx5_priv *priv = dev->data->dev_private;
71 unsigned int rxqs_n = dev->data->nb_rx_queues;
72 unsigned int txqs_n = dev->data->nb_tx_queues;
73 const uint8_t use_app_rss_key =
74 !!dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key;
75 int ret = 0;
76
77 if (use_app_rss_key &&
78 (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len !=
79 MLX5_RSS_HASH_KEY_LEN)) {
80 DRV_LOG(ERR, "port %u RSS key len must be %s Bytes long",
81 dev->data->port_id, RTE_STR(MLX5_RSS_HASH_KEY_LEN));
82 rte_errno = EINVAL;
83 return -rte_errno;
84 }
85 priv->rss_conf.rss_key = mlx5_realloc(priv->rss_conf.rss_key,
86 MLX5_MEM_RTE,
87 MLX5_RSS_HASH_KEY_LEN, 0,
88 SOCKET_ID_ANY);
89 if (!priv->rss_conf.rss_key) {
90 DRV_LOG(ERR, "port %u cannot allocate RSS hash key memory (%u)",
91 dev->data->port_id, rxqs_n);
92 rte_errno = ENOMEM;
93 return -rte_errno;
94 }
95
96 if ((dev->data->dev_conf.txmode.offloads &
97 RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP) &&
98 rte_mbuf_dyn_tx_timestamp_register(NULL, NULL) != 0) {
99 DRV_LOG(ERR, "port %u cannot register Tx timestamp field/flag",
100 dev->data->port_id);
101 return -rte_errno;
102 }
103 memcpy(priv->rss_conf.rss_key,
104 use_app_rss_key ?
105 dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key :
106 rss_hash_default_key,
107 MLX5_RSS_HASH_KEY_LEN);
108 priv->rss_conf.rss_key_len = MLX5_RSS_HASH_KEY_LEN;
109 priv->rss_conf.rss_hf = dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf;
110 priv->rxq_privs = mlx5_realloc(priv->rxq_privs,
111 MLX5_MEM_RTE | MLX5_MEM_ZERO,
112 sizeof(void *) * rxqs_n, 0,
113 SOCKET_ID_ANY);
114 if (rxqs_n && priv->rxq_privs == NULL) {
115 DRV_LOG(ERR, "port %u cannot allocate rxq private data",
116 dev->data->port_id);
117 rte_errno = ENOMEM;
118 return -rte_errno;
119 }
120 priv->txqs = (void *)dev->data->tx_queues;
121 if (txqs_n != priv->txqs_n) {
122 DRV_LOG(INFO, "port %u Tx queues number update: %u -> %u",
123 dev->data->port_id, priv->txqs_n, txqs_n);
124 priv->txqs_n = txqs_n;

Callers

nothing calls this directly

Calls 5

mlx5_reallocFunction · 0.85
mlx5_proc_priv_initFunction · 0.85
mlx5_dev_set_mtuFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected