.. code-block:: console
./<build_dir>/examples/dpdk-l2fwd [EAL options] -- -p PORTMASK
+ [-P]
[-q NQ]
--[no-]mac-updating
[--portmap="(port, port)[,(port, port)]"]
* p PORTMASK: A hexadecimal bitmask of the ports to configure
+* P: Optional, set all ports to promiscuous mode
+ so that packets are accepted regardless of the MAC destination address.
+ Without this option, only packets with the MAC destination address
+ set to the Ethernet address of the port are accepted.
+
* q NQ: A number of queues (=ports) per lcore (default is 1)
* --[no-]mac-updating: Enable or disable MAC addresses updating (enabled by default)
/* MAC updating enabled by default */
static int mac_updating = 1;
+/* Ports set in promiscuous mode off by default. */
+static int promiscuous_on;
+
#define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1
#define MAX_PKT_BURST 32
static void
l2fwd_usage(const char *prgname)
{
- printf("%s [EAL options] -- -p PORTMASK [-q NQ]\n"
+ printf("%s [EAL options] -- -p PORTMASK [-P] [-q NQ]\n"
" -p PORTMASK: hexadecimal bitmask of ports to configure\n"
+ " -P : Enable promiscuous mode\n"
" -q NQ: number of queue (=ports) per lcore (default is 1)\n"
" -T PERIOD: statistics will be refreshed each PERIOD seconds (0 to disable, 10 default, 86400 maximum)\n"
" --no-mac-updating: Disable MAC addresses updating (enabled by default)\n"
static const char short_options[] =
"p:" /* portmask */
+ "P" /* promiscuous */
"q:" /* number of queues */
"T:" /* timer period */
;
return -1;
}
break;
+ case 'P':
+ promiscuous_on = 1;
+ break;
/* nqueue */
case 'q':
ret, portid);
printf("done: \n");
-
- ret = rte_eth_promiscuous_enable(portid);
- if (ret != 0)
- rte_exit(EXIT_FAILURE,
- "rte_eth_promiscuous_enable:err=%s, port=%u\n",
- rte_strerror(-ret), portid);
+ if (promiscuous_on) {
+ ret = rte_eth_promiscuous_enable(portid);
+ if (ret != 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_promiscuous_enable:err=%s, port=%u\n",
+ rte_strerror(-ret), portid);
+ }
printf("Port %u, MAC address: " RTE_ETHER_ADDR_PRT_FMT "\n\n",
portid,