All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: "Chen, Hongzhan" <hongzhan.chen@intel.com>,
	"xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded
Date: Thu, 5 Aug 2021 07:50:15 +0200	[thread overview]
Message-ID: <0709204c-66d0-e232-b4f4-19c7a332e4b4@siemens.com> (raw)
In-Reply-To: <BN9PR11MB5227CFF815BBC2B2AF0960C2F2F29@BN9PR11MB5227.namprd11.prod.outlook.com>

On 05.08.21 07:32, Chen, Hongzhan wrote:
> 
> 
>> -----Original Message-----
>> From: Jan Kiszka <jan.kiszka@siemens.com> 
>> Sent: Thursday, August 5, 2021 1:26 PM
>> To: Chen, Hongzhan <hongzhan.chen@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.kiszka@siemens.com> 
>>>> Sent: Thursday, August 5, 2021 1:01 PM
>>>> To: Chen, Hongzhan <hongzhan.chen@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.chen@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
kernel support). That would be the expected result. I'm afraid that the
new modprobe will fail with something != ENOSYS, thus will not give us
such a result. Please check.

Thanks,
Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


  reply	other threads:[~2021-08-05  5:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05  3:13 [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded Hongzhan Chen
2021-08-05  5:00 ` Jan Kiszka
2021-08-05  5:21   ` Chen, Hongzhan
2021-08-05  5:25     ` Jan Kiszka
2021-08-05  5:32       ` Chen, Hongzhan
2021-08-05  5:50         ` Jan Kiszka [this message]
2021-08-05  6:12           ` Chen, Hongzhan
2021-08-05  8:10             ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0709204c-66d0-e232-b4f4-19c7a332e4b4@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=hongzhan.chen@intel.com \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.