Fix setting mac address through [port] section 35/68535/2
authorXavier Simonart <xavier.simonart@intel.com>
Tue, 24 Sep 2019 16:42:44 +0000 (18:42 +0200)
committerPatrice Buriez <patrice.buriez@intel.com>
Tue, 8 Oct 2019 19:33:55 +0000 (19:33 +0000)
MAC address can be configured through the [port] section.
However this had only some effect on packets being transmitted.
For instance it was used to set the src mac address by the generator.
It had no effect on packets reception: when not in promiscuous mode
only the packets with the MAC originally set by the HW were received.
Now, when not in promiscuous mode, only packets with MAC as defined
in [port] section will be received.

Change-Id: I064817bf6727d098e89fbbb7a90412ed599f0fb6
Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
VNFs/DPPD-PROX/prox_port_cfg.c

index d6cede9..c335ee1 100644 (file)
@@ -718,6 +718,7 @@ void close_ports_atexit(void)
 void init_port_addr(void)
 {
        struct prox_port_cfg *port_cfg;
+       int rc;
 
        for (uint8_t port_id = 0; port_id < PROX_MAX_PORTS; ++port_id) {
                if (!prox_port_cfg[port_id].active) {
@@ -733,6 +734,8 @@ void init_port_addr(void)
                        eth_random_addr(port_cfg->eth_addr.addr_bytes);
                        break;
                case PROX_PORT_MAC_SET:
+                       if ((rc = rte_eth_dev_default_mac_addr_set(port_id, &port_cfg->eth_addr)) != 0)
+                               plog_warn("port %u: failed to set mac address. Error = %d\n", port_id, rc);
                        break;
                }
        }