Skip to contentSkip to conversation

Problem with the promiscuous mode of RTnet

Xenomai Damien Lagneux 2 participants 5 messages May 4, 2015 – Sep 29, 2015 1 message not in the archive

lore
Share & tools
lore

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

#1 lore raw

Hi all,

I'm trying to adapt openPOWERLINK to RTnet. I'm using Xenomai 3.0-rc4, linux kernel 3.16.7, and the board I'm working with is an Armadeus apf6.

I have a problem with the promiscuous mode of the fec driver. It seems I can only receive packets which are addressed to the board.

I'm using the raw-ethernet and eth_p_all programs to test the promiscuous mode. If the destination MAC address used in the raw-ethernet program is the the broadcast address or the board's address, the eth_p_all program prints the messages. Otherwise, it doesn't print them.

I did set the interface rteth0 in promiscuous mode.

Does anyone have an idea what could the problem?

Thanks for your help,
Damien

#2 lore raw
Quoted 8 lines · Damien Lagneux

Hi all,

I'm trying to adapt openPOWERLINK to RTnet. I'm using Xenomai 3.0-rc4, linux kernel 3.16.7, and the board I'm working with is an Armadeus apf6.

I have a problem with the promiscuous mode of the fec driver. It seems I can only receive packets which are addressed to the board.

Quoted 8 lines

I'm using the raw-ethernet and eth_p_all programs to test the promiscuous mode. If the destination MAC address used in the raw-ethernet program is the the broadcast address or the board's address, the eth_p_all program prints the messages. Otherwise, it doesn't print them.

I did set the interface rteth0 in promiscuous mode.

Does anyone have an idea what could the problem?

How did you set the promiscuous mode ?

Signature · 1 line
					    Gilles.
#3 lore raw

Hi Gilles,

Thank you for your quick reply.

Here is the script I'm using to set RTnet:
#!/bin/sh

modprobe rtnet
modprobe rt_fec
modprobe rtpacket
modprobe rtudp
modprobe rtcap

rtifconfig rteth0 up 10.5.18.161 netmask 255.255.0.0 promisc ifconfig rteth0 up

Damien

----- Mail original -----

Quoted 35 lines

De: "Gilles Chanteperdrix" <[email protected]> À: "Damien Lagneux" <[email protected]>
Cc: [email protected]
Envoyé: Lundi 4 Mai 2015 11:47:45
Objet: Re: [Xenomai] Problem with the promiscuous mode of RTnet

Quoted 19 lines · Damien Lagneux

Hi all,

I'm trying to adapt openPOWERLINK to RTnet. I'm using Xenomai 3.0-rc4,
linux kernel 3.16.7, and the board I'm working with is an Armadeus apf6.

I have a problem with the promiscuous mode of the fec driver. It seems I
can only receive packets which are addressed to the board.

I'm using the raw-ethernet and eth_p_all programs to test the promiscuous
mode. If the destination MAC address used in the raw-ethernet program
is the the broadcast address or the board's address, the eth_p_all program
prints the messages. Otherwise, it doesn't print them.

Quoted 3 lines

I did set the interface rteth0 in promiscuous mode.

Does anyone have an idea what could the problem?

How did you set the promiscuous mode ?

--
Gilles.

#4 lore raw
Quoted 7 lines · Damien Lagneux

Hi Gilles,

Thank you for your quick reply.

Here is the script I'm using to set RTnet:
#!/bin/sh

Quoted 7 lines

modprobe rtnet
modprobe rt_fec
modprobe rtpacket
modprobe rtudp
modprobe rtcap

rtifconfig rteth0 up 10.5.18.161 netmask 255.255.0.0 promisc

I do not see anything wrong in the code. rtifconfig seems to ask the IFF_PROMISC flag to be set for the driver, and the driver code seems to take this flag into account. So I guess you will have to trace the path from rtifconfig to the driver code to see where the information gets lost.

Quoted 1 line

ifconfig rteth0 up

Note that what you are doing here is enabling the rtcap interface (which is a plain linux interface, and not the rtnet interface), you may want to avoid doing that in a first step, in case it fiddles with the promisc bit too.

Signature · 1 line
					    Gilles.
#5 lore raw
In reply to Damien Lagneux
Quoted 8 lines · Damien Lagneux

Hi all,

I'm trying to adapt openPOWERLINK to RTnet. I'm using Xenomai 3.0-rc4, linux kernel 3.16.7, and the board I'm working with is an Armadeus apf6.

I have a problem with the promiscuous mode of the fec driver. It seems I can only receive packets which are addressed to the board.

Quoted 8 lines

I'm using the raw-ethernet and eth_p_all programs to test the promiscuous mode. If the destination MAC address used in the raw-ethernet program is the the broadcast address or the board's address, the eth_p_all program prints the messages. Otherwise, it doesn't print them.

I did set the interface rteth0 in promiscuous mode.

Does anyone have an idea what could the problem?

Ok, I had a closer look, and in fact, if you are really talking about kernel/drivers/net/drivers/fec.c, setting up the hardware filtering is done in the function set_multicast_list, but this function is not even compiled. What you can try is to uncomment the part of that function you are interested in, and forcibly call it at the end of fec_enet_open, as in the following patch:

kernel/drivers/net/drivers/fec.c +5 -2
index 8577c89..3c275ec 100644
@@ -1299,6 +1299,8 @@ static int fec_enet_alloc_buffers(struct rtnet_device *ndev)
 	return 0;
 }
 
+static void set_multicast_list(struct rtnet_device *ndev)
+
 static int
 fec_enet_open(struct rtnet_device *ndev)
 {
@@ -1325,6 +1327,7 @@ fec_enet_open(struct rtnet_device *ndev)
 	phy_start(fep->phy_dev);
 	rtnetif_start_queue(ndev);
 	fep->opened = 1;
+	set_multicast_list(ndev);
 	return 0;
 }
 
@@ -1351,7 +1354,6 @@ fec_enet_close(struct rtnet_device *ndev)
 	return 0;
 }
 
-#ifdef CONFIG_XENO_DRIVERS_NET_MULTICAST
 /* Set or clear the multicast filter for this adaptor.
  * Skeleton taken from sunlance driver.
  * The CPM Ethernet implementation allows Multicast as well as individual
@@ -1383,6 +1385,7 @@ static void set_multicast_list(struct rtnet_device *ndev)
 	tmp &= ~0x8;
 	writel(tmp, fep->hwp + FEC_R_CNTRL);
 
+#ifdef CONFIG_XENO_DRIVERS_NET_MULTICAST
 	if (ndev->flags & IFF_ALLMULTI) {
 		/* Catch all multicast addresses, so set the
 		 * filter to all 1's
@@ -1425,8 +1428,8 @@ static void set_multicast_list(struct rtnet_device *ndev)
 			writel(tmp, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
 		}
 	}
-}
 #endif /* CONFIG_XENO_DRIVERS_NET_MULTICAST */
+}
 
 #ifdef ORIGINAL_CODE
 /* Set a MAC change in hardware. */

Note however that I could not get that driver to compile in my build environment. So, this patch is untested and is all I can do for now. If you have some patches to submit to get the driver building and working, I am interested. I will come back on this issue later.

Regards.

Signature · 2 lines
					    Gilles.
https://click-hack.org