Skip to contentSkip to conversation

Allow RTNet to be builtin kernel

PATCH In review François Legal 3 participants 6 messages Oct 3, 2019 – Oct 9, 2019 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow RTNet to be builtin kernel

Subject: [PATCH] Allow RTNet to be builtin kernel

Makefile is changed because when builtin, the modules get loaded in the link order. In the previous version protocols would get loaded before stackmgr which obviously fails.

---

This has been tested on Zynq 7000 Hardware (microzed board) with MACB/GEM RTNet driver, with linux 4.4.189 vanilla. Kernel boots up correctly, and the following messages get printed on the console during the boot :

[   13.875451] sdhci-pltfm: SDHCI platform and OF driver helper
[   13.881627] sdhci-arasan e0100000.sdhci: No vmmc regulator found
[   13.887581] sdhci-arasan e0100000.sdhci: No vqmmc regulator found
[   13.927585] mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using ADMA
[   13.945085] fpga_manager fpga0: Xilinx Zynq FPGA Manager registered
[   13.951896]
[   13.951896] *** RTnet for Xenomai v3.0.9 ***
[   13.951896]
[   13.959156] RTnet: initialising real-time networking
[   13.964928] RTmac/TDMA: init time division multiple access control mechanism
[   13.972074] RTmac: init realtime media access control
[   13.977064] RTcfg: init real-time configuration distribution protocol
[   13.983752] initializing loopback...
[   13.987295] RTnet: registered rtlo
[   13.993238] RTnet: registered rteth0
[   13.996832] libphy: MACB_mii_bus: probed
[   14.001140] rt_macb: rteth0: Cadence GEM at 0xe000b000 irq 26 (00:0a:35:00:01:22)
[   14.008630] rt_macb: rteth0: attached PHY driver [Marvell 88E1510] (mii_bus:phy_addr=e000b000.ethernet-ffffffff:00, irq=-1)
[   14.019845] RTcap: real-time capturing interface
[   14.026562] RTproxy attached to rteth0
[   14.031129] rtnetproxy installed as "rtproxy"
[   14.035693] NET: Registered protocol family 26
[   14.040309] NET: Registered protocol family 17
[   14.044686] can: controller area network core (rev 20120528 abi 9)
[   14.050957] NET: Registered protocol family 29
[   14.055329] can: raw protocol (rev 20120528)
[   14.059683] can: broadcast manager protocol (rev 20120528 t)
 kernel/drivers/net/Kconfig        |  1 -
 kernel/drivers/net/addons/Kconfig |  4 ++--
 kernel/drivers/net/stack/Makefile | 16 ++++++++--------
 utils/net/rtnet.in | 144 +++++++++++++++++++++++++++++++++++------------------
 4 files changed, 105 insertions(+), 60 deletions(-)
kernel/drivers/net/Kconfig +0 -1
index ac3bced..49d2402 100644
@@ -1,7 +1,6 @@
 menu "RTnet"
 
 config XENO_DRIVERS_NET
-    depends on m
     select NET
     tristate "RTnet, TCP/IP socket interface"
 
kernel/drivers/net/addons/Kconfig +2 -2
index baa6cbc..616ed40 100644
@@ -2,7 +2,7 @@ menu "Add-Ons"
     depends on XENO_DRIVERS_NET
 
 config XENO_DRIVERS_NET_ADDON_RTCAP
-    depends on XENO_DRIVERS_NET && m
+    depends on XENO_DRIVERS_NET
     select ETHERNET
     tristate "Real-Time Capturing Support"
     default n
@@ -18,7 +18,7 @@ config XENO_DRIVERS_NET_ADDON_RTCAP
     For further information see Documentation/README.rtcap.
 
 config XENO_DRIVERS_NET_ADDON_PROXY
-    depends on XENO_DRIVERS_NET_RTIPV4 && m
+    depends on XENO_DRIVERS_NET_RTIPV4
     select ETHERNET
     tristate "IP protocol proxy for Linux"
     default n
kernel/drivers/net/stack/Makefile +8 -8
index d055dc2..f8db6fa 100644
@@ -1,13 +1,5 @@
 ccflags-y += -Idrivers/xenomai/net/stack/include -Ikernel/
 
-obj-$(CONFIG_XENO_DRIVERS_NET_RTIPV4) += ipv4/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTPACKET) += packet/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTMAC) += rtmac/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTCFG) += rtcfg/
-
 obj-$(CONFIG_XENO_DRIVERS_NET) += rtnet.o
 
 rtnet-y :=  \
@@ -23,4 +15,12 @@ rtnet-y :=  \
 	stack_mgr.o \
 	eth.o
 
+obj-$(CONFIG_XENO_DRIVERS_NET_RTIPV4) += ipv4/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTPACKET) += packet/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTMAC) += rtmac/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTCFG) += rtcfg/
+
 rtnet-$(CONFIG_XENO_DRIVERS_NET_RTWLAN) += rtwlan.o
utils/net/rtnet.in +95 -49

173 lines not on this page · raw message

--
2.1.4

#1 lore raw
Quoted 285 lines · François Legal via Xenomai

Subject: [PATCH] Allow RTNet to be builtin kernel

Makefile is changed because when builtin, the modules get loaded in the link order. In the previous version protocols would get loaded before stackmgr which obviously fails.

---

This has been tested on Zynq 7000 Hardware (microzed board) with MACB/GEM RTNet driver, with linux 4.4.189 vanilla. Kernel boots up correctly, and the following messages get printed on the console during the boot :

[   13.875451] sdhci-pltfm: SDHCI platform and OF driver helper
[   13.881627] sdhci-arasan e0100000.sdhci: No vmmc regulator found
[   13.887581] sdhci-arasan e0100000.sdhci: No vqmmc regulator found
[   13.927585] mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using ADMA
[   13.945085] fpga_manager fpga0: Xilinx Zynq FPGA Manager registered
[   13.951896]
[   13.951896] *** RTnet for Xenomai v3.0.9 ***
[   13.951896]
[   13.959156] RTnet: initialising real-time networking
[   13.964928] RTmac/TDMA: init time division multiple access control mechanism
[   13.972074] RTmac: init realtime media access control
[   13.977064] RTcfg: init real-time configuration distribution protocol
[   13.983752] initializing loopback...
[   13.987295] RTnet: registered rtlo
[   13.993238] RTnet: registered rteth0
[   13.996832] libphy: MACB_mii_bus: probed
[   14.001140] rt_macb: rteth0: Cadence GEM at 0xe000b000 irq 26 (00:0a:35:00:01:22)
[   14.008630] rt_macb: rteth0: attached PHY driver [Marvell 88E1510] (mii_bus:phy_addr=e000b000.ethernet-ffffffff:00, irq=-1)
[   14.019845] RTcap: real-time capturing interface
[   14.026562] RTproxy attached to rteth0
[   14.031129] rtnetproxy installed as "rtproxy"
[   14.035693] NET: Registered protocol family 26
[   14.040309] NET: Registered protocol family 17
[   14.044686] can: controller area network core (rev 20120528 abi 9)
[   14.050957] NET: Registered protocol family 29
[   14.055329] can: raw protocol (rev 20120528)
[   14.059683] can: broadcast manager protocol (rev 20120528 t)
  kernel/drivers/net/Kconfig        |  1 -
  kernel/drivers/net/addons/Kconfig |  4 ++--
  kernel/drivers/net/stack/Makefile | 16 ++++++++--------
  utils/net/rtnet.in | 144 +++++++++++++++++++++++++++++++++++------------------
  4 files changed, 105 insertions(+), 60 deletions(-)
kernel/drivers/net/Kconfig +0 -1
index ac3bced..49d2402 100644
@@ -1,7 +1,6 @@
  menu "RTnet"
 
  config XENO_DRIVERS_NET
-    depends on m
      select NET
      tristate "RTnet, TCP/IP socket interface"
 
kernel/drivers/net/addons/Kconfig +2 -2
index baa6cbc..616ed40 100644
@@ -2,7 +2,7 @@ menu "Add-Ons"
      depends on XENO_DRIVERS_NET
 
  config XENO_DRIVERS_NET_ADDON_RTCAP
-    depends on XENO_DRIVERS_NET && m
+    depends on XENO_DRIVERS_NET
      select ETHERNET
      tristate "Real-Time Capturing Support"
      default n
@@ -18,7 +18,7 @@ config XENO_DRIVERS_NET_ADDON_RTCAP
      For further information see Documentation/README.rtcap.
 
  config XENO_DRIVERS_NET_ADDON_PROXY
-    depends on XENO_DRIVERS_NET_RTIPV4 && m
+    depends on XENO_DRIVERS_NET_RTIPV4
      select ETHERNET
      tristate "IP protocol proxy for Linux"
      default n
kernel/drivers/net/stack/Makefile +8 -8
index d055dc2..f8db6fa 100644
@@ -1,13 +1,5 @@
  ccflags-y += -Idrivers/xenomai/net/stack/include -Ikernel/
 
-obj-$(CONFIG_XENO_DRIVERS_NET_RTIPV4) += ipv4/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTPACKET) += packet/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTMAC) += rtmac/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTCFG) += rtcfg/
-
  obj-$(CONFIG_XENO_DRIVERS_NET) += rtnet.o
 
  rtnet-y :=  \
@@ -23,4 +15,12 @@ rtnet-y :=  \
  	stack_mgr.o \
  	eth.o
 
+obj-$(CONFIG_XENO_DRIVERS_NET_RTIPV4) += ipv4/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTPACKET) += packet/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTMAC) += rtmac/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTCFG) += rtcfg/
+
  rtnet-$(CONFIG_XENO_DRIVERS_NET_RTWLAN) += rtwlan.o
utils/net/rtnet.in +88 -49
index f81a7bb..fa12a03 100644
@@ -31,44 +31,68 @@ EOF
  }
 
  init_rtnet() {
-    modprobe rtnet >/dev/null || exit 1
-    modprobe rtipv4 >/dev/null || exit 1
-    modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
-
-    for dev in $REBIND_RT_NICS; do
-	if [ -d /sys/bus/pci/devices/$dev/driver ]; then
-	    echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
-	fi
-	echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
-    done
+    if [ ! -d /proc/rtnet ]; then
+        modprobe rtnet >/dev/null || exit 1
+    fi
 
+    if [ ! -d /proc/rtnet/ipv4 ]; then
+        modprobe rtipv4 >/dev/null || exit 1
+    fi
      for PROTOCOL in $RT_PROTOCOLS; do
-	modprobe rt$PROTOCOL >/dev/null || exit 1
+        if [ ! -d /sys/modules/rt$PROTOCOL ]; then
+            if [ "$PROTOCOL" = "packet" ]; then
+                modprobe rt$PROTOCOL >/dev/null
+            else
+                modprobe rt$PROTOCOL >/dev/null || exit 1
+            fi
+        fi
      done
 
+    $(cat /proc/rtnet/devices | grep -q rteth0)
+    if [ $? -eq 1 ]; then
+        modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+
+        for dev in $REBIND_RT_NICS; do
+            if [ -d /sys/bus/pci/devices/$dev/driver ]; then
+                echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
+            fi
+            echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
+        done
+    fi
+
      if [ $RT_LOOPBACK = "yes" ]; then
-	modprobe rt_loopback >/dev/null || exit 1
+        $(cat /proc/rtnet/devices | grep -q rtlo)
+        if [ $? -eq 1 ]; then
+
+            modprobe rt_loopback >/dev/null || exit 1
+        fi
      fi
 
-    if [ $RTCAP = "yes" ]; then
-	modprobe rtcap >/dev/null || exit 1
+    if [ $RTCAP = "yes" -a ! -d /sys/modules/rtcap ]; then
+        modprobe rtcap >/dev/null || exit 1
      fi
 
      if [ $RT_LOOPBACK = "yes" ]; then
-	$RTIFCONFIG rtlo up 127.0.0.1
+        $RTIFCONFIG rtlo up 127.0.0.1
      fi
 
      if [ $RTCAP = "yes" ]; then
-	ifconfig rteth0 up
-	ifconfig rteth0-mac up
-	if [ $RT_LOOPBACK = "yes" ]; then
-	    ifconfig rtlo up
-	fi
+        ifconfig rteth0 up
+        ifconfig rteth0-mac up
+        if [ $RT_LOOPBACK = "yes" ]; then
+            ifconfig rtlo up
+        fi
      fi
 
-    modprobe rtcfg >/dev/null
-    modprobe rtmac >/dev/null
-    modprobe tdma >/dev/null
+    if [ ! -d /proc/rtnet/rtcfg ]; then
+        modprobe rtcfg >/dev/null
+    fi
+    if [ ! -d /proc/rtnet/rtmac ]; then
+        modprobe rtmac >/dev/null
+    fi
+    if [ ! -f /proc/tdma ]; then
+        modprobe tdma >/dev/null
+    fi
  }
 
  submit_cfg() {
@@ -336,34 +360,56 @@ case "$1" in
  	;;
 
      capture)
-	modprobe rtnet >/dev/null || exit 1
-	modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
-	modprobe rtcap >/dev/null || exit 1
-	$RTIFCONFIG rteth0 up promisc
-	ifconfig rteth0 up
-	ifconfig rteth0-mac up
-	;;
+        if [ ! -d /proc/rtnet ]; then
+            modprobe rtnet >/dev/null || exit 1
+        fi
+        $(cat /proc/rtnet/devices | grep -q rteth0)
+        if [ $? -eq 1 ]; then
+            modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+        fi
+        if [ ! -d /sys/modules/rtcap ]; then
+            modprobe rtcap >/dev/null || exit 1
+        fi
+        $RTIFCONFIG rteth0 up promisc
+        ifconfig rteth0 up
+        ifconfig rteth0-mac up
+        ;;
 
      loopback)
-	modprobe rtnet >/dev/null || exit 1
-	modprobe rtipv4 >/dev/null || exit 1
-
-	for PROTOCOL in $RT_PROTOCOLS; do
-	    modprobe rt$PROTOCOL >/dev/null || exit 1
-	done
-
-	modprobe rt_loopback >/dev/null || exit 1
-
-	if [ $RTCAP = "yes" ]; then
-	    modprobe rtcap >/dev/null || exit 1
-	fi
-
-	$RTIFCONFIG rtlo up 127.0.0.1
-
-	if [ $RTCAP = "yes" ]; then
-	    ifconfig rtlo up
-	fi
-	;;
+        if [ ! -d /proc/rtnet ]; then
+            modprobe rtnet >/dev/null || exit 1
+        fi
+        if [ ! -d /proc/rtnet/ipv4 ]; then
+            modprobe rtipv4 >/dev/null || exit 1
+        fi
+        for PROTOCOL in $RT_PROTOCOLS; do
+            if [ ! -d /sys/modules/rt$PROTOCOL ]; then
+                if [ "$PROTOCOL" = "packet" ]; then
+                    modprobe rt$PROTOCOL >/dev/null
+                else
+                    modprobe rt$PROTOCOL >/dev/null || exit 1
+                fi
+            fi
+        done
+
+        if [ $RT_LOOPBACK = "yes" ]; then
+            $(cat /proc/rtnet/devices | grep -q rtlo)
+            if [ $? -eq 1 ]; then
+
+                modprobe rt_loopback >/dev/null || exit 1
+            fi
+        fi
+
+        if [ $RTCAP = "yes" -a ! -d /sys/modules/rtcap ]; then
+            modprobe rtcap >/dev/null || exit 1
+        fi

utils/net/rtnet.in case "$1" in · line 415

Quoted 10 lines
utils/net/rtnet.in +7 -0
+
+        $RTIFCONFIG rtlo up 127.0.0.1
+
+        if [ $RTCAP = "yes" ]; then
+            ifconfig rtlo up
+        fi
+        ;;
 
      *)
  	usage

Could you check if this delta on top works as well?

utils/net/rtnet.in +4 -10
index fa12a0378a..84f7eed00d 100644
@@ -48,8 +48,7 @@ init_rtnet() {
         fi
     done
 
-    $(cat /proc/rtnet/devices | grep -q rteth0)
-    if [ $? -eq 1 ]; then
+    if grep -vq rteth0 /proc/rtnet/devices; then
         modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
 
         for dev in $REBIND_RT_NICS; do
@@ -61,9 +60,7 @@ init_rtnet() {
     fi
 
     if [ $RT_LOOPBACK = "yes" ]; then
-        $(cat /proc/rtnet/devices | grep -q rtlo)
-        if [ $? -eq 1 ]; then
-
+        if grep -vq rtlo /proc/rtnet/devices; then
             modprobe rt_loopback >/dev/null || exit 1
         fi
     fi
@@ -363,8 +360,7 @@ case "$1" in
         if [ ! -d /proc/rtnet ]; then
             modprobe rtnet >/dev/null || exit 1
         fi
-        $(cat /proc/rtnet/devices | grep -q rteth0)
-        if [ $? -eq 1 ]; then
+        if grep -vq rteth0 /proc/rtnet/devices; then
             modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
         fi
         if [ ! -d /sys/modules/rtcap ]; then
@@ -393,9 +389,7 @@ case "$1" in
         done
 
         if [ $RT_LOOPBACK = "yes" ]; then
-            $(cat /proc/rtnet/devices | grep -q rtlo)
-            if [ $? -eq 1 ]; then
-
+            if grep -vq rtlo /proc/rtnet/devices; then
                 modprobe rt_loopback >/dev/null || exit 1
             fi
         fi

Then I would prefer it and would merge the combination to next. It looks safe and orthogonal enough for -rc2.

Thanks,
Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
#2 lore raw
Quoted 346 lines · Jan Kiszka
Quoted 285 lines · François Legal via Xenomai

Subject: [PATCH] Allow RTNet to be builtin kernel

Makefile is changed because when builtin, the modules get loaded in the link order. In the previous version protocols would get loaded before stackmgr which obviously fails.

---

This has been tested on Zynq 7000 Hardware (microzed board) with MACB/GEM RTNet driver, with linux 4.4.189 vanilla. Kernel boots up correctly, and the following messages get printed on the console during the boot :

[   13.875451] sdhci-pltfm: SDHCI platform and OF driver helper
[   13.881627] sdhci-arasan e0100000.sdhci: No vmmc regulator found
[   13.887581] sdhci-arasan e0100000.sdhci: No vqmmc regulator found
[   13.927585] mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using ADMA
[   13.945085] fpga_manager fpga0: Xilinx Zynq FPGA Manager registered
[   13.951896]
[   13.951896] *** RTnet for Xenomai v3.0.9 ***
[   13.951896]
[   13.959156] RTnet: initialising real-time networking
[   13.964928] RTmac/TDMA: init time division multiple access control mechanism
[   13.972074] RTmac: init realtime media access control
[   13.977064] RTcfg: init real-time configuration distribution protocol
[   13.983752] initializing loopback...
[   13.987295] RTnet: registered rtlo
[   13.993238] RTnet: registered rteth0
[   13.996832] libphy: MACB_mii_bus: probed
[   14.001140] rt_macb: rteth0: Cadence GEM at 0xe000b000 irq 26 (00:0a:35:00:01:22)
[   14.008630] rt_macb: rteth0: attached PHY driver [Marvell 88E1510] (mii_bus:phy_addr=e000b000.ethernet-ffffffff:00, irq=-1)
[   14.019845] RTcap: real-time capturing interface
[   14.026562] RTproxy attached to rteth0
[   14.031129] rtnetproxy installed as "rtproxy"
[   14.035693] NET: Registered protocol family 26
[   14.040309] NET: Registered protocol family 17
[   14.044686] can: controller area network core (rev 20120528 abi 9)
[   14.050957] NET: Registered protocol family 29
[   14.055329] can: raw protocol (rev 20120528)
[   14.059683] can: broadcast manager protocol (rev 20120528 t)
   kernel/drivers/net/Kconfig        |  1 -
   kernel/drivers/net/addons/Kconfig |  4 ++--
   kernel/drivers/net/stack/Makefile | 16 ++++++++--------
   utils/net/rtnet.in | 144 +++++++++++++++++++++++++++++++++++------------------
   4 files changed, 105 insertions(+), 60 deletions(-)
kernel/drivers/net/Kconfig +0 -1
index ac3bced..49d2402 100644
@@ -1,7 +1,6 @@
   menu "RTnet"
 
   config XENO_DRIVERS_NET
-    depends on m
       select NET
       tristate "RTnet, TCP/IP socket interface"
 
kernel/drivers/net/addons/Kconfig +2 -2
index baa6cbc..616ed40 100644
@@ -2,7 +2,7 @@ menu "Add-Ons"
       depends on XENO_DRIVERS_NET
 
   config XENO_DRIVERS_NET_ADDON_RTCAP
-    depends on XENO_DRIVERS_NET && m
+    depends on XENO_DRIVERS_NET
       select ETHERNET
       tristate "Real-Time Capturing Support"
       default n
@@ -18,7 +18,7 @@ config XENO_DRIVERS_NET_ADDON_RTCAP
       For further information see Documentation/README.rtcap.
 
   config XENO_DRIVERS_NET_ADDON_PROXY
-    depends on XENO_DRIVERS_NET_RTIPV4 && m
+    depends on XENO_DRIVERS_NET_RTIPV4
       select ETHERNET
       tristate "IP protocol proxy for Linux"
       default n
kernel/drivers/net/stack/Makefile +8 -8
index d055dc2..f8db6fa 100644
@@ -1,13 +1,5 @@
   ccflags-y += -Idrivers/xenomai/net/stack/include -Ikernel/
 
-obj-$(CONFIG_XENO_DRIVERS_NET_RTIPV4) += ipv4/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTPACKET) += packet/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTMAC) += rtmac/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTCFG) += rtcfg/
-
   obj-$(CONFIG_XENO_DRIVERS_NET) += rtnet.o
 
   rtnet-y :=  \
@@ -23,4 +15,12 @@ rtnet-y :=  \
   	stack_mgr.o \
   	eth.o
 
+obj-$(CONFIG_XENO_DRIVERS_NET_RTIPV4) += ipv4/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTPACKET) += packet/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTMAC) += rtmac/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTCFG) += rtcfg/
+
   rtnet-$(CONFIG_XENO_DRIVERS_NET_RTWLAN) += rtwlan.o
utils/net/rtnet.in +88 -49
index f81a7bb..fa12a03 100644
@@ -31,44 +31,68 @@ EOF
   }
 
   init_rtnet() {
-    modprobe rtnet >/dev/null || exit 1
-    modprobe rtipv4 >/dev/null || exit 1
-    modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
-
-    for dev in $REBIND_RT_NICS; do
-	if [ -d /sys/bus/pci/devices/$dev/driver ]; then
-	    echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
-	fi
-	echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
-    done
+    if [ ! -d /proc/rtnet ]; then
+        modprobe rtnet >/dev/null || exit 1
+    fi
 
+    if [ ! -d /proc/rtnet/ipv4 ]; then
+        modprobe rtipv4 >/dev/null || exit 1
+    fi
       for PROTOCOL in $RT_PROTOCOLS; do
-	modprobe rt$PROTOCOL >/dev/null || exit 1
+        if [ ! -d /sys/modules/rt$PROTOCOL ]; then
+            if [ "$PROTOCOL" = "packet" ]; then
+                modprobe rt$PROTOCOL >/dev/null
+            else
+                modprobe rt$PROTOCOL >/dev/null || exit 1
+            fi
+        fi
       done
 
+    $(cat /proc/rtnet/devices | grep -q rteth0)
+    if [ $? -eq 1 ]; then
+        modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+
+        for dev in $REBIND_RT_NICS; do
+            if [ -d /sys/bus/pci/devices/$dev/driver ]; then
+                echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
+            fi
+            echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
+        done
+    fi
+
       if [ $RT_LOOPBACK = "yes" ]; then
-	modprobe rt_loopback >/dev/null || exit 1
+        $(cat /proc/rtnet/devices | grep -q rtlo)
+        if [ $? -eq 1 ]; then
+
+            modprobe rt_loopback >/dev/null || exit 1
+        fi
       fi
 
-    if [ $RTCAP = "yes" ]; then
-	modprobe rtcap >/dev/null || exit 1
+    if [ $RTCAP = "yes" -a ! -d /sys/modules/rtcap ]; then
+        modprobe rtcap >/dev/null || exit 1
       fi
 
       if [ $RT_LOOPBACK = "yes" ]; then
-	$RTIFCONFIG rtlo up 127.0.0.1
+        $RTIFCONFIG rtlo up 127.0.0.1
       fi
 
       if [ $RTCAP = "yes" ]; then
-	ifconfig rteth0 up
-	ifconfig rteth0-mac up
-	if [ $RT_LOOPBACK = "yes" ]; then
-	    ifconfig rtlo up
-	fi
+        ifconfig rteth0 up
+        ifconfig rteth0-mac up
+        if [ $RT_LOOPBACK = "yes" ]; then
+            ifconfig rtlo up
+        fi
       fi
 
-    modprobe rtcfg >/dev/null
-    modprobe rtmac >/dev/null
-    modprobe tdma >/dev/null
+    if [ ! -d /proc/rtnet/rtcfg ]; then
+        modprobe rtcfg >/dev/null
+    fi
+    if [ ! -d /proc/rtnet/rtmac ]; then
+        modprobe rtmac >/dev/null
+    fi
+    if [ ! -f /proc/tdma ]; then
+        modprobe tdma >/dev/null
+    fi
   }
 
   submit_cfg() {
@@ -336,34 +360,56 @@ case "$1" in
   	;;
 
       capture)
-	modprobe rtnet >/dev/null || exit 1
-	modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
-	modprobe rtcap >/dev/null || exit 1
-	$RTIFCONFIG rteth0 up promisc
-	ifconfig rteth0 up
-	ifconfig rteth0-mac up
-	;;
+        if [ ! -d /proc/rtnet ]; then
+            modprobe rtnet >/dev/null || exit 1
+        fi
+        $(cat /proc/rtnet/devices | grep -q rteth0)
+        if [ $? -eq 1 ]; then
+            modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+        fi
+        if [ ! -d /sys/modules/rtcap ]; then
+            modprobe rtcap >/dev/null || exit 1
+        fi
+        $RTIFCONFIG rteth0 up promisc
+        ifconfig rteth0 up
+        ifconfig rteth0-mac up
+        ;;
 
       loopback)
-	modprobe rtnet >/dev/null || exit 1
-	modprobe rtipv4 >/dev/null || exit 1
-
-	for PROTOCOL in $RT_PROTOCOLS; do
-	    modprobe rt$PROTOCOL >/dev/null || exit 1
-	done
-
-	modprobe rt_loopback >/dev/null || exit 1
-
-	if [ $RTCAP = "yes" ]; then
-	    modprobe rtcap >/dev/null || exit 1
-	fi
-
-	$RTIFCONFIG rtlo up 127.0.0.1
-
-	if [ $RTCAP = "yes" ]; then
-	    ifconfig rtlo up
-	fi
-	;;
+        if [ ! -d /proc/rtnet ]; then
+            modprobe rtnet >/dev/null || exit 1
+        fi
+        if [ ! -d /proc/rtnet/ipv4 ]; then
+            modprobe rtipv4 >/dev/null || exit 1
+        fi
+        for PROTOCOL in $RT_PROTOCOLS; do
+            if [ ! -d /sys/modules/rt$PROTOCOL ]; then
+                if [ "$PROTOCOL" = "packet" ]; then
+                    modprobe rt$PROTOCOL >/dev/null
+                else
+                    modprobe rt$PROTOCOL >/dev/null || exit 1
+                fi
+            fi
+        done
+
+        if [ $RT_LOOPBACK = "yes" ]; then
+            $(cat /proc/rtnet/devices | grep -q rtlo)
+            if [ $? -eq 1 ]; then
+
+                modprobe rt_loopback >/dev/null || exit 1
+            fi
+        fi
+
+        if [ $RTCAP = "yes" -a ! -d /sys/modules/rtcap ]; then
+            modprobe rtcap >/dev/null || exit 1
+        fi

utils/net/rtnet.in case "$1" in · line 415

Quoted 10 lines
utils/net/rtnet.in +7 -0
+
+        $RTIFCONFIG rtlo up 127.0.0.1
+
+        if [ $RTCAP = "yes" ]; then
+            ifconfig rtlo up
+        fi
+        ;;
 
       *)
   	usage

Could you check if this delta on top works as well?

utils/net/rtnet.in +4 -10
index fa12a0378a..84f7eed00d 100644
@@ -48,8 +48,7 @@ init_rtnet() {
          fi
      done
 
-    $(cat /proc/rtnet/devices | grep -q rteth0)
-    if [ $? -eq 1 ]; then
+    if grep -vq rteth0 /proc/rtnet/devices; then
          modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
 
          for dev in $REBIND_RT_NICS; do
@@ -61,9 +60,7 @@ init_rtnet() {
      fi
 
      if [ $RT_LOOPBACK = "yes" ]; then
-        $(cat /proc/rtnet/devices | grep -q rtlo)
-        if [ $? -eq 1 ]; then
-
+        if grep -vq rtlo /proc/rtnet/devices; then
              modprobe rt_loopback >/dev/null || exit 1
          fi
      fi
@@ -363,8 +360,7 @@ case "$1" in
          if [ ! -d /proc/rtnet ]; then
              modprobe rtnet >/dev/null || exit 1
          fi
-        $(cat /proc/rtnet/devices | grep -q rteth0)
-        if [ $? -eq 1 ]; then
+        if grep -vq rteth0 /proc/rtnet/devices; then
              modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
          fi
          if [ ! -d /sys/modules/rtcap ]; then
@@ -393,9 +389,7 @@ case "$1" in
          done
 
          if [ $RT_LOOPBACK = "yes" ]; then
-            $(cat /proc/rtnet/devices | grep -q rtlo)
-            if [ $? -eq 1 ]; then
-
+            if grep -vq rtlo /proc/rtnet/devices; then
                  modprobe rt_loopback >/dev/null || exit 1
              fi
          fi
Quoted 2 lines

Then I would prefer it and would merge the combination to next. It looks safe and orthogonal enough for -rc2.

Nah, not yet. We need to check the drivers first. At least the e1000 have non-static symbols that collide with the in-tree version.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
#3 lore raw
Quoted 347 lines · Jan Kiszka
Quoted 346 lines · Jan Kiszka
Quoted 285 lines · François Legal via Xenomai

Subject: [PATCH] Allow RTNet to be builtin kernel

Makefile is changed because when builtin, the modules get loaded in the link order. In the previous version protocols would get loaded before stackmgr which obviously fails.

---

This has been tested on Zynq 7000 Hardware (microzed board) with MACB/GEM RTNet driver, with linux 4.4.189 vanilla. Kernel boots up correctly, and the following messages get printed on the console during the boot :

[   13.875451] sdhci-pltfm: SDHCI platform and OF driver helper
[   13.881627] sdhci-arasan e0100000.sdhci: No vmmc regulator found
[   13.887581] sdhci-arasan e0100000.sdhci: No vqmmc regulator found
[   13.927585] mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using ADMA
[   13.945085] fpga_manager fpga0: Xilinx Zynq FPGA Manager registered
[   13.951896]
[   13.951896] *** RTnet for Xenomai v3.0.9 ***
[   13.951896]
[   13.959156] RTnet: initialising real-time networking
[   13.964928] RTmac/TDMA: init time division multiple access control mechanism
[   13.972074] RTmac: init realtime media access control
[   13.977064] RTcfg: init real-time configuration distribution protocol
[   13.983752] initializing loopback...
[   13.987295] RTnet: registered rtlo
[   13.993238] RTnet: registered rteth0
[   13.996832] libphy: MACB_mii_bus: probed
[   14.001140] rt_macb: rteth0: Cadence GEM at 0xe000b000 irq 26 (00:0a:35:00:01:22)
[   14.008630] rt_macb: rteth0: attached PHY driver [Marvell 88E1510] (mii_bus:phy_addr=e000b000.ethernet-ffffffff:00, irq=-1)
[   14.019845] RTcap: real-time capturing interface
[   14.026562] RTproxy attached to rteth0
[   14.031129] rtnetproxy installed as "rtproxy"
[   14.035693] NET: Registered protocol family 26
[   14.040309] NET: Registered protocol family 17
[   14.044686] can: controller area network core (rev 20120528 abi 9)
[   14.050957] NET: Registered protocol family 29
[   14.055329] can: raw protocol (rev 20120528)
[   14.059683] can: broadcast manager protocol (rev 20120528 t)
   kernel/drivers/net/Kconfig        |  1 -
   kernel/drivers/net/addons/Kconfig |  4 ++--
   kernel/drivers/net/stack/Makefile | 16 ++++++++--------
   utils/net/rtnet.in | 144 +++++++++++++++++++++++++++++++++++------------------
   4 files changed, 105 insertions(+), 60 deletions(-)
kernel/drivers/net/Kconfig +0 -1
index ac3bced..49d2402 100644
@@ -1,7 +1,6 @@
   menu "RTnet"
 
   config XENO_DRIVERS_NET
-    depends on m
       select NET
       tristate "RTnet, TCP/IP socket interface"
 
kernel/drivers/net/addons/Kconfig +2 -2
index baa6cbc..616ed40 100644
@@ -2,7 +2,7 @@ menu "Add-Ons"
       depends on XENO_DRIVERS_NET
 
   config XENO_DRIVERS_NET_ADDON_RTCAP
-    depends on XENO_DRIVERS_NET && m
+    depends on XENO_DRIVERS_NET
       select ETHERNET
       tristate "Real-Time Capturing Support"
       default n
@@ -18,7 +18,7 @@ config XENO_DRIVERS_NET_ADDON_RTCAP
       For further information see Documentation/README.rtcap.
 
   config XENO_DRIVERS_NET_ADDON_PROXY
-    depends on XENO_DRIVERS_NET_RTIPV4 && m
+    depends on XENO_DRIVERS_NET_RTIPV4
       select ETHERNET
       tristate "IP protocol proxy for Linux"
       default n
kernel/drivers/net/stack/Makefile +8 -8
index d055dc2..f8db6fa 100644
@@ -1,13 +1,5 @@
   ccflags-y += -Idrivers/xenomai/net/stack/include -Ikernel/
 
-obj-$(CONFIG_XENO_DRIVERS_NET_RTIPV4) += ipv4/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTPACKET) += packet/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTMAC) += rtmac/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTCFG) += rtcfg/
-
   obj-$(CONFIG_XENO_DRIVERS_NET) += rtnet.o
 
   rtnet-y :=  \
@@ -23,4 +15,12 @@ rtnet-y :=  \
   	stack_mgr.o \
   	eth.o
 
+obj-$(CONFIG_XENO_DRIVERS_NET_RTIPV4) += ipv4/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTPACKET) += packet/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTMAC) += rtmac/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTCFG) += rtcfg/
+
   rtnet-$(CONFIG_XENO_DRIVERS_NET_RTWLAN) += rtwlan.o
utils/net/rtnet.in +88 -49
index f81a7bb..fa12a03 100644
@@ -31,44 +31,68 @@ EOF
   }
 
   init_rtnet() {
-    modprobe rtnet >/dev/null || exit 1
-    modprobe rtipv4 >/dev/null || exit 1
-    modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
-
-    for dev in $REBIND_RT_NICS; do
-	if [ -d /sys/bus/pci/devices/$dev/driver ]; then
-	    echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
-	fi
-	echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
-    done
+    if [ ! -d /proc/rtnet ]; then
+        modprobe rtnet >/dev/null || exit 1
+    fi
 
+    if [ ! -d /proc/rtnet/ipv4 ]; then
+        modprobe rtipv4 >/dev/null || exit 1
+    fi
       for PROTOCOL in $RT_PROTOCOLS; do
-	modprobe rt$PROTOCOL >/dev/null || exit 1
+        if [ ! -d /sys/modules/rt$PROTOCOL ]; then
+            if [ "$PROTOCOL" = "packet" ]; then
+                modprobe rt$PROTOCOL >/dev/null
+            else
+                modprobe rt$PROTOCOL >/dev/null || exit 1
+            fi
+        fi
       done
 
+    $(cat /proc/rtnet/devices | grep -q rteth0)
+    if [ $? -eq 1 ]; then
+        modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+
+        for dev in $REBIND_RT_NICS; do
+            if [ -d /sys/bus/pci/devices/$dev/driver ]; then
+                echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
+            fi
+            echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
+        done
+    fi
+
       if [ $RT_LOOPBACK = "yes" ]; then
-	modprobe rt_loopback >/dev/null || exit 1
+        $(cat /proc/rtnet/devices | grep -q rtlo)
+        if [ $? -eq 1 ]; then
+
+            modprobe rt_loopback >/dev/null || exit 1
+        fi
       fi
 
-    if [ $RTCAP = "yes" ]; then
-	modprobe rtcap >/dev/null || exit 1
+    if [ $RTCAP = "yes" -a ! -d /sys/modules/rtcap ]; then
+        modprobe rtcap >/dev/null || exit 1
       fi
 
       if [ $RT_LOOPBACK = "yes" ]; then
-	$RTIFCONFIG rtlo up 127.0.0.1
+        $RTIFCONFIG rtlo up 127.0.0.1
       fi
 
       if [ $RTCAP = "yes" ]; then
-	ifconfig rteth0 up
-	ifconfig rteth0-mac up
-	if [ $RT_LOOPBACK = "yes" ]; then
-	    ifconfig rtlo up
-	fi
+        ifconfig rteth0 up
+        ifconfig rteth0-mac up
+        if [ $RT_LOOPBACK = "yes" ]; then
+            ifconfig rtlo up
+        fi
       fi
 
-    modprobe rtcfg >/dev/null
-    modprobe rtmac >/dev/null
-    modprobe tdma >/dev/null
+    if [ ! -d /proc/rtnet/rtcfg ]; then
+        modprobe rtcfg >/dev/null
+    fi
+    if [ ! -d /proc/rtnet/rtmac ]; then
+        modprobe rtmac >/dev/null
+    fi
+    if [ ! -f /proc/tdma ]; then
+        modprobe tdma >/dev/null
+    fi
   }
 
   submit_cfg() {
@@ -336,34 +360,56 @@ case "$1" in
   	;;
 
       capture)
-	modprobe rtnet >/dev/null || exit 1
-	modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
-	modprobe rtcap >/dev/null || exit 1
-	$RTIFCONFIG rteth0 up promisc
-	ifconfig rteth0 up
-	ifconfig rteth0-mac up
-	;;
+        if [ ! -d /proc/rtnet ]; then
+            modprobe rtnet >/dev/null || exit 1
+        fi
+        $(cat /proc/rtnet/devices | grep -q rteth0)
+        if [ $? -eq 1 ]; then
+            modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+        fi
+        if [ ! -d /sys/modules/rtcap ]; then
+            modprobe rtcap >/dev/null || exit 1
+        fi
+        $RTIFCONFIG rteth0 up promisc
+        ifconfig rteth0 up
+        ifconfig rteth0-mac up
+        ;;
 
       loopback)
-	modprobe rtnet >/dev/null || exit 1
-	modprobe rtipv4 >/dev/null || exit 1
-
-	for PROTOCOL in $RT_PROTOCOLS; do
-	    modprobe rt$PROTOCOL >/dev/null || exit 1
-	done
-
-	modprobe rt_loopback >/dev/null || exit 1
-
-	if [ $RTCAP = "yes" ]; then
-	    modprobe rtcap >/dev/null || exit 1
-	fi
-
-	$RTIFCONFIG rtlo up 127.0.0.1
-
-	if [ $RTCAP = "yes" ]; then
-	    ifconfig rtlo up
-	fi
-	;;
+        if [ ! -d /proc/rtnet ]; then
+            modprobe rtnet >/dev/null || exit 1
+        fi
+        if [ ! -d /proc/rtnet/ipv4 ]; then
+            modprobe rtipv4 >/dev/null || exit 1
+        fi
+        for PROTOCOL in $RT_PROTOCOLS; do
+            if [ ! -d /sys/modules/rt$PROTOCOL ]; then
+                if [ "$PROTOCOL" = "packet" ]; then
+                    modprobe rt$PROTOCOL >/dev/null
+                else
+                    modprobe rt$PROTOCOL >/dev/null || exit 1
+                fi
+            fi
+        done
+
+        if [ $RT_LOOPBACK = "yes" ]; then
+            $(cat /proc/rtnet/devices | grep -q rtlo)
+            if [ $? -eq 1 ]; then
+
+                modprobe rt_loopback >/dev/null || exit 1
+            fi
+        fi
+
+        if [ $RTCAP = "yes" -a ! -d /sys/modules/rtcap ]; then
+            modprobe rtcap >/dev/null || exit 1
+        fi

utils/net/rtnet.in case "$1" in · line 415

Quoted 10 lines
utils/net/rtnet.in +7 -0
+
+        $RTIFCONFIG rtlo up 127.0.0.1
+
+        if [ $RTCAP = "yes" ]; then
+            ifconfig rtlo up
+        fi
+        ;;
 
       *)
   	usage

Could you check if this delta on top works as well?

utils/net/rtnet.in +4 -10
index fa12a0378a..84f7eed00d 100644
@@ -48,8 +48,7 @@ init_rtnet() {
          fi
      done
 
-    $(cat /proc/rtnet/devices | grep -q rteth0)
-    if [ $? -eq 1 ]; then
+    if grep -vq rteth0 /proc/rtnet/devices; then
          modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
 
          for dev in $REBIND_RT_NICS; do
@@ -61,9 +60,7 @@ init_rtnet() {
      fi
 
      if [ $RT_LOOPBACK = "yes" ]; then
-        $(cat /proc/rtnet/devices | grep -q rtlo)
-        if [ $? -eq 1 ]; then
-
+        if grep -vq rtlo /proc/rtnet/devices; then
              modprobe rt_loopback >/dev/null || exit 1
          fi
      fi
@@ -363,8 +360,7 @@ case "$1" in
          if [ ! -d /proc/rtnet ]; then
              modprobe rtnet >/dev/null || exit 1
          fi
-        $(cat /proc/rtnet/devices | grep -q rteth0)
-        if [ $? -eq 1 ]; then
+        if grep -vq rteth0 /proc/rtnet/devices; then
              modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
          fi
          if [ ! -d /sys/modules/rtcap ]; then
@@ -393,9 +389,7 @@ case "$1" in
          done
 
          if [ $RT_LOOPBACK = "yes" ]; then
-            $(cat /proc/rtnet/devices | grep -q rtlo)
-            if [ $? -eq 1 ]; then
-
+            if grep -vq rtlo /proc/rtnet/devices; then
                  modprobe rt_loopback >/dev/null || exit 1
              fi
          fi
Quoted 8 lines
Quoted 2 lines

Then I would prefer it and would merge the combination to next. It looks safe and orthogonal enough for -rc2.

Nah, not yet. We need to check the drivers first. At least the e1000 have non-static symbols that collide with the in-tree version.

Jan

Anyway, what you proposed does not work as there is an header line in the file which will match anyway (plus there is likely another network interface there too, causing your rule to fail.

We could replace that with :
grep -q rtlo /proc/rtnet/devices || modprobe rt_loopback >/dev/null || exit 1

I can send the patch back that way if that fits your rules.

François

Quoted 3 lines

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux

#4 lore raw
Quoted 358 lines · François Legal
Quoted 347 lines · Jan Kiszka
Quoted 346 lines · Jan Kiszka
Quoted 285 lines · François Legal via Xenomai

Subject: [PATCH] Allow RTNet to be builtin kernel

Makefile is changed because when builtin, the modules get loaded in the link order. In the previous version protocols would get loaded before stackmgr which obviously fails.

---

This has been tested on Zynq 7000 Hardware (microzed board) with MACB/GEM RTNet driver, with linux 4.4.189 vanilla. Kernel boots up correctly, and the following messages get printed on the console during the boot :

[   13.875451] sdhci-pltfm: SDHCI platform and OF driver helper
[   13.881627] sdhci-arasan e0100000.sdhci: No vmmc regulator found
[   13.887581] sdhci-arasan e0100000.sdhci: No vqmmc regulator found
[   13.927585] mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using ADMA
[   13.945085] fpga_manager fpga0: Xilinx Zynq FPGA Manager registered
[   13.951896]
[   13.951896] *** RTnet for Xenomai v3.0.9 ***
[   13.951896]
[   13.959156] RTnet: initialising real-time networking
[   13.964928] RTmac/TDMA: init time division multiple access control mechanism
[   13.972074] RTmac: init realtime media access control
[   13.977064] RTcfg: init real-time configuration distribution protocol
[   13.983752] initializing loopback...
[   13.987295] RTnet: registered rtlo
[   13.993238] RTnet: registered rteth0
[   13.996832] libphy: MACB_mii_bus: probed
[   14.001140] rt_macb: rteth0: Cadence GEM at 0xe000b000 irq 26 (00:0a:35:00:01:22)
[   14.008630] rt_macb: rteth0: attached PHY driver [Marvell 88E1510] (mii_bus:phy_addr=e000b000.ethernet-ffffffff:00, irq=-1)
[   14.019845] RTcap: real-time capturing interface
[   14.026562] RTproxy attached to rteth0
[   14.031129] rtnetproxy installed as "rtproxy"
[   14.035693] NET: Registered protocol family 26
[   14.040309] NET: Registered protocol family 17
[   14.044686] can: controller area network core (rev 20120528 abi 9)
[   14.050957] NET: Registered protocol family 29
[   14.055329] can: raw protocol (rev 20120528)
[   14.059683] can: broadcast manager protocol (rev 20120528 t)
    kernel/drivers/net/Kconfig        |  1 -
    kernel/drivers/net/addons/Kconfig |  4 ++--
    kernel/drivers/net/stack/Makefile | 16 ++++++++--------
    utils/net/rtnet.in | 144 +++++++++++++++++++++++++++++++++++------------------
    4 files changed, 105 insertions(+), 60 deletions(-)
kernel/drivers/net/Kconfig +0 -1
index ac3bced..49d2402 100644
@@ -1,7 +1,6 @@
    menu "RTnet"
 
    config XENO_DRIVERS_NET
-    depends on m
        select NET
        tristate "RTnet, TCP/IP socket interface"
 
kernel/drivers/net/addons/Kconfig +2 -2
index baa6cbc..616ed40 100644
@@ -2,7 +2,7 @@ menu "Add-Ons"
        depends on XENO_DRIVERS_NET
 
    config XENO_DRIVERS_NET_ADDON_RTCAP
-    depends on XENO_DRIVERS_NET && m
+    depends on XENO_DRIVERS_NET
        select ETHERNET
        tristate "Real-Time Capturing Support"
        default n
@@ -18,7 +18,7 @@ config XENO_DRIVERS_NET_ADDON_RTCAP
        For further information see Documentation/README.rtcap.
 
    config XENO_DRIVERS_NET_ADDON_PROXY
-    depends on XENO_DRIVERS_NET_RTIPV4 && m
+    depends on XENO_DRIVERS_NET_RTIPV4
        select ETHERNET
        tristate "IP protocol proxy for Linux"
        default n
kernel/drivers/net/stack/Makefile +8 -8
index d055dc2..f8db6fa 100644
@@ -1,13 +1,5 @@
    ccflags-y += -Idrivers/xenomai/net/stack/include -Ikernel/
 
-obj-$(CONFIG_XENO_DRIVERS_NET_RTIPV4) += ipv4/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTPACKET) += packet/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTMAC) += rtmac/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTCFG) += rtcfg/
-
    obj-$(CONFIG_XENO_DRIVERS_NET) += rtnet.o
 
    rtnet-y :=  \
@@ -23,4 +15,12 @@ rtnet-y :=  \
    	stack_mgr.o \
    	eth.o
 
+obj-$(CONFIG_XENO_DRIVERS_NET_RTIPV4) += ipv4/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTPACKET) += packet/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTMAC) += rtmac/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTCFG) += rtcfg/
+
    rtnet-$(CONFIG_XENO_DRIVERS_NET_RTWLAN) += rtwlan.o
utils/net/rtnet.in +88 -49
index f81a7bb..fa12a03 100644
@@ -31,44 +31,68 @@ EOF
    }
 
    init_rtnet() {
-    modprobe rtnet >/dev/null || exit 1
-    modprobe rtipv4 >/dev/null || exit 1
-    modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
-
-    for dev in $REBIND_RT_NICS; do
-	if [ -d /sys/bus/pci/devices/$dev/driver ]; then
-	    echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
-	fi
-	echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
-    done
+    if [ ! -d /proc/rtnet ]; then
+        modprobe rtnet >/dev/null || exit 1
+    fi
 
+    if [ ! -d /proc/rtnet/ipv4 ]; then
+        modprobe rtipv4 >/dev/null || exit 1
+    fi
        for PROTOCOL in $RT_PROTOCOLS; do
-	modprobe rt$PROTOCOL >/dev/null || exit 1
+        if [ ! -d /sys/modules/rt$PROTOCOL ]; then
+            if [ "$PROTOCOL" = "packet" ]; then
+                modprobe rt$PROTOCOL >/dev/null
+            else
+                modprobe rt$PROTOCOL >/dev/null || exit 1
+            fi
+        fi
        done
 
+    $(cat /proc/rtnet/devices | grep -q rteth0)
+    if [ $? -eq 1 ]; then
+        modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+
+        for dev in $REBIND_RT_NICS; do
+            if [ -d /sys/bus/pci/devices/$dev/driver ]; then
+                echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
+            fi
+            echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
+        done
+    fi
+
        if [ $RT_LOOPBACK = "yes" ]; then
-	modprobe rt_loopback >/dev/null || exit 1
+        $(cat /proc/rtnet/devices | grep -q rtlo)
+        if [ $? -eq 1 ]; then
+
+            modprobe rt_loopback >/dev/null || exit 1
+        fi
        fi
 
-    if [ $RTCAP = "yes" ]; then
-	modprobe rtcap >/dev/null || exit 1
+    if [ $RTCAP = "yes" -a ! -d /sys/modules/rtcap ]; then
+        modprobe rtcap >/dev/null || exit 1
        fi
 
        if [ $RT_LOOPBACK = "yes" ]; then
-	$RTIFCONFIG rtlo up 127.0.0.1
+        $RTIFCONFIG rtlo up 127.0.0.1
        fi
 
        if [ $RTCAP = "yes" ]; then
-	ifconfig rteth0 up
-	ifconfig rteth0-mac up
-	if [ $RT_LOOPBACK = "yes" ]; then
-	    ifconfig rtlo up
-	fi
+        ifconfig rteth0 up
+        ifconfig rteth0-mac up
+        if [ $RT_LOOPBACK = "yes" ]; then
+            ifconfig rtlo up
+        fi
        fi
 
-    modprobe rtcfg >/dev/null
-    modprobe rtmac >/dev/null
-    modprobe tdma >/dev/null
+    if [ ! -d /proc/rtnet/rtcfg ]; then
+        modprobe rtcfg >/dev/null
+    fi
+    if [ ! -d /proc/rtnet/rtmac ]; then
+        modprobe rtmac >/dev/null
+    fi
+    if [ ! -f /proc/tdma ]; then
+        modprobe tdma >/dev/null
+    fi
    }
 
    submit_cfg() {
@@ -336,34 +360,56 @@ case "$1" in
    	;;
 
        capture)
-	modprobe rtnet >/dev/null || exit 1
-	modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
-	modprobe rtcap >/dev/null || exit 1
-	$RTIFCONFIG rteth0 up promisc
-	ifconfig rteth0 up
-	ifconfig rteth0-mac up
-	;;
+        if [ ! -d /proc/rtnet ]; then
+            modprobe rtnet >/dev/null || exit 1
+        fi
+        $(cat /proc/rtnet/devices | grep -q rteth0)
+        if [ $? -eq 1 ]; then
+            modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+        fi
+        if [ ! -d /sys/modules/rtcap ]; then
+            modprobe rtcap >/dev/null || exit 1
+        fi
+        $RTIFCONFIG rteth0 up promisc
+        ifconfig rteth0 up
+        ifconfig rteth0-mac up
+        ;;
 
        loopback)
-	modprobe rtnet >/dev/null || exit 1
-	modprobe rtipv4 >/dev/null || exit 1
-
-	for PROTOCOL in $RT_PROTOCOLS; do
-	    modprobe rt$PROTOCOL >/dev/null || exit 1
-	done
-
-	modprobe rt_loopback >/dev/null || exit 1
-
-	if [ $RTCAP = "yes" ]; then
-	    modprobe rtcap >/dev/null || exit 1
-	fi
-
-	$RTIFCONFIG rtlo up 127.0.0.1
-
-	if [ $RTCAP = "yes" ]; then
-	    ifconfig rtlo up
-	fi
-	;;
+        if [ ! -d /proc/rtnet ]; then
+            modprobe rtnet >/dev/null || exit 1
+        fi
+        if [ ! -d /proc/rtnet/ipv4 ]; then
+            modprobe rtipv4 >/dev/null || exit 1
+        fi
+        for PROTOCOL in $RT_PROTOCOLS; do
+            if [ ! -d /sys/modules/rt$PROTOCOL ]; then
+                if [ "$PROTOCOL" = "packet" ]; then
+                    modprobe rt$PROTOCOL >/dev/null
+                else
+                    modprobe rt$PROTOCOL >/dev/null || exit 1
+                fi
+            fi
+        done
+
+        if [ $RT_LOOPBACK = "yes" ]; then
+            $(cat /proc/rtnet/devices | grep -q rtlo)
+            if [ $? -eq 1 ]; then
+
+                modprobe rt_loopback >/dev/null || exit 1
+            fi
+        fi
+
+        if [ $RTCAP = "yes" -a ! -d /sys/modules/rtcap ]; then
+            modprobe rtcap >/dev/null || exit 1
+        fi

utils/net/rtnet.in case "$1" in · line 415

Quoted 10 lines
utils/net/rtnet.in +7 -0
+
+        $RTIFCONFIG rtlo up 127.0.0.1
+
+        if [ $RTCAP = "yes" ]; then
+            ifconfig rtlo up
+        fi
+        ;;
 
        *)
    	usage

Could you check if this delta on top works as well?

utils/net/rtnet.in +4 -10
index fa12a0378a..84f7eed00d 100644
@@ -48,8 +48,7 @@ init_rtnet() {
           fi
       done
 
-    $(cat /proc/rtnet/devices | grep -q rteth0)
-    if [ $? -eq 1 ]; then
+    if grep -vq rteth0 /proc/rtnet/devices; then
           modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
 
           for dev in $REBIND_RT_NICS; do
@@ -61,9 +60,7 @@ init_rtnet() {
       fi
 
       if [ $RT_LOOPBACK = "yes" ]; then
-        $(cat /proc/rtnet/devices | grep -q rtlo)
-        if [ $? -eq 1 ]; then
-
+        if grep -vq rtlo /proc/rtnet/devices; then
               modprobe rt_loopback >/dev/null || exit 1
           fi
       fi
@@ -363,8 +360,7 @@ case "$1" in
           if [ ! -d /proc/rtnet ]; then
               modprobe rtnet >/dev/null || exit 1
           fi
-        $(cat /proc/rtnet/devices | grep -q rteth0)
-        if [ $? -eq 1 ]; then
+        if grep -vq rteth0 /proc/rtnet/devices; then
               modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
           fi
           if [ ! -d /sys/modules/rtcap ]; then
@@ -393,9 +389,7 @@ case "$1" in
           done
 
           if [ $RT_LOOPBACK = "yes" ]; then
-            $(cat /proc/rtnet/devices | grep -q rtlo)
-            if [ $? -eq 1 ]; then
-
+            if grep -vq rtlo /proc/rtnet/devices; then
                   modprobe rt_loopback >/dev/null || exit 1
               fi
           fi
Quoted 8 lines
Quoted 2 lines

Then I would prefer it and would merge the combination to next. It looks safe and orthogonal enough for -rc2.

Nah, not yet. We need to check the drivers first. At least the e1000 have non-static symbols that collide with the in-tree version.

Jan

Quoted 6 lines

Anyway, what you proposed does not work as there is an header line in the file which will match anyway (plus there is likely another network interface there too, causing your rule to fail.

We could replace that with :
grep -q rtlo /proc/rtnet/devices || modprobe rt_loopback >/dev/null || exit 1

I can send the patch back that way if that fits your rules.

Ah, yeah, not the same... But then do "if ! grep -q ...".

Regarding the symbol conflicts: Maybe we start with marking all drivers "depends m", and then dropping those step-wise which do not conflict with their upstream siblings. But it is important to check that by building both into the kernel.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

A message that is not in the archive (sent off-list or not yet received): VI1PR05MB59174B531D2FFC88C2E05458F6950@VI1PR05MB5917.eurprd05.prod.outlook.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 436 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Mittwoch, 9. Oktober 2019 13:00
To: Lange Norbert <[email protected]>; François Legal <[email protected]>
Subject: Re: [PATCH] Allow RTNet to be builtin kernel

NON-ANDRITZ SOURCE: BE CAUTIOUS WITH CONTENT, LINKS OR ATTACHMENTS.

Quoted 4 lines · Lange Norbert
Quoted 4 lines

-----Original Message-----
From: Xenomai <[email protected]> On Behalf Of Jan

Kiszka

Quoted 7 lines
Quoted 7 lines

via Xenomai
Sent: Freitag, 4. Oktober 2019 16:31
To: François Legal <[email protected]>
Cc: Xenomai <[email protected]>
Subject: Re: [PATCH] Allow RTNet to be builtin kernel

NON-ANDRITZ SOURCE: BE CAUTIOUS WITH CONTENT, LINKS OR

ATTACHMENTS.

Quoted 11 lines
Quoted 11 lines · François Legal
Quoted 1 line

Le Vendredi, Octobre 04, 2019 15:36 CEST, Jan Kiszka

Quoted 6 lines · <[email protected]> a écrit:
Quoted 6 lines · Jan Kiszka
Quoted 4 lines · François Legal via Xenomai
Quoted 3 lines

Subject: [PATCH] Allow RTNet to be builtin kernel

Makefile is changed because when builtin, the modules get loaded

in

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

the link order. In the previous version protocols would get loaded before stackmgr which obviously fails.

---

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

This has been tested on Zynq 7000 Hardware (microzed board) with MACB/GEM RTNet driver, with linux 4.4.189 vanilla. Kernel boots up correctly, and the following messages get printed on the console during the boot :

[   13.875451] sdhci-pltfm: SDHCI platform and OF driver helper
[   13.881627] sdhci-arasan e0100000.sdhci: No vmmc regulator found
[   13.887581] sdhci-arasan e0100000.sdhci: No vqmmc regulator

found

Quoted 95 lines
Quoted 95 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
[   13.927585] mmc0: SDHCI controller on e0100000.sdhci

[e0100000.sdhci] using ADMA

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
[   13.945085] fpga_manager fpga0: Xilinx Zynq FPGA Manager

registered

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
[   13.951896]
[   13.951896] *** RTnet for Xenomai v3.0.9 ***
[   13.951896]
[   13.959156] RTnet: initialising real-time networking
[   13.964928] RTmac/TDMA: init time division multiple access control

mechanism

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
[   13.972074] RTmac: init realtime media access control
[   13.977064] RTcfg: init real-time configuration distribution protocol
[   13.983752] initializing loopback...
[   13.987295] RTnet: registered rtlo
[   13.993238] RTnet: registered rteth0
[   13.996832] libphy: MACB_mii_bus: probed
[   14.001140] rt_macb: rteth0: Cadence GEM at 0xe000b000 irq 26

(00:0a:35:00:01:22)

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
[   14.008630] rt_macb: rteth0: attached PHY driver [Marvell 88E1510]

(mii_bus:phy_addr=e000b000.ethernet-ffffffff:00, irq=-1)

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
[   14.019845] RTcap: real-time capturing interface
[   14.026562] RTproxy attached to rteth0
[   14.031129] rtnetproxy installed as "rtproxy"
[   14.035693] NET: Registered protocol family 26
[   14.040309] NET: Registered protocol family 17
[   14.044686] can: controller area network core (rev 20120528 abi 9)
[   14.050957] NET: Registered protocol family 29
[   14.055329] can: raw protocol (rev 20120528)
[   14.059683] can: broadcast manager protocol (rev 20120528 t)
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
    kernel/drivers/net/Kconfig        |  1 -
    kernel/drivers/net/addons/Kconfig |  4 ++--
    kernel/drivers/net/stack/Makefile | 16 ++++++++--------
    utils/net/rtnet.in | 144

+++++++++++++++++++++++++++++++++++------------------

Quoted 60 lines
Quoted 60 lines
Quoted 60 lines
Quoted 60 lines
    4 files changed, 105 insertions(+), 60 deletions(-)
(quoted diff) +0 -0

b/kernel/drivers/net/Kconfig index ac3bced..49d2402 100644

kernel/drivers/net/Kconfig +0 -1
@@ -1,7 +1,6 @@
    menu "RTnet"
 
    config XENO_DRIVERS_NET
-    depends on m
        select NET
        tristate "RTnet, TCP/IP socket interface"
 
kernel/drivers/net/addons/Kconfig +2 -2
index baa6cbc..616ed40 100644
@@ -2,7 +2,7 @@ menu "Add-Ons"
        depends on XENO_DRIVERS_NET
 
    config XENO_DRIVERS_NET_ADDON_RTCAP
-    depends on XENO_DRIVERS_NET && m
+    depends on XENO_DRIVERS_NET
        select ETHERNET
        tristate "Real-Time Capturing Support"
        default n
@@ -18,7 +18,7 @@ config XENO_DRIVERS_NET_ADDON_RTCAP
        For further information see Documentation/README.rtcap.
 
    config XENO_DRIVERS_NET_ADDON_PROXY
-    depends on XENO_DRIVERS_NET_RTIPV4 && m
+    depends on XENO_DRIVERS_NET_RTIPV4
        select ETHERNET
        tristate "IP protocol proxy for Linux"
        default n
kernel/drivers/net/stack/Makefile +0 -8
index d055dc2..f8db6fa 100644
@@ -1,13 +1,5 @@
    ccflags-y += -Idrivers/xenomai/net/stack/include -Ikernel/
 
-obj-$(CONFIG_XENO_DRIVERS_NET_RTIPV4) += ipv4/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTPACKET) += packet/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTMAC) += rtmac/
-
-obj-$(CONFIG_XENO_DRIVERS_NET_RTCFG) += rtcfg/
-
    obj-$(CONFIG_XENO_DRIVERS_NET) += rtnet.o
 
    rtnet-y :=  \
@@ -23,4 +15,12 @@ rtnet-y :=  \
           stack_mgr.o \
           eth.o
 
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

kernel/drivers/net/stack/Makefile rtnet-y := \ · line 26

Quoted 9 lines
kernel/drivers/net/stack/Makefile +8 -0
+obj-$(CONFIG_XENO_DRIVERS_NET_RTIPV4) += ipv4/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTPACKET) += packet/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTMAC) += rtmac/
+
+obj-$(CONFIG_XENO_DRIVERS_NET_RTCFG) += rtcfg/
+
    rtnet-$(CONFIG_XENO_DRIVERS_NET_RTWLAN) += rtwlan.o diff -

-git

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

utils/net/rtnet.in EOF · line 36

Quoted 11 lines

a/utils/net/rtnet.in b/utils/net/rtnet.in index f81a7bb..fa12a03 100644

utils/net/rtnet.in +0 -3
@@ -31,44 +31,68 @@ EOF
    }
 
    init_rtnet() {
-    modprobe rtnet >/dev/null || exit 1
-    modprobe rtipv4 >/dev/null || exit 1
-    modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit

1

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
utils/net/rtnet.in +13 -8
-
-    for dev in $REBIND_RT_NICS; do
-  if [ -d /sys/bus/pci/devices/$dev/driver ]; then
-      echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
-  fi
-  echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
-    done
+    if [ ! -d /proc/rtnet ]; then
+        modprobe rtnet >/dev/null || exit 1
+    fi
 
+    if [ ! -d /proc/rtnet/ipv4 ]; then
+        modprobe rtipv4 >/dev/null || exit 1
+    fi
        for PROTOCOL in $RT_PROTOCOLS; do
-  modprobe rt$PROTOCOL >/dev/null || exit 1
+        if [ ! -d /sys/modules/rt$PROTOCOL ]; then
+            if [ "$PROTOCOL" = "packet" ]; then
+                modprobe rt$PROTOCOL >/dev/null
+            else
+                modprobe rt$PROTOCOL >/dev/null || exit 1
+            fi
+        fi
        done
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

utils/net/rtnet.in EOF · line 53

Quoted 3 lines
utils/net/rtnet.in +3 -0
+    $(cat /proc/rtnet/devices | grep -q rteth0)
+    if [ $? -eq 1 ]; then
+        modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null ||

exit

Quoted 154 lines
Quoted 154 lines
Quoted 61 lines
Quoted 61 lines
Quoted 61 lines
Quoted 61 lines
utils/net/rtnet.in +32 -12
+ 1
+
+        for dev in $REBIND_RT_NICS; do
+            if [ -d /sys/bus/pci/devices/$dev/driver ]; then
+                echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
+            fi
+            echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
+        done
+    fi
+
        if [ $RT_LOOPBACK = "yes" ]; then
-  modprobe rt_loopback >/dev/null || exit 1
+        $(cat /proc/rtnet/devices | grep -q rtlo)
+        if [ $? -eq 1 ]; then
+
+            modprobe rt_loopback >/dev/null || exit 1
+        fi
        fi
 
-    if [ $RTCAP = "yes" ]; then
-  modprobe rtcap >/dev/null || exit 1
+    if [ $RTCAP = "yes" -a ! -d /sys/modules/rtcap ]; then
+        modprobe rtcap >/dev/null || exit 1
        fi
 
        if [ $RT_LOOPBACK = "yes" ]; then
-  $RTIFCONFIG rtlo up 127.0.0.1
+        $RTIFCONFIG rtlo up 127.0.0.1
        fi
 
        if [ $RTCAP = "yes" ]; then
-  ifconfig rteth0 up
-  ifconfig rteth0-mac up
-  if [ $RT_LOOPBACK = "yes" ]; then
-      ifconfig rtlo up
-  fi
+        ifconfig rteth0 up
+        ifconfig rteth0-mac up
+        if [ $RT_LOOPBACK = "yes" ]; then
+            ifconfig rtlo up
+        fi
        fi
 
-    modprobe rtcfg >/dev/null
-    modprobe rtmac >/dev/null
-    modprobe tdma >/dev/null
+    if [ ! -d /proc/rtnet/rtcfg ]; then
+        modprobe rtcfg >/dev/null
+    fi
+    if [ ! -d /proc/rtnet/rtmac ]; then
+        modprobe rtmac >/dev/null
+    fi
+    if [ ! -f /proc/tdma ]; then
+        modprobe tdma >/dev/null
+    fi
    }
 
    submit_cfg() {
@@ -336,34 +360,56 @@ case "$1" in
           ;;
 
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
utils/net/rtnet.in +0 -5
        capture)
-  modprobe rtnet >/dev/null || exit 1
-  modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
-  modprobe rtcap >/dev/null || exit 1
-  $RTIFCONFIG rteth0 up promisc
-  ifconfig rteth0 up
Quoted 8 lines
Quoted 8 lines

utils/net/rtnet.in case "$1" in · line 368

Quoted 8 lines
utils/net/rtnet.in +6 -2
-  ifconfig rteth0-mac up
-  ;;
+        if [ ! -d /proc/rtnet ]; then
+            modprobe rtnet >/dev/null || exit 1
+        fi
+        $(cat /proc/rtnet/devices | grep -q rteth0)
+        if [ $? -eq 1 ]; then
+            modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null ||

exit 1

Quoted 78 lines
Quoted 78 lines
Quoted 78 lines
Quoted 57 lines
utils/net/rtnet.in +35 -19
+        fi
+        if [ ! -d /sys/modules/rtcap ]; then
+            modprobe rtcap >/dev/null || exit 1
+        fi
+        $RTIFCONFIG rteth0 up promisc
+        ifconfig rteth0 up
+        ifconfig rteth0-mac up
+        ;;
 
        loopback)
-  modprobe rtnet >/dev/null || exit 1
-  modprobe rtipv4 >/dev/null || exit 1
-
-  for PROTOCOL in $RT_PROTOCOLS; do
-      modprobe rt$PROTOCOL >/dev/null || exit 1
-  done
-
-  modprobe rt_loopback >/dev/null || exit 1
-
-  if [ $RTCAP = "yes" ]; then
-      modprobe rtcap >/dev/null || exit 1
-  fi
-
-  $RTIFCONFIG rtlo up 127.0.0.1
-
-  if [ $RTCAP = "yes" ]; then
-      ifconfig rtlo up
-  fi
-  ;;
+        if [ ! -d /proc/rtnet ]; then
+            modprobe rtnet >/dev/null || exit 1
+        fi
+        if [ ! -d /proc/rtnet/ipv4 ]; then
+            modprobe rtipv4 >/dev/null || exit 1
+        fi
+        for PROTOCOL in $RT_PROTOCOLS; do
+            if [ ! -d /sys/modules/rt$PROTOCOL ]; then
+                if [ "$PROTOCOL" = "packet" ]; then
+                    modprobe rt$PROTOCOL >/dev/null
+                else
+                    modprobe rt$PROTOCOL >/dev/null || exit 1
+                fi
+            fi
+        done
+
+        if [ $RT_LOOPBACK = "yes" ]; then
+            $(cat /proc/rtnet/devices | grep -q rtlo)
+            if [ $? -eq 1 ]; then
+
+                modprobe rt_loopback >/dev/null || exit 1
+            fi
+        fi
+
+        if [ $RTCAP = "yes" -a ! -d /sys/modules/rtcap ]; then
+            modprobe rtcap >/dev/null || exit 1
+        fi

utils/net/rtnet.in case "$1" in · line 415

Quoted 10 lines
utils/net/rtnet.in +7 -0
+
+        $RTIFCONFIG rtlo up 127.0.0.1
+
+        if [ $RTCAP = "yes" ]; then
+            ifconfig rtlo up
+        fi
+        ;;
 
        *)
           usage

Could you check if this delta on top works as well?

utils/net/rtnet.in index renamed from utils/net/rtnet.in +0 -0

fa12a0378a..84f7eed00d 100644

utils/net/rtnet.in +0 -0
@@ -48,8 +48,7 @@ init_rtnet() {
           fi
       done
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

utils/net/rtnet.in init_rtnet() {

Quoted 4 lines
utils/net/rtnet.in +1 -2
-    $(cat /proc/rtnet/devices | grep -q rteth0)
-    if [ $? -eq 1 ]; then
+    if grep -vq rteth0 /proc/rtnet/devices; then
           modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null ||

exit

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

1

           for dev in $REBIND_RT_NICS; do @@ -61,9 +60,7 @@

init_rtnet() {
fi

Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

if [ $RT_LOOPBACK = "yes" ]; then

utils/net/rtnet.in +1 -3
-        $(cat /proc/rtnet/devices | grep -q rtlo)
-        if [ $? -eq 1 ]; then
-
+        if grep -vq rtlo /proc/rtnet/devices; then
               modprobe rt_loopback >/dev/null || exit 1
           fi
       fi
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

utils/net/rtnet.in case "$1" in · line 364

Quoted 8 lines
utils/net/rtnet.in +1 -2
@@ -363,8 +360,7 @@ case "$1" in
           if [ ! -d /proc/rtnet ]; then
               modprobe rtnet >/dev/null || exit 1
           fi
-        $(cat /proc/rtnet/devices | grep -q rteth0)
-        if [ $? -eq 1 ]; then
+        if grep -vq rteth0 /proc/rtnet/devices; then
               modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null ||

exit

Quoted 18 lines
Quoted 18 lines

1

Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
utils/net/rtnet.in +0 -0
           fi
           if [ ! -d /sys/modules/rtcap ]; then @@ -393,9 +389,7 @@

case "$1" in
done

if [ $RT_LOOPBACK = "yes" ]; then

utils/net/rtnet.in +1 -3
-            $(cat /proc/rtnet/devices | grep -q rtlo)
-            if [ $? -eq 1 ]; then
-
+            if grep -vq rtlo /proc/rtnet/devices; then
                   modprobe rt_loopback >/dev/null || exit 1
               fi
           fi

Then I would prefer it and would merge the combination to next. It looks safe and orthogonal enough for -rc2.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

Nah, not yet. We need to check the drivers first. At least the e1000 have non-static symbols that collide with the in-tree version.

Jan

Anyway, what you proposed does not work as there is an header line in

the

Quoted 1 line
Quoted 1 line

file which will match anyway (plus there is likely another network

interface

Quoted 6 lines
Quoted 6 lines

there too, causing your rule to fail.

Quoted 5 lines

We could replace that with :
grep -q rtlo /proc/rtnet/devices || modprobe rt_loopback >/dev/null || exit 1

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

I can send the patch back that way if that fits your rules.

Ah, yeah, not the same... But then do "if ! grep -q ...".

Regarding the symbol conflicts: Maybe we start with marking all drivers "depends m", and then dropping those step-wise which do not conflict

with

Quoted 1 line
Quoted 1 line

their upstream siblings. But it is important to check that by building both

into

Quoted 3 lines
Quoted 1 line

the kernel.

I have fixed some of the intel drivers to remove conflicts, can post those

patches when I got some time for cleaning up.

Quoted 1 line

TIA!

Quoted 1 line

How will the PCI-autobinding work, if two drivers support the same device?

Link-order?

Quoted 1 line
Quoted 7 lines

Would be my guess. But I also bet providing multiple drivers for the same bind match is a grey area in the kernel.

Quoted 1 line

Ideally I would want that all devices are bound to the linux driver at start, so

things like NFS root (over a secondary adapter) aren't affected.

This is where I would say: modular RT drivers, again.

I'd prefer being able to tag the rt_* drivers to not bind automatically.

I tested the patch and static rtnet seem to work so far. All devices are bound to the normal igb driver aswell.

I still have some trouble with my extended rt_igb driver not responding to AUXTS interrupts, but I am not willing to investigate further for now. Static rtnet + rt_igb module works.

Norbert
________________________________

This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.

ANDRITZ HYDRO GmbH

Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation

Firmensitz/ Registered seat: Wien

Firmenbuchgericht/ Court of registry: Handelsgericht Wien

Firmenbuchnummer/ Company registration: FN 61833 g

DVR: 0605077

UID-Nr.: ATU14756806

Thank You
________________________________