All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded
@ 2021-08-05  3:13 Hongzhan Chen
  2021-08-05  5:00 ` Jan Kiszka
  0 siblings, 1 reply; 8+ messages in thread
From: Hongzhan Chen @ 2021-08-05  3:13 UTC (permalink / raw)
  To: xenomai

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)
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2021-08-05  5:00 UTC (permalink / raw)
  To: Hongzhan Chen, xenomai

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
whether it is configured and could be loaded. If we try to load when it
is not configured, the test case will fail rather than be skipped.
Please check and reorder the modprobe accordingly.

Jan

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded
  2021-08-05  5:00 ` Jan Kiszka
@ 2021-08-05  5:21   ` Chen, Hongzhan
  2021-08-05  5:25     ` Jan Kiszka
  0 siblings, 1 reply; 8+ messages in thread
From: Chen, Hongzhan @ 2021-08-05  5:21 UTC (permalink / raw)
  To: Jan Kiszka, xenomai



>-----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. 

Regards

Hongzhan Chen

>whether it is configured and could be loaded. If we try to load when it
>is not configured, the test case will fail rather than be skipped.
>Please check and reorder the modprobe accordingly.
>
>Jan
>
>-- 
>Siemens AG, T RDA IOT
>Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded
  2021-08-05  5:21   ` Chen, Hongzhan
@ 2021-08-05  5:25     ` Jan Kiszka
  2021-08-05  5:32       ` Chen, Hongzhan
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2021-08-05  5:25 UTC (permalink / raw)
  To: Chen, Hongzhan, xenomai

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
and, thus, cannot be loaded.

Jan

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded
  2021-08-05  5:25     ` Jan Kiszka
@ 2021-08-05  5:32       ` Chen, Hongzhan
  2021-08-05  5:50         ` Jan Kiszka
  0 siblings, 1 reply; 8+ messages in thread
From: Chen, Hongzhan @ 2021-08-05  5:32 UTC (permalink / raw)
  To: Jan Kiszka, xenomai



>-----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

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded
  2021-08-05  5:32       ` Chen, Hongzhan
@ 2021-08-05  5:50         ` Jan Kiszka
  2021-08-05  6:12           ` Chen, Hongzhan
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2021-08-05  5:50 UTC (permalink / raw)
  To: Chen, Hongzhan, xenomai

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded
  2021-08-05  5:50         ` Jan Kiszka
@ 2021-08-05  6:12           ` Chen, Hongzhan
  2021-08-05  8:10             ` Jan Kiszka
  0 siblings, 1 reply; 8+ messages in thread
From: Chen, Hongzhan @ 2021-08-05  6:12 UTC (permalink / raw)
  To: Jan Kiszka, xenomai

                                                                                                                                                   
                                                                                                                                                   
>-----Original Message-----                                                                                                                         
>From: Jan Kiszka <jan.kiszka@siemens.com>                                                                                                          
>Sent: Thursday, August 5, 2021 1:50 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: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

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?

Regards

Hongzhan Chen
                                                                           
>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                                                                                                         

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded
  2021-08-05  6:12           ` Chen, Hongzhan
@ 2021-08-05  8:10             ` Jan Kiszka
  0 siblings, 0 replies; 8+ messages in thread
From: Jan Kiszka @ 2021-08-05  8:10 UTC (permalink / raw)
  To: Chen, Hongzhan, xenomai

On 05.08.21 08:12, Chen, Hongzhan wrote:
>                                                                                                                                                    
>                                                                                                                                                    
>> -----Original Message-----                                                                                                                         
>> From: Jan Kiszka <jan.kiszka@siemens.com>                                                                                                          
>> Sent: Thursday, August 5, 2021 1:50 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: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
> 
> 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-08-05  8:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-08-05  6:12           ` Chen, Hongzhan
2021-08-05  8:10             ` Jan Kiszka

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.