Skip to contentSkip to conversation

af_packet: allow configuring number of rings

PATCH In review Stephen Hemminger 3 participants 12 messages Feb 24, 2020 – Mar 2, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 af_packet: allow configuring number of rings

The maximum number of rings in af_packet is hard coded as 16. The user should be able to configure this as part of DPDK config.

---
 config/common_base                        | 1 +
 drivers/net/af_packet/rte_eth_af_packet.c | 3 +++
 2 files changed, 4 insertions(+)
config/common_base +1 -0
index 6ea9c63cc36b..dd154a474b57 100644
@@ -468,6 +468,7 @@ CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n
 # Compile software PMD backed by AF_PACKET sockets (Linux only)
 #
 CONFIG_RTE_LIBRTE_PMD_AF_PACKET=n
+CONFIG_RTE_PMD_AF_PACKET_MAX_RINGS=16
 
 #
 # Compile software PMD backed by AF_XDP sockets (Linux only)
drivers/net/af_packet/rte_eth_af_packet.c +3 -0
index f5806bf42c46..6e90d231ca4f 100644
@@ -6,6 +6,7 @@
  * All rights reserved.
  */
 
+#include <rte_config.h>
 #include <rte_string_fns.h>
 #include <rte_mbuf.h>
 #include <rte_ethdev_driver.h>
@@ -37,7 +38,9 @@
 #define DFLT_FRAME_SIZE		(1 << 11)
 #define DFLT_FRAME_COUNT	(1 << 9)
 
+#ifndef RTE_PMD_AF_PACKET_MAX_RINGS
 #define RTE_PMD_AF_PACKET_MAX_RINGS 16
+#endif
 
 struct pkt_rx_queue {
 	int sockfd;
Signature · 1 line
2.20.1
#1 lore raw
Quoted 14 lines · Stephen Hemminger

The maximum number of rings in af_packet is hard coded as 16. The user should be able to configure this as part of DPDK config.

---
 config/common_base                        | 1 +
 drivers/net/af_packet/rte_eth_af_packet.c | 3 +++
 2 files changed, 4 insertions(+)
config/common_base +0 -0
index 6ea9c63cc36b..dd154a474b57 100644

config/common_base CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n · line 472

Quoted 5 lines
config/common_base +1 -0
@@ -468,6 +468,7 @@ CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n
 # Compile software PMD backed by AF_PACKET sockets (Linux only)
 #
 CONFIG_RTE_LIBRTE_PMD_AF_PACKET=n
+CONFIG_RTE_PMD_AF_PACKET_MAX_RINGS=16
 

Not sure about adding a new config option for this.

There is already "qpairs" devarg, allocating queues dynamically, instead of using a per-defined sized arrays, should enable removing 'RTE_PMD_AF_PACKET_MAX_RINGS' completely.

#2 lore raw
Quoted 23 lines · On Thu, 27 Feb 2020 17:20:45 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 14 lines · Stephen Hemminger

The maximum number of rings in af_packet is hard coded as 16. The user should be able to configure this as part of DPDK config.

---
 config/common_base                        | 1 +
 drivers/net/af_packet/rte_eth_af_packet.c | 3 +++
 2 files changed, 4 insertions(+)
config/common_base +0 -0
index 6ea9c63cc36b..dd154a474b57 100644

config/common_base CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n · line 472

Quoted 5 lines
config/common_base +1 -0
@@ -468,6 +468,7 @@ CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n
 # Compile software PMD backed by AF_PACKET sockets (Linux only)
 #
 CONFIG_RTE_LIBRTE_PMD_AF_PACKET=n
+CONFIG_RTE_PMD_AF_PACKET_MAX_RINGS=16
 

Not sure about adding a new config option for this.

Quoted 3 lines

There is already "qpairs" devarg, allocating queues dynamically, instead of using a per-defined sized arrays, should enable removing 'RTE_PMD_AF_PACKET_MAX_RINGS' completely.

But the current driver does not allow qpairs > 16. This is a config option to allow more.

#3 lore raw
Quoted 26 lines · Stephen Hemminger
Quoted 23 lines · On Thu, 27 Feb 2020 17:20:45 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 14 lines · Stephen Hemminger

The maximum number of rings in af_packet is hard coded as 16. The user should be able to configure this as part of DPDK config.

---
 config/common_base                        | 1 +
 drivers/net/af_packet/rte_eth_af_packet.c | 3 +++
 2 files changed, 4 insertions(+)
config/common_base +0 -0
index 6ea9c63cc36b..dd154a474b57 100644

config/common_base CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n · line 472

Quoted 5 lines
config/common_base +1 -0
@@ -468,6 +468,7 @@ CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n
 # Compile software PMD backed by AF_PACKET sockets (Linux only)
 #
 CONFIG_RTE_LIBRTE_PMD_AF_PACKET=n
+CONFIG_RTE_PMD_AF_PACKET_MAX_RINGS=16
 

Not sure about adding a new config option for this.

Quoted 7 lines
Quoted 3 lines

There is already "qpairs" devarg, allocating queues dynamically, instead of using a per-defined sized arrays, should enable removing 'RTE_PMD_AF_PACKET_MAX_RINGS' completely.

But the current driver does not allow qpairs > 16. This is a config option to allow more.

This can be done without config option by removing 16 limitation.

#4 lore raw

PATCH v2 1/1 net/af_packet: remove limitation on number of qpairs

In reply to Stephen Hemminger

Since qpairs is part of the vdev arguments, there is no need to limit it to 16. The queue arrays can be dynamically sized based on the requested parameters.

---
 drivers/net/af_packet/rte_eth_af_packet.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +17 -6
index f5806bf42c46..e5e0aa9277a8 100644
@@ -37,8 +37,6 @@
 #define DFLT_FRAME_SIZE		(1 << 11)
 #define DFLT_FRAME_COUNT	(1 << 9)
 
-#define RTE_PMD_AF_PACKET_MAX_RINGS 16
-
 struct pkt_rx_queue {
 	int sockfd;
 
@@ -77,8 +75,8 @@ struct pmd_internals {
 
 	struct tpacket_req req;
 
-	struct pkt_rx_queue rx_queue[RTE_PMD_AF_PACKET_MAX_RINGS];
-	struct pkt_tx_queue tx_queue[RTE_PMD_AF_PACKET_MAX_RINGS];
+	struct pkt_rx_queue *rx_queue;
+	struct pkt_tx_queue *tx_queue;
 };
 
 static const char *valid_arguments[] = {
@@ -601,6 +599,18 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
 	if (*internals == NULL)
 		return -1;
 
+
+	(*internals)->rx_queue = rte_calloc_socket("af_packet_rx",
+						nb_queues,
+						sizeof(struct pkt_rx_queue),
+						0, numa_node);
+	(*internals)->tx_queue = rte_calloc_socket("af_packet_tx",
+						nb_queues,
+						sizeof(struct pkt_tx_queue),
+						0, numa_node);
+	if (!(*internals)->rx_queue || !(*internals)->tx_queue)
+		return -1;
+
 	for (q = 0; q < nb_queues; q++) {
 		(*internals)->rx_queue[q].map = MAP_FAILED;
 		(*internals)->tx_queue[q].map = MAP_FAILED;
@@ -846,8 +856,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
 		pair = &kvlist->pairs[k_idx];
 		if (strstr(pair->key, ETH_AF_PACKET_NUM_Q_ARG) != NULL) {
 			qpairs = atoi(pair->value);
-			if (qpairs < 1 ||
-			    qpairs > RTE_PMD_AF_PACKET_MAX_RINGS) {
+			if (qpairs < 1) {
 				PMD_LOG(ERR,
 					"%s: invalid qpairs value",
 				        name);
@@ -1019,6 +1028,8 @@ rte_pmd_af_packet_remove(struct rte_vdev_device *dev)
 		rte_free(internals->tx_queue[q].rd);
 	}
 	free(internals->if_name);
+	rte_free(internals->rx_queue);
+	rte_free(internals->tx_queue);
 
 	rte_eth_dev_release_port(eth_dev);
 
Signature · 1 line
2.20.1
Acked-by on v2 1/1
#5 lore raw

Re: [dpdk-dev] [PATCH v2] net/af_packet: remove limitation on number of qpairs

Quoted 5 lines · Stephen Hemminger

Since qpairs is part of the vdev arguments, there is no need to limit it to 16. The queue arrays can be dynamically sized based on the requested parameters.

LGTM!

Quoted 70 lines
---
 drivers/net/af_packet/rte_eth_af_packet.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +17 -6
index f5806bf42c46..e5e0aa9277a8 100644
@@ -37,8 +37,6 @@
 #define DFLT_FRAME_SIZE		(1 << 11)
 #define DFLT_FRAME_COUNT	(1 << 9)
 
-#define RTE_PMD_AF_PACKET_MAX_RINGS 16
-
 struct pkt_rx_queue {
 	int sockfd;
 
@@ -77,8 +75,8 @@ struct pmd_internals {
 
 	struct tpacket_req req;
 
-	struct pkt_rx_queue rx_queue[RTE_PMD_AF_PACKET_MAX_RINGS];
-	struct pkt_tx_queue tx_queue[RTE_PMD_AF_PACKET_MAX_RINGS];
+	struct pkt_rx_queue *rx_queue;
+	struct pkt_tx_queue *tx_queue;
 };
 
 static const char *valid_arguments[] = {
@@ -601,6 +599,18 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
 	if (*internals == NULL)
 		return -1;
 
+
+	(*internals)->rx_queue = rte_calloc_socket("af_packet_rx",
+						nb_queues,
+						sizeof(struct pkt_rx_queue),
+						0, numa_node);
+	(*internals)->tx_queue = rte_calloc_socket("af_packet_tx",
+						nb_queues,
+						sizeof(struct pkt_tx_queue),
+						0, numa_node);
+	if (!(*internals)->rx_queue || !(*internals)->tx_queue)
+		return -1;
+
 	for (q = 0; q < nb_queues; q++) {
 		(*internals)->rx_queue[q].map = MAP_FAILED;
 		(*internals)->tx_queue[q].map = MAP_FAILED;
@@ -846,8 +856,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
 		pair = &kvlist->pairs[k_idx];
 		if (strstr(pair->key, ETH_AF_PACKET_NUM_Q_ARG) != NULL) {
 			qpairs = atoi(pair->value);
-			if (qpairs < 1 ||
-			    qpairs > RTE_PMD_AF_PACKET_MAX_RINGS) {
+			if (qpairs < 1) {
 				PMD_LOG(ERR,
 					"%s: invalid qpairs value",
 				        name);
@@ -1019,6 +1028,8 @@ rte_pmd_af_packet_remove(struct rte_vdev_device *dev)
 		rte_free(internals->tx_queue[q].rd);
 	}
 	free(internals->if_name);
+	rte_free(internals->rx_queue);
+	rte_free(internals->tx_queue);
 
 	rte_eth_dev_release_port(eth_dev);
 
Signature · 1 line
2.20.1
Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
Applied
#6 lore raw

Re: [dpdk-dev] [PATCH v2] net/af_packet: remove limitation on number of qpairs

Quoted 11 lines · John W. Linville
Quoted 5 lines · Stephen Hemminger

Since qpairs is part of the vdev arguments, there is no need to limit it to 16. The queue arrays can be dynamically sized based on the requested parameters.

LGTM!

Applied to dpdk-next-net/master, thanks.

(Mentioned possible failure path memory leak fixed while merging)

#7 lore raw

Re: [dpdk-dev] [PATCH v2] net/af_packet: remove limitation on number of qpairs

Quoted 8 lines · On Mon, 2 Mar 2020 16:24:23 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 7 lines · John W. Linville
Quoted 5 lines · Stephen Hemminger

Since qpairs is part of the vdev arguments, there is no need to limit it to 16. The queue arrays can be dynamically sized based on the requested parameters.

Quoted 8 lines
Quoted 4 lines

LGTM!

Applied to dpdk-next-net/master, thanks.

(Mentioned possible failure path memory leak fixed while merging)

The driver also needs updated close logic.

#8 lore raw

Re: [dpdk-dev] [PATCH v2] net/af_packet: remove limitation on number of qpairs

Quoted 13 lines · Stephen Hemminger
Quoted 10 lines · On Mon, 2 Mar 2020 16:24:23 +0000 Ferruh Yigit <[email protected]> wrote:
Quoted 9 lines · John W. Linville
Quoted 5 lines · Stephen Hemminger

Since qpairs is part of the vdev arguments, there is no need to limit it to 16. The queue arrays can be dynamically sized based on the requested parameters.

LGTM!

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

Applied to dpdk-next-net/master, thanks.

(Mentioned possible failure path memory leak fixed while merging)

The driver also needs updated close logic.

+1

#9 lore raw

Re: [dpdk-dev] [PATCH v2] net/af_packet: remove limitation on number of qpairs

In reply to Stephen Hemminger
Quoted 36 lines · Stephen Hemminger

Since qpairs is part of the vdev arguments, there is no need to limit it to 16. The queue arrays can be dynamically sized based on the requested parameters.

---
 drivers/net/af_packet/rte_eth_af_packet.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +2 -4
index f5806bf42c46..e5e0aa9277a8 100644
@@ -37,8 +37,6 @@
 #define DFLT_FRAME_SIZE		(1 << 11)
 #define DFLT_FRAME_COUNT	(1 << 9)
 
-#define RTE_PMD_AF_PACKET_MAX_RINGS 16
-
 struct pkt_rx_queue {
 	int sockfd;
 
@@ -77,8 +75,8 @@ struct pmd_internals {
 
 	struct tpacket_req req;
 
-	struct pkt_rx_queue rx_queue[RTE_PMD_AF_PACKET_MAX_RINGS];
-	struct pkt_tx_queue tx_queue[RTE_PMD_AF_PACKET_MAX_RINGS];
+	struct pkt_rx_queue *rx_queue;
+	struct pkt_tx_queue *tx_queue;
 };
 
 static const char *valid_arguments[] = {
@@ -601,6 +599,18 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
 	if (*internals == NULL)
 		return -1;

drivers/net/af_packet/rte_eth_af_packet.c rte_pmd_init_internals(struct rte_vdev_device *dev, · line 610

Quoted 10 lines
drivers/net/af_packet/rte_eth_af_packet.c +9 -0
 
+
+	(*internals)->rx_queue = rte_calloc_socket("af_packet_rx",
+						nb_queues,
+						sizeof(struct pkt_rx_queue),
+						0, numa_node);
+	(*internals)->tx_queue = rte_calloc_socket("af_packet_tx",
+						nb_queues,
+						sizeof(struct pkt_tx_queue),
+						0, numa_node);

Not for this patch but right now all queue initialization done during init based on max queue PMD can support, we may move allocating and configuring queues in 'eth_rx_queue_setup' & 'eth_tx_queue_setup' based on number of queue application request, in the future...

drivers/net/af_packet/rte_eth_af_packet.c rte_pmd_init_internals(struct rte_vdev_device *dev, · line 612

Quoted 2 lines
drivers/net/af_packet/rte_eth_af_packet.c +2 -0
+	if (!(*internals)->rx_queue || !(*internals)->tx_queue)
+		return -1;

If only one allocation fails, should we free the other?

Quoted 24 lines
drivers/net/af_packet/rte_eth_af_packet.c +4 -2
+
 	for (q = 0; q < nb_queues; q++) {
 		(*internals)->rx_queue[q].map = MAP_FAILED;
 		(*internals)->tx_queue[q].map = MAP_FAILED;
@@ -846,8 +856,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
 		pair = &kvlist->pairs[k_idx];
 		if (strstr(pair->key, ETH_AF_PACKET_NUM_Q_ARG) != NULL) {
 			qpairs = atoi(pair->value);
-			if (qpairs < 1 ||
-			    qpairs > RTE_PMD_AF_PACKET_MAX_RINGS) {
+			if (qpairs < 1) {
 				PMD_LOG(ERR,
 					"%s: invalid qpairs value",
 				        name);
@@ -1019,6 +1028,8 @@ rte_pmd_af_packet_remove(struct rte_vdev_device *dev)
 		rte_free(internals->tx_queue[q].rd);
 	}
 	free(internals->if_name);
+	rte_free(internals->rx_queue);
+	rte_free(internals->tx_queue);
 
 	rte_eth_dev_release_port(eth_dev);
 
#10 lore raw

Re: [dpdk-dev] [PATCH v2] net/af_packet: remove limitation on number of qpairs

Quoted 53 lines · Ferruh Yigit
Quoted 36 lines · Stephen Hemminger

Since qpairs is part of the vdev arguments, there is no need to limit it to 16. The queue arrays can be dynamically sized based on the requested parameters.

---
 drivers/net/af_packet/rte_eth_af_packet.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +2 -4
index f5806bf42c46..e5e0aa9277a8 100644
@@ -37,8 +37,6 @@
 #define DFLT_FRAME_SIZE		(1 << 11)
 #define DFLT_FRAME_COUNT	(1 << 9)
 
-#define RTE_PMD_AF_PACKET_MAX_RINGS 16
-
 struct pkt_rx_queue {
 	int sockfd;
 
@@ -77,8 +75,8 @@ struct pmd_internals {
 
 	struct tpacket_req req;
 
-	struct pkt_rx_queue rx_queue[RTE_PMD_AF_PACKET_MAX_RINGS];
-	struct pkt_tx_queue tx_queue[RTE_PMD_AF_PACKET_MAX_RINGS];
+	struct pkt_rx_queue *rx_queue;
+	struct pkt_tx_queue *tx_queue;
 };
 
 static const char *valid_arguments[] = {
@@ -601,6 +599,18 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
 	if (*internals == NULL)
 		return -1;

drivers/net/af_packet/rte_eth_af_packet.c rte_pmd_init_internals(struct rte_vdev_device *dev, · line 610

Quoted 10 lines
drivers/net/af_packet/rte_eth_af_packet.c +9 -0
 
+
+	(*internals)->rx_queue = rte_calloc_socket("af_packet_rx",
+						nb_queues,
+						sizeof(struct pkt_rx_queue),
+						0, numa_node);
+	(*internals)->tx_queue = rte_calloc_socket("af_packet_tx",
+						nb_queues,
+						sizeof(struct pkt_tx_queue),
+						0, numa_node);

Not for this patch but right now all queue initialization done during init based on max queue PMD can support, we may move allocating and configuring queues in 'eth_rx_queue_setup' & 'eth_tx_queue_setup' based on number of queue application request, in the future...

Quoted 4 lines

drivers/net/af_packet/rte_eth_af_packet.c rte_pmd_init_internals(struct rte_vdev_device *dev, · line 612

Quoted 2 lines
drivers/net/af_packet/rte_eth_af_packet.c +2 -0
+	if (!(*internals)->rx_queue || !(*internals)->tx_queue)
+		return -1;

If only one allocation fails, should we free the other?

Yeah, good catch.

Quoted 26 lines
Quoted 24 lines
drivers/net/af_packet/rte_eth_af_packet.c +4 -2
+
 	for (q = 0; q < nb_queues; q++) {
 		(*internals)->rx_queue[q].map = MAP_FAILED;
 		(*internals)->tx_queue[q].map = MAP_FAILED;
@@ -846,8 +856,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
 		pair = &kvlist->pairs[k_idx];
 		if (strstr(pair->key, ETH_AF_PACKET_NUM_Q_ARG) != NULL) {
 			qpairs = atoi(pair->value);
-			if (qpairs < 1 ||
-			    qpairs > RTE_PMD_AF_PACKET_MAX_RINGS) {
+			if (qpairs < 1) {
 				PMD_LOG(ERR,
 					"%s: invalid qpairs value",
 				        name);
@@ -1019,6 +1028,8 @@ rte_pmd_af_packet_remove(struct rte_vdev_device *dev)
 		rte_free(internals->tx_queue[q].rd);
 	}
 	free(internals->if_name);
+	rte_free(internals->rx_queue);
+	rte_free(internals->tx_queue);
 
 	rte_eth_dev_release_port(eth_dev);
 
Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#11 lore raw

Re: [dpdk-dev] [PATCH v2] net/af_packet: remove limitation on number of qpairs

Quoted 54 lines · John W. Linville
Quoted 53 lines · Ferruh Yigit
Quoted 36 lines · Stephen Hemminger

Since qpairs is part of the vdev arguments, there is no need to limit it to 16. The queue arrays can be dynamically sized based on the requested parameters.

---
 drivers/net/af_packet/rte_eth_af_packet.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +2 -4
index f5806bf42c46..e5e0aa9277a8 100644
@@ -37,8 +37,6 @@
 #define DFLT_FRAME_SIZE		(1 << 11)
 #define DFLT_FRAME_COUNT	(1 << 9)
 
-#define RTE_PMD_AF_PACKET_MAX_RINGS 16
-
 struct pkt_rx_queue {
 	int sockfd;
 
@@ -77,8 +75,8 @@ struct pmd_internals {
 
 	struct tpacket_req req;
 
-	struct pkt_rx_queue rx_queue[RTE_PMD_AF_PACKET_MAX_RINGS];
-	struct pkt_tx_queue tx_queue[RTE_PMD_AF_PACKET_MAX_RINGS];
+	struct pkt_rx_queue *rx_queue;
+	struct pkt_tx_queue *tx_queue;
 };
 
 static const char *valid_arguments[] = {
@@ -601,6 +599,18 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
 	if (*internals == NULL)
 		return -1;

drivers/net/af_packet/rte_eth_af_packet.c rte_pmd_init_internals(struct rte_vdev_device *dev, · line 610

Quoted 10 lines
drivers/net/af_packet/rte_eth_af_packet.c +9 -0
 
+
+	(*internals)->rx_queue = rte_calloc_socket("af_packet_rx",
+						nb_queues,
+						sizeof(struct pkt_rx_queue),
+						0, numa_node);
+	(*internals)->tx_queue = rte_calloc_socket("af_packet_tx",
+						nb_queues,
+						sizeof(struct pkt_tx_queue),
+						0, numa_node);

Not for this patch but right now all queue initialization done during init based on max queue PMD can support, we may move allocating and configuring queues in 'eth_rx_queue_setup' & 'eth_tx_queue_setup' based on number of queue application request, in the future...

Quoted 7 lines
Quoted 4 lines

drivers/net/af_packet/rte_eth_af_packet.c rte_pmd_init_internals(struct rte_vdev_device *dev, · line 612

Quoted 2 lines
drivers/net/af_packet/rte_eth_af_packet.c +2 -0
+	if (!(*internals)->rx_queue || !(*internals)->tx_queue)
+		return -1;

If only one allocation fails, should we free the other?

Yeah, good catch.

Will fix while merging.