[dpdk-dev,v2] net/tap: allow user MAC to be passed as args

Message ID a09d0ef98a2cb7935f691ae66af34dc1e123d914.1517840652.git.pascal.mazon@6wind.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation fail Compilation issues

Commit Message

Pascal Mazon Feb. 5, 2018, 3:54 p.m. UTC
  From: Vipin Varghese <vipin.varghese@intel.com>

Allow TAP PMD to pass user desired MAC address as argument.
The argument value is processed as string, where each 2 bytes
are converted to HEX MAC address after validation.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
---

Hi Vipin,

I suggest the following patch for your MAC address argument, if that
suits you.
I removed ETH_TAP_MAC_STR_FXD and ETH_TAP_MAC_STR_USR that were not
really useful. I find it nicer to deal with MAC mostly inside
set_mac_type().
What do you think? Can you test that it fits your needs?

Best regards,
Pascal

 doc/guides/nics/tap.rst       |  6 ++++
 drivers/net/tap/rte_eth_tap.c | 80 +++++++++++++++++++++++++++++--------------
 2 files changed, 60 insertions(+), 26 deletions(-)
  

Comments

Varghese, Vipin Feb. 5, 2018, 3:58 p.m. UTC | #1
Hi Pascal,

Thanks for the update, I see your point instead of mixing up with int32_t and uint64_t; converting to ' struct ether_addr' makes sense.

I will check internally and thanks once again for the suggestion.

Thanks
Vipin Varghese

> -----Original Message-----
> From: Pascal Mazon [mailto:pascal.mazon@6wind.com]
> Sent: Monday, February 5, 2018 3:55 PM
> To: dev@dpdk.org; Varghese, Vipin <vipin.varghese@intel.com>
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; Jain, Deepak K
> <deepak.k.jain@intel.com>; Pascal Mazon <pascal.mazon@6wind.com>
> Subject: [PATCH v2] net/tap: allow user MAC to be passed as args
> 
> From: Vipin Varghese <vipin.varghese@intel.com>
> 
> Allow TAP PMD to pass user desired MAC address as argument.
> The argument value is processed as string, where each 2 bytes are converted to
> HEX MAC address after validation.
> 
> Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
> Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
> ---
> 
> Hi Vipin,
> 
> I suggest the following patch for your MAC address argument, if that suits you.
> I removed ETH_TAP_MAC_STR_FXD and ETH_TAP_MAC_STR_USR that were not
> really useful. I find it nicer to deal with MAC mostly inside set_mac_type().
> What do you think? Can you test that it fits your needs?
> 
> Best regards,
> Pascal
> 
>  doc/guides/nics/tap.rst       |  6 ++++
>  drivers/net/tap/rte_eth_tap.c | 80 +++++++++++++++++++++++++++++-----------
> ---
>  2 files changed, 60 insertions(+), 26 deletions(-)
> 
> diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst index
> dc6f834ca0a1..6b083c846b21 100644
> --- a/doc/guides/nics/tap.rst
> +++ b/doc/guides/nics/tap.rst
> @@ -69,6 +69,12 @@ for each interface string containing ``mac=fixed``. The
> MAC address is formatted  as 00:'d':'t':'a':'p':[00-FF]. Convert the characters to
> hex and you get the  actual MAC address: ``00:64:74:61:70:[00-FF]``.
> 
> +   --vdev=net_tap0,mac="00:64:74:61:70:11"
> +
> +The MAC address will have a user value passed as string. The MAC
> +address is in format with delimeter ``:``. The string is byte converted
> +to hex and you get the actual MAC address: ``00:64:74:61:70:11``.
> +
>  It is possible to specify a remote netdevice to capture packets from by adding
> ``remote=foo1``, for example::
> 
> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index
> 29d635613c0b..d9e5ec92b8f0 100644
> --- a/drivers/net/tap/rte_eth_tap.c
> +++ b/drivers/net/tap/rte_eth_tap.c
> @@ -49,6 +49,10 @@
>  #define ETH_TAP_MAC_ARG         "mac"
>  #define ETH_TAP_MAC_FIXED       "fixed"
> 
> +#define ETH_TAP_USR_MAC_FMT     "xx:xx:xx:xx:xx:xx"
> +#define ETH_TAP_CMP_MAC_FMT     "0123456789ABCDEFabcdef"
> +#define ETH_TAP_MAC_ARG_FMT     "["ETH_TAP_MAC_FIXED "|"
> ETH_TAP_USR_MAC_FMT"]"
> +
>  static struct rte_vdev_driver pmd_tap_drv;
> 
>  static const char *valid_arguments[] = { @@ -278,15 +282,8 @@
> tap_rx_offload_get_queue_capa(void)
>  static bool
>  tap_rxq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads)  {
> -	uint64_t port_offloads = dev->data->dev_conf.rxmode.offloads;
> -	uint64_t queue_supp_offloads = tap_rx_offload_get_queue_capa();
> -	uint64_t port_supp_offloads = tap_rx_offload_get_port_capa();
> -
> -	if ((offloads & (queue_supp_offloads | port_supp_offloads)) !=
> -	    offloads)
> -		return false;
> -	if ((port_offloads ^ offloads) & port_supp_offloads)
> -		return false;
> +	(void)dev;
> +	(void)offloads;
>  	return true;
>  }
> 
> @@ -1335,7 +1332,7 @@ static const struct eth_dev_ops ops = {
> 
>  static int
>  eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name,
> -		   char *remote_iface, int fixed_mac_type)
> +		   char *remote_iface, struct ether_addr *mac_addr)
>  {
>  	int numa_node = rte_socket_id();
>  	struct rte_eth_dev *dev;
> @@ -1397,16 +1394,10 @@ eth_dev_tap_create(struct rte_vdev_device *vdev,
> char *tap_name,
>  		pmd->txq[i].fd = -1;
>  	}
> 
> -	if (fixed_mac_type) {
> -		/* fixed mac = 00:64:74:61:70:<iface_idx> */
> -		static int iface_idx;
> -		char mac[ETHER_ADDR_LEN] = "\0dtap";
> -
> -		mac[ETHER_ADDR_LEN - 1] = iface_idx++;
> -		rte_memcpy(&pmd->eth_addr, mac, ETHER_ADDR_LEN);
> -	} else {
> +	if (is_zero_ether_addr(mac_addr))
>  		eth_random_addr((uint8_t *)&pmd->eth_addr);
> -	}
> +	else
> +		rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(mac_addr));
> 
>  	/* Immediately create the netdevice (this will create the 1st queue). */
>  	/* rx queue */
> @@ -1577,10 +1568,47 @@ set_mac_type(const char *key __rte_unused,
>  	     const char *value,
>  	     void *extra_args)
>  {
> -	if (value &&
> -	    !strncasecmp(ETH_TAP_MAC_FIXED, value,
> strlen(ETH_TAP_MAC_FIXED)))
> -		*(int *)extra_args = 1;
> +	char mac_temp[strlen(ETH_TAP_USR_MAC_FMT) + 1], *mac_byte =
> NULL;
> +	struct ether_addr *user_mac = extra_args;
> +	unsigned int index = 0;
> +
> +	if (!value)
> +		return 0;
> +
> +	if (!strncasecmp(ETH_TAP_MAC_FIXED, value,
> +			strlen(ETH_TAP_MAC_FIXED))) {
> +		static int iface_idx;
> +
> +		/* fixed mac = 00:64:74:61:70:<iface_idx> */
> +		memcpy((char *)user_mac->addr_bytes, "\0dtap",
> ETHER_ADDR_LEN);
> +		user_mac->addr_bytes[ETHER_ADDR_LEN - 1] = iface_idx++ +
> '0';
> +		goto success;
> +	}
> +
> +	if (strlen(value) != strlen(ETH_TAP_USR_MAC_FMT))
> +		goto error;
> +
> +	snprintf(mac_temp, sizeof(mac_temp), "%s", value);
> +	mac_byte = strtok(mac_temp, ":");
> +
> +	while ((mac_byte != NULL) &&
> +			strspn(mac_byte, ETH_TAP_CMP_MAC_FMT) &&
> +			strlen(mac_byte) == 2) {
> +		user_mac->addr_bytes[index++] = (char) strtoul(mac_byte,
> NULL, 16);
> +		mac_byte = strtok(NULL, ":");
> +	}
> +
> +	if (index != 6)
> +		goto error;
> +
> +success:
> +	RTE_LOG(DEBUG, PMD, "TAP user MAC param (%s)\n", value);
>  	return 0;
> +
> +error:
> +	RTE_LOG(ERR, PMD, "TAP user MAC (%s) is not in format (%s|%s)\n",
> +		value, ETH_TAP_MAC_FIXED, ETH_TAP_USR_MAC_FMT);
> +	return -1;
>  }
> 
>  /* Open a TAP interface device.
> @@ -1594,7 +1622,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
>  	int speed;
>  	char tap_name[RTE_ETH_NAME_MAX_LEN];
>  	char remote_iface[RTE_ETH_NAME_MAX_LEN];
> -	int fixed_mac_type = 0;
> +	struct ether_addr user_mac = {0};
> 
>  	name = rte_vdev_device_name(dev);
>  	params = rte_vdev_device_args(dev);
> @@ -1640,7 +1668,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
>  				ret = rte_kvargs_process(kvlist,
>  							 ETH_TAP_MAC_ARG,
>  							 &set_mac_type,
> -							 &fixed_mac_type);
> +							 &user_mac);
>  				if (ret == -1)
>  					goto leave;
>  			}
> @@ -1651,7 +1679,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
>  	RTE_LOG(NOTICE, PMD, "Initializing pmd_tap for %s as %s\n",
>  		name, tap_name);
> 
> -	ret = eth_dev_tap_create(dev, tap_name, remote_iface,
> fixed_mac_type);
> +	ret = eth_dev_tap_create(dev, tap_name, remote_iface, &user_mac);
> 
>  leave:
>  	if (ret == -1) {
> @@ -1716,5 +1744,5 @@ RTE_PMD_REGISTER_ALIAS(net_tap, eth_tap);
> RTE_PMD_REGISTER_PARAM_STRING(net_tap,
>  			      ETH_TAP_IFACE_ARG "=<string> "
>  			      ETH_TAP_SPEED_ARG "=<int> "
> -			      ETH_TAP_MAC_ARG "=" ETH_TAP_MAC_FIXED " "
> +			      ETH_TAP_MAC_ARG "=" ETH_TAP_MAC_ARG_FMT
>  			      ETH_TAP_REMOTE_ARG "=<string>");
> --
> 2.11.0
  
Varghese, Vipin Feb. 5, 2018, 6:13 p.m. UTC | #2
Hi Pascal,

Please find my observation inline

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Varghese, Vipin
> Sent: Monday, February 5, 2018 3:59 PM
> To: Pascal Mazon <pascal.mazon@6wind.com>; dev@dpdk.org
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; Jain, Deepak K
> <deepak.k.jain@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2] net/tap: allow user MAC to be passed as args
> 
> Hi Pascal,
> 
> Thanks for the update, I see your point instead of mixing up with int32_t and
> uint64_t; converting to ' struct ether_addr' makes sense.
> 
> I will check internally and thanks once again for the suggestion.
> 
> Thanks
> Vipin Varghese
> 
> > -----Original Message-----
> > From: Pascal Mazon [mailto:pascal.mazon@6wind.com]
> > Sent: Monday, February 5, 2018 3:55 PM
> > To: dev@dpdk.org; Varghese, Vipin <vipin.varghese@intel.com>
> > Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; Jain, Deepak K
> > <deepak.k.jain@intel.com>; Pascal Mazon <pascal.mazon@6wind.com>
> > Subject: [PATCH v2] net/tap: allow user MAC to be passed as args
> >
> > From: Vipin Varghese <vipin.varghese@intel.com>
> >
> > Allow TAP PMD to pass user desired MAC address as argument.
> > The argument value is processed as string, where each 2 bytes are
> > converted to HEX MAC address after validation.
> >
> > Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
> > Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
> > ---
> >
> > Hi Vipin,
> >
> > I suggest the following patch for your MAC address argument, if that suits you.
> > I removed ETH_TAP_MAC_STR_FXD and ETH_TAP_MAC_STR_USR that were
> not
> > really useful. I find it nicer to deal with MAC mostly inside set_mac_type().
> > What do you think? Can you test that it fits your needs?
> >
> > Best regards,
> > Pascal
> >
> >  doc/guides/nics/tap.rst       |  6 ++++
> >  drivers/net/tap/rte_eth_tap.c | 80
> > +++++++++++++++++++++++++++++-----------
> > ---
> >  2 files changed, 60 insertions(+), 26 deletions(-)
> >
> > diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst index
> > dc6f834ca0a1..6b083c846b21 100644
> > --- a/doc/guides/nics/tap.rst
> > +++ b/doc/guides/nics/tap.rst

<Snipped>

> > +
> > +	while ((mac_byte != NULL) &&
> > +			strspn(mac_byte, ETH_TAP_CMP_MAC_FMT) &&

Added ' strspn(mac_byte + 1, ETH_TAP_CMP_MAC_FMT) &&'; because 2 character validation was not taking place

<Snipped>

> >
> >  /* Open a TAP interface device.
> > @@ -1594,7 +1622,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
> >  	int speed;
> >  	char tap_name[RTE_ETH_NAME_MAX_LEN];
> >  	char remote_iface[RTE_ETH_NAME_MAX_LEN];
> > -	int fixed_mac_type = 0;
> > +	struct ether_addr user_mac = {0};

Changed to ' struct ether_addr user_mac = { .addr_bytes={0}};'; to prevent compilation failure.

> >
> >  	name = rte_vdev_device_name(dev);
> >  	params = rte_vdev_device_args(dev);
> > @@ -1640,7 +1668,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
> >  				ret = rte_kvargs_process(kvlist,
> >  							 ETH_TAP_MAC_ARG,
> >  							 &set_mac_type,
> > -							 &fixed_mac_type);
> > +							 &user_mac);
> >  				if (ret == -1)
> >  					goto leave;
> >  			}
> > @@ -1651,7 +1679,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
> >  	RTE_LOG(NOTICE, PMD, "Initializing pmd_tap for %s as %s\n",
> >  		name, tap_name);
> >
> > -	ret = eth_dev_tap_create(dev, tap_name, remote_iface,
> > fixed_mac_type);
> > +	ret = eth_dev_tap_create(dev, tap_name, remote_iface, &user_mac);
> >
> >  leave:
> >  	if (ret == -1) {
> > @@ -1716,5 +1744,5 @@ RTE_PMD_REGISTER_ALIAS(net_tap, eth_tap);
> > RTE_PMD_REGISTER_PARAM_STRING(net_tap,
> >  			      ETH_TAP_IFACE_ARG "=<string> "
> >  			      ETH_TAP_SPEED_ARG "=<int> "
> > -			      ETH_TAP_MAC_ARG "=" ETH_TAP_MAC_FIXED " "
> > +			      ETH_TAP_MAC_ARG "=" ETH_TAP_MAC_ARG_FMT
> >  			      ETH_TAP_REMOTE_ARG "=<string>");
> > --
> > 2.11.0

With these changes it is reviewed from my end.
  
Ferruh Yigit Feb. 5, 2018, 6:42 p.m. UTC | #3
On 2/5/2018 3:54 PM, Pascal Mazon wrote:
> From: Vipin Varghese <vipin.varghese@intel.com>
> 
> Allow TAP PMD to pass user desired MAC address as argument.
> The argument value is processed as string, where each 2 bytes
> are converted to HEX MAC address after validation.
> 
> Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
> Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>

<...>

 @@ -278,15 +282,8 @@ tap_rx_offload_get_queue_capa(void)
>  static bool
>  tap_rxq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads)
>  {
> -	uint64_t port_offloads = dev->data->dev_conf.rxmode.offloads;
> -	uint64_t queue_supp_offloads = tap_rx_offload_get_queue_capa();
> -	uint64_t port_supp_offloads = tap_rx_offload_get_port_capa();
> -
> -	if ((offloads & (queue_supp_offloads | port_supp_offloads)) !=
> -	    offloads)
> -		return false;
> -	if ((port_offloads ^ offloads) & port_supp_offloads)
> -		return false;
> +	(void)dev;
> +	(void)offloads;

This part seems unrelated with the patch?
  

Patch

diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst
index dc6f834ca0a1..6b083c846b21 100644
--- a/doc/guides/nics/tap.rst
+++ b/doc/guides/nics/tap.rst
@@ -69,6 +69,12 @@  for each interface string containing ``mac=fixed``. The MAC address is formatted
 as 00:'d':'t':'a':'p':[00-FF]. Convert the characters to hex and you get the
 actual MAC address: ``00:64:74:61:70:[00-FF]``.
 
+   --vdev=net_tap0,mac="00:64:74:61:70:11"
+
+The MAC address will have a user value passed as string. The MAC address is in
+format with delimeter ``:``. The string is byte converted to hex and you get
+the actual MAC address: ``00:64:74:61:70:11``.
+
 It is possible to specify a remote netdevice to capture packets from by adding
 ``remote=foo1``, for example::
 
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 29d635613c0b..d9e5ec92b8f0 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -49,6 +49,10 @@ 
 #define ETH_TAP_MAC_ARG         "mac"
 #define ETH_TAP_MAC_FIXED       "fixed"
 
+#define ETH_TAP_USR_MAC_FMT     "xx:xx:xx:xx:xx:xx"
+#define ETH_TAP_CMP_MAC_FMT     "0123456789ABCDEFabcdef"
+#define ETH_TAP_MAC_ARG_FMT     "["ETH_TAP_MAC_FIXED "|" ETH_TAP_USR_MAC_FMT"]"
+
 static struct rte_vdev_driver pmd_tap_drv;
 
 static const char *valid_arguments[] = {
@@ -278,15 +282,8 @@  tap_rx_offload_get_queue_capa(void)
 static bool
 tap_rxq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads)
 {
-	uint64_t port_offloads = dev->data->dev_conf.rxmode.offloads;
-	uint64_t queue_supp_offloads = tap_rx_offload_get_queue_capa();
-	uint64_t port_supp_offloads = tap_rx_offload_get_port_capa();
-
-	if ((offloads & (queue_supp_offloads | port_supp_offloads)) !=
-	    offloads)
-		return false;
-	if ((port_offloads ^ offloads) & port_supp_offloads)
-		return false;
+	(void)dev;
+	(void)offloads;
 	return true;
 }
 
@@ -1335,7 +1332,7 @@  static const struct eth_dev_ops ops = {
 
 static int
 eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name,
-		   char *remote_iface, int fixed_mac_type)
+		   char *remote_iface, struct ether_addr *mac_addr)
 {
 	int numa_node = rte_socket_id();
 	struct rte_eth_dev *dev;
@@ -1397,16 +1394,10 @@  eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name,
 		pmd->txq[i].fd = -1;
 	}
 
-	if (fixed_mac_type) {
-		/* fixed mac = 00:64:74:61:70:<iface_idx> */
-		static int iface_idx;
-		char mac[ETHER_ADDR_LEN] = "\0dtap";
-
-		mac[ETHER_ADDR_LEN - 1] = iface_idx++;
-		rte_memcpy(&pmd->eth_addr, mac, ETHER_ADDR_LEN);
-	} else {
+	if (is_zero_ether_addr(mac_addr))
 		eth_random_addr((uint8_t *)&pmd->eth_addr);
-	}
+	else
+		rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(mac_addr));
 
 	/* Immediately create the netdevice (this will create the 1st queue). */
 	/* rx queue */
@@ -1577,10 +1568,47 @@  set_mac_type(const char *key __rte_unused,
 	     const char *value,
 	     void *extra_args)
 {
-	if (value &&
-	    !strncasecmp(ETH_TAP_MAC_FIXED, value, strlen(ETH_TAP_MAC_FIXED)))
-		*(int *)extra_args = 1;
+	char mac_temp[strlen(ETH_TAP_USR_MAC_FMT) + 1], *mac_byte = NULL;
+	struct ether_addr *user_mac = extra_args;
+	unsigned int index = 0;
+
+	if (!value)
+		return 0;
+
+	if (!strncasecmp(ETH_TAP_MAC_FIXED, value,
+			strlen(ETH_TAP_MAC_FIXED))) {
+		static int iface_idx;
+
+		/* fixed mac = 00:64:74:61:70:<iface_idx> */
+		memcpy((char *)user_mac->addr_bytes, "\0dtap", ETHER_ADDR_LEN);
+		user_mac->addr_bytes[ETHER_ADDR_LEN - 1] = iface_idx++ + '0';
+		goto success;
+	}
+
+	if (strlen(value) != strlen(ETH_TAP_USR_MAC_FMT))
+		goto error;
+
+	snprintf(mac_temp, sizeof(mac_temp), "%s", value);
+	mac_byte = strtok(mac_temp, ":");
+
+	while ((mac_byte != NULL) &&
+			strspn(mac_byte, ETH_TAP_CMP_MAC_FMT) &&
+			strlen(mac_byte) == 2) {
+		user_mac->addr_bytes[index++] = (char) strtoul(mac_byte, NULL, 16);
+		mac_byte = strtok(NULL, ":");
+	}
+
+	if (index != 6)
+		goto error;
+
+success:
+	RTE_LOG(DEBUG, PMD, "TAP user MAC param (%s)\n", value);
 	return 0;
+
+error:
+	RTE_LOG(ERR, PMD, "TAP user MAC (%s) is not in format (%s|%s)\n",
+		value, ETH_TAP_MAC_FIXED, ETH_TAP_USR_MAC_FMT);
+	return -1;
 }
 
 /* Open a TAP interface device.
@@ -1594,7 +1622,7 @@  rte_pmd_tap_probe(struct rte_vdev_device *dev)
 	int speed;
 	char tap_name[RTE_ETH_NAME_MAX_LEN];
 	char remote_iface[RTE_ETH_NAME_MAX_LEN];
-	int fixed_mac_type = 0;
+	struct ether_addr user_mac = {0};
 
 	name = rte_vdev_device_name(dev);
 	params = rte_vdev_device_args(dev);
@@ -1640,7 +1668,7 @@  rte_pmd_tap_probe(struct rte_vdev_device *dev)
 				ret = rte_kvargs_process(kvlist,
 							 ETH_TAP_MAC_ARG,
 							 &set_mac_type,
-							 &fixed_mac_type);
+							 &user_mac);
 				if (ret == -1)
 					goto leave;
 			}
@@ -1651,7 +1679,7 @@  rte_pmd_tap_probe(struct rte_vdev_device *dev)
 	RTE_LOG(NOTICE, PMD, "Initializing pmd_tap for %s as %s\n",
 		name, tap_name);
 
-	ret = eth_dev_tap_create(dev, tap_name, remote_iface, fixed_mac_type);
+	ret = eth_dev_tap_create(dev, tap_name, remote_iface, &user_mac);
 
 leave:
 	if (ret == -1) {
@@ -1716,5 +1744,5 @@  RTE_PMD_REGISTER_ALIAS(net_tap, eth_tap);
 RTE_PMD_REGISTER_PARAM_STRING(net_tap,
 			      ETH_TAP_IFACE_ARG "=<string> "
 			      ETH_TAP_SPEED_ARG "=<int> "
-			      ETH_TAP_MAC_ARG "=" ETH_TAP_MAC_FIXED " "
+			      ETH_TAP_MAC_ARG "=" ETH_TAP_MAC_ARG_FMT
 			      ETH_TAP_REMOTE_ARG "=<string>");