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

Function mlx4_rss_get

dpdk/drivers/net/mlx4/mlx4_rxq.c:88–124  ·  view source on GitHub ↗

* Obtain a RSS context with specified properties. * * Used when creating a flow rule targeting one or several Rx queues. * * If a matching RSS context already exists, it is returned with its * reference count incremented. * * @param priv * Pointer to private structure. * @param fields * Fields for RSS processing (Verbs format). * @param[in] key * Hash key to use (whose size is ex

Source from the content-addressed store, hash-verified

86 * Pointer to RSS context on success, NULL otherwise and rte_errno is set.
87 */
88struct mlx4_rss *
89mlx4_rss_get(struct mlx4_priv *priv, uint64_t fields,
90 const uint8_t key[MLX4_RSS_HASH_KEY_SIZE],
91 uint16_t queues, const uint16_t queue_id[])
92{
93 struct mlx4_rss *rss;
94 size_t queue_id_size = sizeof(queue_id[0]) * queues;
95
96 LIST_FOREACH(rss, &priv->rss, next)
97 if (fields == rss->fields &&
98 queues == rss->queues &&
99 !memcmp(key, rss->key, MLX4_RSS_HASH_KEY_SIZE) &&
100 !memcmp(queue_id, rss->queue_id, queue_id_size)) {
101 ++rss->refcnt;
102 return rss;
103 }
104 rss = rte_malloc(__func__, offsetof(struct mlx4_rss, queue_id) +
105 queue_id_size, 0);
106 if (!rss)
107 goto error;
108 *rss = (struct mlx4_rss){
109 .priv = priv,
110 .refcnt = 1,
111 .usecnt = 0,
112 .qp = NULL,
113 .ind = NULL,
114 .fields = fields,
115 .queues = queues,
116 };
117 memcpy(rss->key, key, MLX4_RSS_HASH_KEY_SIZE);
118 memcpy(rss->queue_id, queue_id, queue_id_size);
119 LIST_INSERT_HEAD(&priv->rss, rss, next);
120 return rss;
121error:
122 rte_errno = ENOMEM;
123 return NULL;
124}
125
126/**
127 * Release a RSS context instance.

Callers 1

mlx4_flow_prepareFunction · 0.85

Calls 2

rte_mallocFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected