devices: default mode eth in the api

Type: fix

https://gerrit.fd.io/r/c/vpp/+/34027 added support
for l3 mode, but as the eth_mode constant was set
to 1 we did default to l3 mode in the api.

This reverts to the original logic.

Change-Id: If8b90b300d3868de5233dfa1f33ec975853cba11
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c
index 69e3c87..0508d3e 100644
--- a/src/vnet/devices/af_packet/af_packet.c
+++ b/src/vnet/devices/af_packet/af_packet.c
@@ -381,7 +381,7 @@
   if (tm->n_vlib_mains > 1)
     clib_spinlock_init (&apif->lockp);
 
-  if (apif->mode == AF_PACKET_IF_MODE_ETHERNET)
+  if (apif->mode != AF_PACKET_IF_MODE_IP)
     {
       /*use configured or generate random MAC address */
       if (arg->hw_addr)
@@ -518,7 +518,7 @@
 
   mhash_unset (&apm->if_index_by_host_if_name, host_if_name, &if_index);
 
-  if (apif->mode == AF_PACKET_IF_MODE_ETHERNET)
+  if (apif->mode != AF_PACKET_IF_MODE_IP)
     ethernet_delete_interface (vnm, apif->hw_if_index);
   else
     vnet_delete_hw_interface (vnm, apif->hw_if_index);
diff --git a/src/vnet/devices/af_packet/af_packet_api.c b/src/vnet/devices/af_packet/af_packet_api.c
index 80a2d92..3d57977 100644
--- a/src/vnet/devices/af_packet/af_packet_api.c
+++ b/src/vnet/devices/af_packet/af_packet_api.c
@@ -46,6 +46,7 @@
   vec_add1 (arg->host_if_name, 0);
 
   arg->hw_addr = mp->use_random_hw_addr ? 0 : mp->hw_addr;
+  arg->mode = AF_PACKET_IF_MODE_ETHERNET;
   rv = af_packet_create_if (arg);
 
   vec_free (arg->host_if_name);
@@ -72,6 +73,7 @@
   arg->rx_frames_per_block = clib_net_to_host_u32 (mp->rx_frames_per_block);
   arg->tx_frames_per_block = clib_net_to_host_u32 (mp->tx_frames_per_block);
   arg->hw_addr = mp->use_random_hw_addr ? 0 : mp->hw_addr;
+  arg->mode = AF_PACKET_IF_MODE_ETHERNET;
 
   if (mp->num_rx_queues > 1)
     {