Message ID | 1438689921-30362-1-git-send-email-ivan.khoronzhuk@linaro.org |
---|---|
State | New |
Headers | show |
On Tue, Aug 04, 2015 at 03:05:21PM +0300, Ivan Khoronzhuk wrote: > It's needed as pktio is not set in promisc mode. > > Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> > --- > test/performance/odp_pktio_perf.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c > index 08f13b6..fe4261e 100644 > --- a/test/performance/odp_pktio_perf.c > +++ b/test/performance/odp_pktio_perf.c > @@ -169,7 +169,6 @@ static odp_packet_t pktio_create_packet(void) > uint32_t offset; > pkt_head_t pkt_hdr; > size_t payload_len; > - uint8_t mac[ODPH_ETHADDR_LEN] = {0}; > > payload_len = sizeof(pkt_hdr) + gbl_args->args.pkt_len; > > @@ -186,8 +185,9 @@ static odp_packet_t pktio_create_packet(void) > offset = 0; > odp_packet_l2_offset_set(pkt, offset); > eth = (odph_ethhdr_t *)buf; > - memcpy(eth->src.addr, mac, ODPH_ETHADDR_LEN); > - memcpy(eth->dst.addr, mac, ODPH_ETHADDR_LEN); > + odp_pktio_mac_addr(gbl_args->pktio_tx, eth->src.addr, ODPH_ETHADDR_LEN); > + odp_pktio_mac_addr(gbl_args->pktio_rx, eth->dst.addr, ODPH_ETHADDR_LEN); > + It would be better to retrieve the values once rather than for every packet, and assume that it's not going to change for the duration. The socket interface issues an ioctl for each call. -- Stuart.
On 06.08.15 13:08, Stuart Haslam wrote: > On Tue, Aug 04, 2015 at 03:05:21PM +0300, Ivan Khoronzhuk wrote: >> It's needed as pktio is not set in promisc mode. >> >> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> >> --- >> test/performance/odp_pktio_perf.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c >> index 08f13b6..fe4261e 100644 >> --- a/test/performance/odp_pktio_perf.c >> +++ b/test/performance/odp_pktio_perf.c >> @@ -169,7 +169,6 @@ static odp_packet_t pktio_create_packet(void) >> uint32_t offset; >> pkt_head_t pkt_hdr; >> size_t payload_len; >> - uint8_t mac[ODPH_ETHADDR_LEN] = {0}; >> >> payload_len = sizeof(pkt_hdr) + gbl_args->args.pkt_len; >> >> @@ -186,8 +185,9 @@ static odp_packet_t pktio_create_packet(void) >> offset = 0; >> odp_packet_l2_offset_set(pkt, offset); >> eth = (odph_ethhdr_t *)buf; >> - memcpy(eth->src.addr, mac, ODPH_ETHADDR_LEN); >> - memcpy(eth->dst.addr, mac, ODPH_ETHADDR_LEN); >> + odp_pktio_mac_addr(gbl_args->pktio_tx, eth->src.addr, ODPH_ETHADDR_LEN); >> + odp_pktio_mac_addr(gbl_args->pktio_rx, eth->dst.addr, ODPH_ETHADDR_LEN); >> + > > It would be better to retrieve the values once rather than for every > packet, and assume that it's not going to change for the duration. The > socket interface issues an ioctl for each call. I supposed that it's retrieved at pktio open. But, Ok I'll read mac addresses to gbl_args at init and here copy as it was. (initially I've done like this, but in my implementation there is no difference...so decided to change on direct calls, it's smaller change) > > -- > Stuart. >
diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 08f13b6..fe4261e 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -169,7 +169,6 @@ static odp_packet_t pktio_create_packet(void) uint32_t offset; pkt_head_t pkt_hdr; size_t payload_len; - uint8_t mac[ODPH_ETHADDR_LEN] = {0}; payload_len = sizeof(pkt_hdr) + gbl_args->args.pkt_len; @@ -186,8 +185,9 @@ static odp_packet_t pktio_create_packet(void) offset = 0; odp_packet_l2_offset_set(pkt, offset); eth = (odph_ethhdr_t *)buf; - memcpy(eth->src.addr, mac, ODPH_ETHADDR_LEN); - memcpy(eth->dst.addr, mac, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(gbl_args->pktio_tx, eth->src.addr, ODPH_ETHADDR_LEN); + odp_pktio_mac_addr(gbl_args->pktio_rx, eth->dst.addr, ODPH_ETHADDR_LEN); + eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); /* IP */
It's needed as pktio is not set in promisc mode. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> --- test/performance/odp_pktio_perf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)