If it's not defined it's better to return -1. However the question is shouldn't a loop interface have its own definition for this function? I know link_status was added after the original restructure so perhaps this was just an omission?
On Tue, Mar 1, 2016 at 8:53 AM, Maxim Uvarov <[email protected]> wrote: > Bill, > > Idea if ops is not defined that some common value has to be used. > Instead of fixing loop it's needed to fix common code to return 1 if > link_status is not implemented. > > int odp_pktio_link_status(odp_pktio_t id) > { > pktio_entry_t *entry; > int ret = -1; <--- has to be 1 > ..... > if (entry->s.ops->link_status) > ret = entry->s.ops->link_status(entry); > unlock_entry(entry); > > return ret; > } > > Maxim. > > > > On 02/29/16 23:53, Bill Fischofer wrote: > >> ODP loopback interfaces should always be considered up, so add a >> handler for odp_pktio_link_status() for this device type that always >> returns 1 to indicate the link is up. >> >> Signed-off-by: Bill Fischofer <[email protected]> >> --- >> platform/linux-generic/pktio/loop.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/platform/linux-generic/pktio/loop.c >> b/platform/linux-generic/pktio/loop.c >> index dbb0e7b..0ea6d0e 100644 >> --- a/platform/linux-generic/pktio/loop.c >> +++ b/platform/linux-generic/pktio/loop.c >> @@ -134,6 +134,12 @@ static int loopback_mac_addr_get(pktio_entry_t >> *pktio_entry ODP_UNUSED, >> return ETH_ALEN; >> } >> +static int loopback_link_status(pktio_entry_t *pktio_entry ODP_UNUSED) >> +{ >> + /* loopback interfaces are always up */ >> + return 1; >> +} >> + >> static int loopback_promisc_mode_set(pktio_entry_t *pktio_entry, >> odp_bool_t enable) >> { >> @@ -176,6 +182,7 @@ const pktio_if_ops_t loopback_pktio_ops = { >> .promisc_mode_set = loopback_promisc_mode_set, >> .promisc_mode_get = loopback_promisc_mode_get, >> .mac_get = loopback_mac_addr_get, >> + .link_status = loopback_link_status, >> .capability = NULL, >> .input_queues_config = NULL, >> .output_queues_config = NULL, >> > > _______________________________________________ > lng-odp mailing list > [email protected] > https://lists.linaro.org/mailman/listinfo/lng-odp >
_______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
