Message ID | 1447695427-12391-1-git-send-email-zoltan.kiss@linaro.org |
---|---|
State | Accepted |
Commit | 6538ae64a15cc2c9467ca3c577c28ce2c655297b |
Headers | show |
Stuart, reviewed-by ok? Maxim. On 11/16/2015 20:37, Zoltan Kiss wrote: > For debug purposes, otherwise it's not trivial to figure out which pktio was > successful. > > Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> > -- > > v2: > - change the string for loopback and socket interfaces > - also add it to odp_pktio_print() > > v3: change back ODP_ERR to ODP_DBG > > diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h > index 1a1118c..a46c6fe 100644 > --- a/platform/linux-generic/include/odp_packet_io_internal.h > +++ b/platform/linux-generic/include/odp_packet_io_internal.h > @@ -100,6 +100,7 @@ typedef struct { > } pktio_table_t; > > typedef struct pktio_if_ops { > + const char *name; > int (*init)(void); > int (*term)(void); > int (*open)(odp_pktio_t pktio, pktio_entry_t *pktio_entry, > diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c > index 3ef400f..402e64d 100644 > --- a/platform/linux-generic/odp_packet_io.c > +++ b/platform/linux-generic/odp_packet_io.c > @@ -229,6 +229,8 @@ static odp_pktio_t setup_pktio_entry(const char *dev, odp_pool_t pool, > > if (!ret) { > pktio_entry->s.ops = pktio_if_ops[pktio_if]; > + ODP_DBG("%s uses %s\n", > + dev, pktio_if_ops[pktio_if]->name); > break; > } > } > @@ -845,6 +847,8 @@ void odp_pktio_print(odp_pktio_t id) > len += snprintf(&str[len], n - len, > " name %s\n", entry->s.name); > len += snprintf(&str[len], n - len, > + " type %s\n", entry->s.ops->name); > + len += snprintf(&str[len], n - len, > " state %s\n", > entry->s.state == STATE_START ? "start" : > (entry->s.state == STATE_STOP ? "stop" : "unknown")); > diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c > index ce19add..44da917 100644 > --- a/platform/linux-generic/pktio/loop.c > +++ b/platform/linux-generic/pktio/loop.c > @@ -108,6 +108,7 @@ static int loopback_promisc_mode_get(pktio_entry_t *pktio_entry) > } > > const pktio_if_ops_t loopback_pktio_ops = { > + .name = "loop", > .init = NULL, > .term = NULL, > .open = loopback_open, > diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c > index 794c82e..bc4ab1c 100644 > --- a/platform/linux-generic/pktio/netmap.c > +++ b/platform/linux-generic/pktio/netmap.c > @@ -307,6 +307,7 @@ static int netmap_promisc_mode_get(pktio_entry_t *pktio_entry) > } > > const pktio_if_ops_t netmap_pktio_ops = { > + .name = "netmap", > .init = NULL, > .term = NULL, > .open = netmap_open, > diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c > index 0817bf5..94b506d 100644 > --- a/platform/linux-generic/pktio/pcap.c > +++ b/platform/linux-generic/pktio/pcap.c > @@ -370,6 +370,7 @@ static int pcapif_promisc_mode_get(pktio_entry_t *pktio_entry) > } > > const pktio_if_ops_t pcap_pktio_ops = { > + .name = "pcap", > .open = pcapif_init, > .close = pcapif_close, > .recv = pcapif_recv_pkt, > diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c > index 5f5e0ae..56b0a8b 100644 > --- a/platform/linux-generic/pktio/socket.c > +++ b/platform/linux-generic/pktio/socket.c > @@ -468,6 +468,7 @@ static int sock_promisc_mode_get(pktio_entry_t *pktio_entry) > } > > const pktio_if_ops_t sock_mmsg_pktio_ops = { > + .name = "socket", > .init = NULL, > .term = NULL, > .open = sock_mmsg_open, > diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c > index 79ff82d..3a51179 100644 > --- a/platform/linux-generic/pktio/socket_mmap.c > +++ b/platform/linux-generic/pktio/socket_mmap.c > @@ -519,6 +519,7 @@ static int sock_mmap_promisc_mode_get(pktio_entry_t *pktio_entry) > } > > const pktio_if_ops_t sock_mmap_pktio_ops = { > + .name = "socket_mmap", > .init = NULL, > .term = NULL, > .open = sock_mmap_open,
On Mon, Nov 16, 2015 at 05:37:07PM +0000, Zoltan Kiss wrote: > For debug purposes, otherwise it's not trivial to figure out which pktio was > successful. > > Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> > -- > > v2: > - change the string for loopback and socket interfaces > - also add it to odp_pktio_print() > > v3: change back ODP_ERR to ODP_DBG > > diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h > index 1a1118c..a46c6fe 100644 > --- a/platform/linux-generic/include/odp_packet_io_internal.h > +++ b/platform/linux-generic/include/odp_packet_io_internal.h > @@ -100,6 +100,7 @@ typedef struct { > } pktio_table_t; > > typedef struct pktio_if_ops { > + const char *name; > int (*init)(void); > int (*term)(void); > int (*open)(odp_pktio_t pktio, pktio_entry_t *pktio_entry, > diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c > index 3ef400f..402e64d 100644 > --- a/platform/linux-generic/odp_packet_io.c > +++ b/platform/linux-generic/odp_packet_io.c > @@ -229,6 +229,8 @@ static odp_pktio_t setup_pktio_entry(const char *dev, odp_pool_t pool, > > if (!ret) { > pktio_entry->s.ops = pktio_if_ops[pktio_if]; > + ODP_DBG("%s uses %s\n", > + dev, pktio_if_ops[pktio_if]->name); > break; > } > } > @@ -845,6 +847,8 @@ void odp_pktio_print(odp_pktio_t id) > len += snprintf(&str[len], n - len, > " name %s\n", entry->s.name); > len += snprintf(&str[len], n - len, > + " type %s\n", entry->s.ops->name); > + len += snprintf(&str[len], n - len, > " state %s\n", > entry->s.state == STATE_START ? "start" : > (entry->s.state == STATE_STOP ? "stop" : "unknown")); > diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c > index ce19add..44da917 100644 > --- a/platform/linux-generic/pktio/loop.c > +++ b/platform/linux-generic/pktio/loop.c > @@ -108,6 +108,7 @@ static int loopback_promisc_mode_get(pktio_entry_t *pktio_entry) > } > > const pktio_if_ops_t loopback_pktio_ops = { > + .name = "loop", > .init = NULL, > .term = NULL, > .open = loopback_open, > diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c > index 794c82e..bc4ab1c 100644 > --- a/platform/linux-generic/pktio/netmap.c > +++ b/platform/linux-generic/pktio/netmap.c > @@ -307,6 +307,7 @@ static int netmap_promisc_mode_get(pktio_entry_t *pktio_entry) > } > > const pktio_if_ops_t netmap_pktio_ops = { > + .name = "netmap", > .init = NULL, > .term = NULL, > .open = netmap_open, > diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c > index 0817bf5..94b506d 100644 > --- a/platform/linux-generic/pktio/pcap.c > +++ b/platform/linux-generic/pktio/pcap.c > @@ -370,6 +370,7 @@ static int pcapif_promisc_mode_get(pktio_entry_t *pktio_entry) > } > > const pktio_if_ops_t pcap_pktio_ops = { > + .name = "pcap", > .open = pcapif_init, > .close = pcapif_close, > .recv = pcapif_recv_pkt, > diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c > index 5f5e0ae..56b0a8b 100644 > --- a/platform/linux-generic/pktio/socket.c > +++ b/platform/linux-generic/pktio/socket.c > @@ -468,6 +468,7 @@ static int sock_promisc_mode_get(pktio_entry_t *pktio_entry) > } > > const pktio_if_ops_t sock_mmsg_pktio_ops = { > + .name = "socket", > .init = NULL, > .term = NULL, > .open = sock_mmsg_open, > diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c > index 79ff82d..3a51179 100644 > --- a/platform/linux-generic/pktio/socket_mmap.c > +++ b/platform/linux-generic/pktio/socket_mmap.c > @@ -519,6 +519,7 @@ static int sock_mmap_promisc_mode_get(pktio_entry_t *pktio_entry) > } > > const pktio_if_ops_t sock_mmap_pktio_ops = { > + .name = "socket_mmap", > .init = NULL, > .term = NULL, > .open = sock_mmap_open,
Merged to api-next, Maxim. On 11/18/2015 14:04, Stuart Haslam wrote: > On Mon, Nov 16, 2015 at 05:37:07PM +0000, Zoltan Kiss wrote: >> For debug purposes, otherwise it's not trivial to figure out which pktio was >> successful. >> >> Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> > Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> > >> -- >> >> v2: >> - change the string for loopback and socket interfaces >> - also add it to odp_pktio_print() >> >> v3: change back ODP_ERR to ODP_DBG >> >> diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h >> index 1a1118c..a46c6fe 100644 >> --- a/platform/linux-generic/include/odp_packet_io_internal.h >> +++ b/platform/linux-generic/include/odp_packet_io_internal.h >> @@ -100,6 +100,7 @@ typedef struct { >> } pktio_table_t; >> >> typedef struct pktio_if_ops { >> + const char *name; >> int (*init)(void); >> int (*term)(void); >> int (*open)(odp_pktio_t pktio, pktio_entry_t *pktio_entry, >> diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c >> index 3ef400f..402e64d 100644 >> --- a/platform/linux-generic/odp_packet_io.c >> +++ b/platform/linux-generic/odp_packet_io.c >> @@ -229,6 +229,8 @@ static odp_pktio_t setup_pktio_entry(const char *dev, odp_pool_t pool, >> >> if (!ret) { >> pktio_entry->s.ops = pktio_if_ops[pktio_if]; >> + ODP_DBG("%s uses %s\n", >> + dev, pktio_if_ops[pktio_if]->name); >> break; >> } >> } >> @@ -845,6 +847,8 @@ void odp_pktio_print(odp_pktio_t id) >> len += snprintf(&str[len], n - len, >> " name %s\n", entry->s.name); >> len += snprintf(&str[len], n - len, >> + " type %s\n", entry->s.ops->name); >> + len += snprintf(&str[len], n - len, >> " state %s\n", >> entry->s.state == STATE_START ? "start" : >> (entry->s.state == STATE_STOP ? "stop" : "unknown")); >> diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c >> index ce19add..44da917 100644 >> --- a/platform/linux-generic/pktio/loop.c >> +++ b/platform/linux-generic/pktio/loop.c >> @@ -108,6 +108,7 @@ static int loopback_promisc_mode_get(pktio_entry_t *pktio_entry) >> } >> >> const pktio_if_ops_t loopback_pktio_ops = { >> + .name = "loop", >> .init = NULL, >> .term = NULL, >> .open = loopback_open, >> diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c >> index 794c82e..bc4ab1c 100644 >> --- a/platform/linux-generic/pktio/netmap.c >> +++ b/platform/linux-generic/pktio/netmap.c >> @@ -307,6 +307,7 @@ static int netmap_promisc_mode_get(pktio_entry_t *pktio_entry) >> } >> >> const pktio_if_ops_t netmap_pktio_ops = { >> + .name = "netmap", >> .init = NULL, >> .term = NULL, >> .open = netmap_open, >> diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c >> index 0817bf5..94b506d 100644 >> --- a/platform/linux-generic/pktio/pcap.c >> +++ b/platform/linux-generic/pktio/pcap.c >> @@ -370,6 +370,7 @@ static int pcapif_promisc_mode_get(pktio_entry_t *pktio_entry) >> } >> >> const pktio_if_ops_t pcap_pktio_ops = { >> + .name = "pcap", >> .open = pcapif_init, >> .close = pcapif_close, >> .recv = pcapif_recv_pkt, >> diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c >> index 5f5e0ae..56b0a8b 100644 >> --- a/platform/linux-generic/pktio/socket.c >> +++ b/platform/linux-generic/pktio/socket.c >> @@ -468,6 +468,7 @@ static int sock_promisc_mode_get(pktio_entry_t *pktio_entry) >> } >> >> const pktio_if_ops_t sock_mmsg_pktio_ops = { >> + .name = "socket", >> .init = NULL, >> .term = NULL, >> .open = sock_mmsg_open, >> diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c >> index 79ff82d..3a51179 100644 >> --- a/platform/linux-generic/pktio/socket_mmap.c >> +++ b/platform/linux-generic/pktio/socket_mmap.c >> @@ -519,6 +519,7 @@ static int sock_mmap_promisc_mode_get(pktio_entry_t *pktio_entry) >> } >> >> const pktio_if_ops_t sock_mmap_pktio_ops = { >> + .name = "socket_mmap", >> .init = NULL, >> .term = NULL, >> .open = sock_mmap_open,
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 1a1118c..a46c6fe 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -100,6 +100,7 @@ typedef struct { } pktio_table_t; typedef struct pktio_if_ops { + const char *name; int (*init)(void); int (*term)(void); int (*open)(odp_pktio_t pktio, pktio_entry_t *pktio_entry, diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 3ef400f..402e64d 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -229,6 +229,8 @@ static odp_pktio_t setup_pktio_entry(const char *dev, odp_pool_t pool, if (!ret) { pktio_entry->s.ops = pktio_if_ops[pktio_if]; + ODP_DBG("%s uses %s\n", + dev, pktio_if_ops[pktio_if]->name); break; } } @@ -845,6 +847,8 @@ void odp_pktio_print(odp_pktio_t id) len += snprintf(&str[len], n - len, " name %s\n", entry->s.name); len += snprintf(&str[len], n - len, + " type %s\n", entry->s.ops->name); + len += snprintf(&str[len], n - len, " state %s\n", entry->s.state == STATE_START ? "start" : (entry->s.state == STATE_STOP ? "stop" : "unknown")); diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index ce19add..44da917 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -108,6 +108,7 @@ static int loopback_promisc_mode_get(pktio_entry_t *pktio_entry) } const pktio_if_ops_t loopback_pktio_ops = { + .name = "loop", .init = NULL, .term = NULL, .open = loopback_open, diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c index 794c82e..bc4ab1c 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -307,6 +307,7 @@ static int netmap_promisc_mode_get(pktio_entry_t *pktio_entry) } const pktio_if_ops_t netmap_pktio_ops = { + .name = "netmap", .init = NULL, .term = NULL, .open = netmap_open, diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c index 0817bf5..94b506d 100644 --- a/platform/linux-generic/pktio/pcap.c +++ b/platform/linux-generic/pktio/pcap.c @@ -370,6 +370,7 @@ static int pcapif_promisc_mode_get(pktio_entry_t *pktio_entry) } const pktio_if_ops_t pcap_pktio_ops = { + .name = "pcap", .open = pcapif_init, .close = pcapif_close, .recv = pcapif_recv_pkt, diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index 5f5e0ae..56b0a8b 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -468,6 +468,7 @@ static int sock_promisc_mode_get(pktio_entry_t *pktio_entry) } const pktio_if_ops_t sock_mmsg_pktio_ops = { + .name = "socket", .init = NULL, .term = NULL, .open = sock_mmsg_open, diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 79ff82d..3a51179 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -519,6 +519,7 @@ static int sock_mmap_promisc_mode_get(pktio_entry_t *pktio_entry) } const pktio_if_ops_t sock_mmap_pktio_ops = { + .name = "socket_mmap", .init = NULL, .term = NULL, .open = sock_mmap_open,
For debug purposes, otherwise it's not trivial to figure out which pktio was successful. Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> -- v2: - change the string for loopback and socket interfaces - also add it to odp_pktio_print() v3: change back ODP_ERR to ODP_DBG