Skip to contentSkip to conversation

lib: add profinet and ethercat as link layer protocol

PATCH Applied Daniel Braunwarth 3 participants 7 messages Feb 28, 2022 – Mar 4, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover lib: add profinet and ethercat as link layer protocol

Update the llproto_names array to allow users to reference the PROFINET and EtherCAT protocols with the names 'profinet' and 'ethercat'.

These patches depends on the below referenced patch, which extends if_ether.h with the used ETH_P_xxx defines.

Daniel Braunwarth (2):
lib: add profinet and ethercat as link layer protocol names
tc: bash-completion: Add profinet and ethercat to procotol completion
list

 bash-completion/tc | 8 ++++----
 lib/ll_proto.c     | 2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

--
2.35.1

#1 lore raw

PATCH 1/2 lib: add profinet and ethercat as link layer protocol names

Update the llproto_names array to allow users to reference the PROFINET and EtherCAT protocols with the names 'profinet' and 'ethercat'.

---
 lib/ll_proto.c | 2 ++
 1 file changed, 2 insertions(+)
lib/ll_proto.c +2 -0
index 78179311..342ea2ee 100644
@@ -75,7 +75,9 @@ __PF(CONTROL,control)
 __PF(IRDA,irda)
 __PF(ECONET,econet)
 __PF(TIPC,tipc)
+__PF(PROFINET,profinet)
 __PF(AOE,aoe)
+__PF(ETHERCAT,ethercat)
 __PF(8021Q,802.1Q)
 __PF(8021AD,802.1ad)
 __PF(MPLS_UC,mpls_uc)

--
2.35.1

#2 lore raw

Re: [PATCH iproute2-next 1/2] lib: add profinet and ethercat as link layer protocol names

Quoted 4 lines · On Mon, 28 Feb 2022 14:45:19 +0100 Daniel Braunwarth <[email protected]>…

Update the llproto_names array to allow users to reference the PROFINET and EtherCAT protocols with the names 'profinet' and 'ethercat'.

This is legacy table. Original author did choose to use stanard file /etc/ethertypes. Not sure why??

#3 lore raw

Re: [PATCH iproute2-next 1/2] lib: add profinet and ethercat as link layer protocol names

Quoted 2 lines · Stephen Hemminger

This is legacy table. Original author did choose to use stanard file /etc/ethertypes. Not sure why??

I tried to extend /etc/ethertypes with the following line:
ETHERCAT 88A4 ethercat

I would expect the following command to successfully run:
tc filter add dev eno1 protocol ethercat matchall action drop

Unfortunately all I get is:
Error: argument "ethercat" is wrong: invalid protocol

With my patches applied, the command runs without any error.

I wasn't able to find any hint in the code, where /etc/ethertypes is supposed to be parsed. Could you give me a hint?

Thanks

Daniel

#4 lore raw

Re: [PATCH iproute2-next 1/2] lib: add profinet and ethercat as link layer protocol names

Quoted 16 lines · On Tue, 01 Mar 2022 18:26:10 +0000 [email protected] wrote:
Quoted 2 lines · Stephen Hemminger

This is legacy table. Original author did choose to use stanard file /etc/ethertypes. Not sure why??

I tried to extend /etc/ethertypes with the following line:
ETHERCAT 88A4 ethercat

I would expect the following command to successfully run:
tc filter add dev eno1 protocol ethercat matchall action drop

Unfortunately all I get is:
Error: argument "ethercat" is wrong: invalid protocol

With my patches applied, the command runs without any error.

Quoted 6 lines

I wasn't able to find any hint in the code, where /etc/ethertypes is supposed to be parsed. Could you give me a hint?

Thanks

Daniel

Right, iproute2 has its own built in table.

There is nothing that parses and loads ethertypes.
I am suggesting that there ought to read and cache the file; assuming it doesn't slow things down too much.

#5 lore raw

PATCH 2/2 tc: bash-completion: Add profinet and ethercat to procotol completion list

In reply to Daniel Braunwarth

Add the 'profinet' and 'ethercat' protocols to bash completion.

---
 bash-completion/tc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
bash-completion/tc +4 -4
index 086cb7f6..9f16d0d4 100644
@@ -127,10 +127,10 @@ _tc_direct_complete()
         protocol) # list comes from lib/ll_proto.c
             COMPREPLY+=( $( compgen -W ' 802.1Q 802.1ad 802_2 802_3 LLDP aarp \
                 all aoe arp atalk atmfate atmmpoa ax25 bpq can control cust \
-                ddcmp dec diag dna_dl dna_rc dna_rt econet ieeepup ieeepupat \
-                ip ipv4 ipv6 ipx irda lat localtalk loop mobitex ppp_disc \
-                ppp_mp ppp_ses ppptalk pup pupat rarp sca snap tipc tr_802_2 \
-                wan_ppp x25' -- "$cur" ) )
+                ddcmp dec diag dna_dl dna_rc dna_rt econet ethercat ieeepup \
+                ieeepupat ip ipv4 ipv6 ipx irda lat localtalk loop mobitex \
+                ppp_disc ppp_mp ppp_ses ppptalk profinet pup pupat rarp sca \
+                snap tipc tr_802_2 wan_ppp x25' -- "$cur" ) )
             return 0
             ;;
         prio)

--
2.35.1

#6 lore raw
In reply to Daniel Braunwarth
This series was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Hello:

This series was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Quoted 9 lines · On Mon, 28 Feb 2022 14:45:18 +0100 you wrote:

Update the llproto_names array to allow users to reference the PROFINET and EtherCAT protocols with the names 'profinet' and 'ethercat'.

These patches depends on the below referenced patch, which extends if_ether.h with the used ETH_P_xxx defines.

[...]

Here is the summary with links:
- [iproute2-next,1/2] lib: add profinet and ethercat as link layer protocol names

    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=75061b357f06
  - [iproute2-next,2/2] tc: bash-completion: Add profinet and ethercat to procotol completion list
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=712ec66e6f3e

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html