On 12/15/2014 02:04 PM, Mariusz Janiak wrote:
Certainly a well behaved driver would not touch a device already handled
by a linux driver.  It should be possible to just issue an unbind request
to the linux driver for the desired device and then a bind request to
the rtnet driver to take over that device.

Thanks for sharing this information.  It sounds like that might work.

The problem with the
bind/unbind solution is that the driver that will get all the cards
first depends on the drivers initialization order. With the "cards"
parameter, you do not have this issue.

Maybe one could create a script that would attempt to unbind both the rt and non-rt 
drivers (or check to see which one is bound and then unbind it), and then make the 
desired "bind" calls.  It would be better if the incorrect binding were not 
made in the first place, however.  I think the ideal solution would be to have a file 
that contains device/driver pairs that would keep the kernel from passing the specified 
devices to any other drivers.  I wonder how hard that would be to implement.

The RTnet configuration file rtnet.conf has already instrumentation for 
binding/unbinding devices. The REBIND_RT_NICS variable has to be set up with 
the correct NIC PCI addresses. If you have more then one NIC, you can identity 
PCI address of respective eth's using ethtool

ethtool -i eth0
ethtool -i eth1

etc.

The bus-info field contains device pci addres that you can directly insert to 
REBIND_RT_NICS. If you don't know which eth menage with physical interface, you 
can blink LED port of the NIC using, eg.

ethtool -p eth0

(I am cross-posting this message to rtnet-users from the xenomai mailing list, 
since this is even more relevant there.  I apologize to those who receive 
duplicate e-mails.)

Thank you again, Mariusz.  All of this information is helpful.  I was following the 
instructions to start the RTnet core manually (as documented in the README file), since I 
am not using RTmac in my application.  I saw some references to REBIND_RT_NICS, but I 
didn't look into it very closely, since rtnet.conf and the "rtnet" script 
appeared to associated with RTmac.

After looking at the "rtnet" script, I see that it does indeed use bind/unbind in exactly the way we were 
discussing.  The script works very works well to switch an interface between standard and real-time networking, but 
unfortunately it does not support running without the RTmac layer.  I made some minor modifications to the script to 
add this support.  With my modifications, if TDMA_MODE = "none" (instead of "master" or 
"slave"), the script skips all of the rtmac/rtcfg/tmda initialization.  I have attached patches for both the 
rtnet and xenomai-3.git/next repositories.  I hope that they will be accepted, since I believe others have asked for 
this functionality in the past.

Gilles, it appears that the "cards" parameter may not be needed anymore, unless 
there are some other situations in which bind/unbind won't work.  I can see how that 
would make maintaining the RT drivers simpler.

-Jeff

diff --git a/tools/rtnet.in b/tools/rtnet.in
index b04e410..c53ad81 100755
--- a/tools/rtnet.in
+++ b/tools/rtnet.in
@@ -66,9 +66,11 @@ init_rtnet() {
         fi
     fi
 
-    insmod $RTNET_MOD/rtcfg$MODULE_EXT >/dev/null
-    insmod $RTNET_MOD/rtmac$MODULE_EXT >/dev/null
-    insmod $RTNET_MOD/tdma$MODULE_EXT >/dev/null
+    if [ ! $TDMA_MODE = "none" ]; then
+        insmod $RTNET_MOD/rtcfg$MODULE_EXT >/dev/null
+        insmod $RTNET_MOD/rtmac$MODULE_EXT >/dev/null
+        insmod $RTNET_MOD/tdma$MODULE_EXT >/dev/null
+    fi
 }
 
 submit_cfg() {
@@ -281,7 +283,9 @@ case "$1" in
     start)
         init_rtnet
 
-        if [ $TDMA_MODE = "master" ]; then
+        if [ $TDMA_MODE = "none" ]; then
+            $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+        elif [ $TDMA_MODE = "master" ]; then
             start_master
         else
             $TDMACFG rteth0 slave
diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
index f81a7bb..92945cd 100755
--- a/utils/net/rtnet.in
+++ b/utils/net/rtnet.in
@@ -66,9 +66,11 @@ init_rtnet() {
 	fi
     fi
 
+    if [ ! $TDMA_MODE = "none" ]; then
     modprobe rtcfg >/dev/null
     modprobe rtmac >/dev/null
     modprobe tdma >/dev/null
+    fi
 }
 
 submit_cfg() {
@@ -281,7 +283,9 @@ case "$1" in
     start)
 	init_rtnet
 
-	if [ $TDMA_MODE = "master" ]; then
+	if [ $TDMA_MODE = "none" ]; then
+	    $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+	elif [ $TDMA_MODE = "master" ]; then
 	    start_master
 	else
 	    $TDMACFG rteth0 slave
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
RTnet-users mailing list
RTnet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rtnet-users

Reply via email to