Skip to contentSkip to conversation

testsuite/smokey: net: load rtnet module if it has not been loaded

PATCH In review Hongzhan Chen 2 participants 8 messages Aug 5, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 testsuite/smokey: net: load rtnet module if it has not been loaded

Before checking net config, rtnet should be ready.

testsuite/smokey/net_common/setup.c +4 -0
index 1badabdfb..a0512b00d 100644
@@ -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)
Signature · 1 line
2.17.1
#1 lore raw
Quoted 10 lines · Hongzhan Chen via Xenomai

Before checking net config, rtnet should be ready.

testsuite/smokey/net_common/setup.c +0 -0
index 1badabdfb..a0512b00d 100644

testsuite/smokey/net_common/setup.c int smokey_net_setup(const char *driver, const char *intf, int tested_config, · line 417

Quoted 10 lines
testsuite/smokey/net_common/setup.c +4 -0
@@ -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

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#2 lore raw
Quoted 21 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, August 5, 2021 1:01 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded

Quoted 12 lines · Hongzhan Chen via Xenomai

Before checking net config, rtnet should be ready.

testsuite/smokey/net_common/setup.c +0 -0
index 1badabdfb..a0512b00d 100644
@@ -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;
 
Quoted 11 lines

testsuite/smokey/net_common/setup.c int smokey_net_setup(const char *driver, const char *intf, int tested_config, · line 417

Quoted 8 lines
testsuite/smokey/net_common/setup.c +4 -0
+	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

Quoted 9 lines

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

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#3 lore raw
Quoted 33 lines · Hongzhan
Quoted 21 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, August 5, 2021 1:01 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded

Quoted 12 lines · Hongzhan Chen via Xenomai

Before checking net config, rtnet should be ready.

testsuite/smokey/net_common/setup.c +0 -0
index 1badabdfb..a0512b00d 100644
@@ -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;
 
Quoted 11 lines

testsuite/smokey/net_common/setup.c int smokey_net_setup(const char *driver, const char *intf, int tested_config, · line 417

Quoted 8 lines
testsuite/smokey/net_common/setup.c +4 -0
+	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

Quoted 5 lines

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

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#4 lore raw
Quoted 42 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, August 5, 2021 1:26 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded

Quoted 33 lines · Hongzhan
Quoted 32 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, August 5, 2021 1:01 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded

Quoted 10 lines · Hongzhan Chen via Xenomai

Before checking net config, rtnet should be ready.

testsuite/smokey/net_common/setup.c +0 -0
index 1badabdfb..a0512b00d 100644

testsuite/smokey/net_common/setup.c int smokey_net_setup(const char *driver, const char *intf, int tested_config, · line 417

Quoted 10 lines
testsuite/smokey/net_common/setup.c +4 -0
@@ -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

Quoted 7 lines
Quoted 5 lines

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));
Quoted 3 lines

and, thus, cannot be loaded.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#5 lore raw
Quoted 85 lines · Hongzhan
Quoted 42 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, August 5, 2021 1:26 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded

Quoted 33 lines · Hongzhan
Quoted 32 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, August 5, 2021 1:01 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded

Quoted 10 lines · Hongzhan Chen via Xenomai

Before checking net config, rtnet should be ready.

testsuite/smokey/net_common/setup.c +0 -0
index 1badabdfb..a0512b00d 100644

testsuite/smokey/net_common/setup.c int smokey_net_setup(const char *driver, const char *intf, int tested_config, · line 417

Quoted 10 lines
testsuite/smokey/net_common/setup.c +4 -0
@@ -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

Quoted 7 lines
Quoted 5 lines

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;
Quoted 13 lines
	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));
Quoted 3 lines

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

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#6 lore raw
Quoted 103 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, August 5, 2021 1:50 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded

Quoted 94 lines · Hongzhan
Quoted 42 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, August 5, 2021 1:26 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded

Quoted 33 lines · Hongzhan
Quoted 32 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, August 5, 2021 1:01 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded

Quoted 10 lines · Hongzhan Chen via Xenomai

Before checking net config, rtnet should be ready.

testsuite/smokey/net_common/setup.c +0 -0
index 1badabdfb..a0512b00d 100644                                                                                                            

testsuite/smokey/net_common/setup.c int smokey_net_setup(const char *driver, const char *intf, int tested_config, · line 417

Quoted 10 lines
testsuite/smokey/net_common/setup.c +4 -0
@@ -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

Quoted 7 lines
Quoted 5 lines

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));                                                                                      
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

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

Quoted 10 lines

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

Signature · 2 lines
Siemens AG, T RDA IOT                                                                                                                              
Corporate Competence Center Embedded Linux                                                                                                         
#7 lore raw
Quoted 109 lines · Hongzhan
Quoted 109 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, August 5, 2021 1:50 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded

Quoted 98 lines · Hongzhan
Quoted 42 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, August 5, 2021 1:26 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded

Quoted 33 lines · Hongzhan
Quoted 32 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, August 5, 2021 1:01 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH V2] testsuite/smokey: net: load rtnet module if it has not been loaded

Quoted 10 lines · Hongzhan Chen via Xenomai

Before checking net config, rtnet should be ready.

testsuite/smokey/net_common/setup.c +0 -0
index 1badabdfb..a0512b00d 100644                                                                                                            

testsuite/smokey/net_common/setup.c int smokey_net_setup(const char *driver, const char *intf, int tested_config, · line 417

Quoted 10 lines
testsuite/smokey/net_common/setup.c +4 -0
@@ -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

Quoted 7 lines
Quoted 5 lines

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));                                                                                      
Quoted 3 lines

and, thus, cannot be loaded.

Jan

Quoted 6 lines
Quoted 1 line

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

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux