+/* Find ethdev in list */
+static inline struct internal_list *
+find_internal_resource(struct pmd_internals *port_int)
+{
+ int found = 0;
+ struct internal_list *list = NULL;
+
+ if (port_int == NULL)
+ return NULL;
+
+ pthread_mutex_lock(&internal_list_lock);
+
+ TAILQ_FOREACH(list, &internal_list, next) {
+ struct pmd_internals *list_int =
+ list->eth_dev->data->dev_private;
+ if (list_int == port_int) {
+ found = 1;
+ break;
+ }
+ }
+
+ pthread_mutex_unlock(&internal_list_lock);
+
+ if (!found)
+ return NULL;
+
+ return list;
+}
+
+/* Get a pointer to an existing UMEM which overlays the rxq's mb_pool */
+static inline struct xsk_umem_info *
+get_shared_umem(struct pkt_rx_queue *rxq) {
+ struct internal_list *list;
+ struct pmd_internals *internals;
+ int i = 0;
+ struct rte_mempool *mb_pool = rxq->mb_pool;
+
+ if (mb_pool == NULL)
+ return NULL;
+
+ pthread_mutex_lock(&internal_list_lock);
+
+ TAILQ_FOREACH(list, &internal_list, next) {
+ internals = list->eth_dev->data->dev_private;
+ for (i = 0; i < internals->queue_cnt; i++) {
+ struct pkt_rx_queue *list_rxq =
+ &internals->rx_queues[i];
+ if (rxq == list_rxq)
+ continue;
+ if (mb_pool == internals->rx_queues[i].mb_pool) {
+ if (__atomic_load_n(
+ &internals->rx_queues[i].umem->refcnt,
+ __ATOMIC_ACQUIRE)) {
+ pthread_mutex_unlock(
+ &internal_list_lock);
+ return internals->rx_queues[i].umem;
+ }
+ }
+ }
+ }
+
+ pthread_mutex_unlock(&internal_list_lock);
+
+ return NULL;
+}
+