Hi Matias, Today, on "ODP Apps, Cloud, Demos, OFP" meeting I asked about the possibility/opportunity to add an odp_pktio_mac_addr_set() API.
This API may not make sense for some pktios but may be useful for others: OFP may (eventually) use tap pktio to replace existing tap functionality associated with slow path support if will be able to set the same MAC for tap interface and 'real' interface (e.g. tap interface and dpdk interface). An odp_pktio_mac_addr_set() API will solve your problem? Or maybe you need an extra argument in odp_pktio_open()? BR, Bogdan On 16 March 2017 at 16:27, Maxim Uvarov <maxim.uva...@linaro.org> wrote: > On 03/16/17 16:07, Matias Elo wrote: >> Previously the mac addresses of virtual netmap devices would clash if >> multiple odp processes were run on the same host. >> >> Signed-off-by: Matias Elo <matias....@nokia.com> >> --- >> platform/linux-generic/pktio/netmap.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/platform/linux-generic/pktio/netmap.c >> b/platform/linux-generic/pktio/netmap.c >> index ae3db34..b9e983d 100644 >> --- a/platform/linux-generic/pktio/netmap.c >> +++ b/platform/linux-generic/pktio/netmap.c >> @@ -386,6 +386,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, >> pktio_entry_t *pktio_entry, >> >> if (pkt_nm->is_virtual) { >> static unsigned mac; >> + uint32_t pid = getpid(); >> >> pkt_nm->capa.max_input_queues = 1; >> pkt_nm->capa.set_op.op.promisc_mode = 0; >> @@ -393,6 +394,10 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, >> pktio_entry_t *pktio_entry, >> pktio_entry->s.stats_type = STATS_UNSUPPORTED; >> /* Set MAC address for virtual interface */ >> pkt_nm->if_mac[0] = 0x2; >> + pkt_nm->if_mac[1] = (pid >> 24) & 0xff; >> + pkt_nm->if_mac[2] = (pid >> 16) & 0xff; >> + pkt_nm->if_mac[3] = (pid >> 8) & 0xff; >> + pkt_nm->if_mac[4] = pid & 0xff; >> pkt_nm->if_mac[5] = ++mac; >> >> return 0; >> > > > (odp_instance_t)odp_global_data.main_pid can be used in that case. > > But for better support thread and process modes I think > getpid()+gettid() is needed. > > Maxim.