On 05.08.21 08:12, Chen, Hongzhan wrote: > > > > >> -----Original Message----- >> >> From: Jan Kiszka <jan.kis...@siemens.com> >> >> Sent: Thursday, August 5, 2021 1:50 PM >> >> To: Chen, Hongzhan <hongzhan.c...@intel.com>; xenomai@xenomai.org >> >> Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has >> not been loaded >> >> >> On 05.08.21 07:32, Chen, Hongzhan wrote: >> >>> >>> >>> >>> >>>> -----Original Message----- >>>> >>>> From: Jan Kiszka <jan.kis...@siemens.com> >>>> >>>> Sent: Thursday, August 5, 2021 1:26 PM >>>> >>>> To: Chen, Hongzhan <hongzhan.c...@intel.com>; xenomai@xenomai.org >>>> >>>> Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has >>>> not been loaded >>>> >>>> >>>> On 05.08.21 07:21, Chen, Hongzhan wrote: >>>> >>>>> >>>>> >>>>> >>>>> >>>>>> -----Original Message----- >>>>>> >>>>>> From: Jan Kiszka <jan.kis...@siemens.com> >>>>>> >>>>>> Sent: Thursday, August 5, 2021 1:01 PM >>>>>> >>>>>> To: Chen, Hongzhan <hongzhan.c...@intel.com>; xenomai@xenomai.org >>>>>> >>>>>> Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it >>>>>> has not been loaded >>>>>> >>>>>> >>>>>> On 05.08.21 05:13, Hongzhan Chen via Xenomai wrote: >>>>>> >>>>>>> Before checking net config, rtnet should be ready. >>>>>>> >>>>>>> >>>>>>> >>>>>>> Signed-off-by: Hongzhan Chen <hongzhan.c...@intel.com> >>>>>>> >>>>>>> >>>>>>> >>>>>>> diff --git a/testsuite/smokey/net_common/setup.c >>>>>>> b/testsuite/smokey/net_common/setup.c >>>>>>> >>>>>>> index 1badabdfb..a0512b00d 100644 >>>>>>> >>>>>>> --- a/testsuite/smokey/net_common/setup.c >>>>>>> >>>>>>> +++ b/testsuite/smokey/net_common/setup.c >>>>>>> >>>>>>> @@ -408,6 +408,10 @@ int smokey_net_setup(const char *driver, const >>>>>>> char *intf, int tested_config, >>>>>>> >>>>>>> struct sockaddr_in *in_peer = vpeer; >>>>>>> >>>>>>> >>>>>>> struct sockaddr *peer = vpeer; >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> + err = smokey_net_modprobe(MODID_RTNET); >>>>>>> >>>>>>> >>>>>>> + if (err < 0) >>>>>>> >>>>>>> >>>>>>> + return err; >>>>>>> >>>>>>> >>>>>>> + >>>>>>> >>>>>>> err = cobalt_corectl(_CC_COBALT_GET_NET_CONFIG, >>>>>>> >>>>>>> >>>>>>> &net_config, sizeof(net_config)); >>>>>>> >>>>>>> >>>>>>> if (err == -EINVAL) >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> Sorry, only realized now: The checks that come right after this should >>>>>> >>>>>> not be affected by rtnet being loaded or not yet. I think they check >>>>>> >>>>> >>>>> >>>>> No. Actually, it would be affected. If rtnet is not loaded and inited >>>>> before cobalt_corectl is called, it would >>>>> not call rtnet_corectl_register to cobalt_add_config_chain and >>>>> config_notifier_list would >>>>> >>>>> be empty. And then cobalt_corectl ->do_conf_option would return -EINVAL >>>>> because blocking_notifier_call_chain return NOTIFY_DONE. >>>>> In smokey_net_setup, it would return -ENOSYS because cobalt_corectl >>>>> return -EINVAL. >>>>> >>>>> >>>> >>>> >>>> OK, catch22. But we must not fail the test if RTnet is not configured >>>> >>> >>> >>> I do not know what RTnet config you are talking about. Actually >>> cobalt_corectl(_CC_COBALT_GET_NET_CONFIG is just checking xenomai kernel >>> config. >>> >>> >>> static int rtnet_corectl_call(struct notifier_block *self, unsigned long >>> arg, >>> void *cookie) >>> >>> >>> >>> >>> >>> { >>> >>> struct cobalt_config_vector *vec = cookie; >>> >>> int ret = 0; >>> >>> >>> >>> if (arg != _CC_COBALT_GET_NET_CONFIG) >>> >>> return NOTIFY_DONE; >>> >>> >>> >>> >>> if (vec->u_bufsz < sizeof(ret)) >>> >>> return notifier_from_errno(-EINVAL); >>> >>> >>> >>> >>> if (IS_ENABLED(CONFIG_XENO_DRIVERS_NET)) >>> >>> ret |= _CC_COBALT_NET; >>> >>> >>> if (IS_ENABLED(CONFIG_XENO_DRIVERS_NET_ETH_P_ALL)) >>> >>> ret |= _CC_COBALT_NET_ETH_P_ALL; >>> >>> >>> if (IS_ENABLED(CONFIG_XENO_DRIVERS_NET_RTIPV4)) >>> >>> ret |= _CC_COBALT_NET_IPV4; >>> >>> >>> if (IS_ENABLED(CONFIG_XENO_DRIVERS_NET_RTIPV4_ICMP)) >>> >>> ret |= _CC_COBALT_NET_ICMP; >>> >>> >>> if (IS_ENABLED(CONFIG_XENO_DRIVERS_NET_RTIPV4_NETROUTING)) >>> >>> ret |= _CC_COBALT_NET_NETROUTING; >>> >>> >>> if (IS_ENABLED(CONFIG_XENO_DRIVERS_NET_RTIPV4_ROUTE)) >>> >>> ret |= _CC_COBALT_NET_ROUTER; >>> >>> >>> if (IS_ENABLED(CONFIG_XENO_DRIVERS_NET_RTIPV4_UDP)) >>> >>> ret |= _CC_COBALT_NET_UDP; >>> >>> >>> if (IS_ENABLED(CONFIG_XENO_DRIVERS_NET_RTPACKET)) >>> >>> ret |= _CC_COBALT_NET_AF_PACKET; >>> >>> >>> if (IS_ENABLED(CONFIG_XENO_DRIVERS_NET_TDMA)) >>> >>> ret |= _CC_COBALT_NET_TDMA; >>> >>> >>> if (IS_ENABLED(CONFIG_XENO_DRIVERS_NET_NOMAC)) >>> >>> ret |= _CC_COBALT_NET_NOMAC; >>> >>> >>> if (IS_ENABLED(CONFIG_XENO_DRIVERS_NET_RTCFG)) >>> >>> ret |= _CC_COBALT_NET_CFG; >>> >>> >>> if (IS_ENABLED(CONFIG_XENO_DRIVERS_NET_ADDON_RTCAP)) >>> >>> ret |= _CC_COBALT_NET_CAP; >>> >>> >>> if (IS_ENABLED(CONFIG_XENO_DRIVERS_NET_ADDON_PROXY)) >>> >>> ret |= _CC_COBALT_NET_PROXY; >>> >>> >>> >>> >>> ret = cobalt_copy_to_user(vec->u_buf, &ret, sizeof(ret)); >>> >>> >>> >>>> and, thus, cannot be loaded. >>>> >>>> >>>> >>>> Jan >>>> >>> >>> >> >> >> >> >> CONFIG_XENO_DRIVERS_NET=n, smokey --run=<rtnet-test> => skipped (no > > In this case, we may check if rtnet.ko already exist in fs with calling > modinfo. > If it really exist , that means that rtnet already is enabled and then we call > smokey_net_modprobe to load rtnet module and setup go on. If it does not > exist, we can return > - ENOSYS directly. How do you think?
Just translate any "rtnet.ko not found" error into ENOSYS, I would say. Jan -- Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux