tc: m_ife: handle IFE ethertype value
Subsystems (2)
cover tc: m_ife: handle IFE ethertype value
Hi,
this patch series fix some ife type handling for example it allows to set ethertype to zero and prints IFE type like IEE specification.
Also it will report about the new introduced IFE type as fallback if no IFE type as parameter is given. This new behaviour is also added to the manpage of tc-ife.
Note: Please wait until the related kernel patches comes in. This patch series contains an UAPI change which need to be accepted by netdev at first. Thanks.
- Alex
Alexander Aring (4):
tc: m_ife: allow ife type to zero
tc: m_ife: print IEEE ethertype format
tc: m_ife: report about kernels default type
man: tc-ife: add default type note
man/man8/tc-ife.8 | 2 +- tc/m_ife.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/4 tc: m_ife: allow ife type to zero
This patch allows to set an ethertype for IFE which is zero. There is no kernel side validation which forbids a type to zero.
--- tc/m_ife.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tc/m_ife.c +3 -1
@@ -63,6 +63,7 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,char dbuf[ETH_ALEN ];char sbuf[ETH_ALEN ];__u16 ife_type =0 ; +int user_type =0 ;__u32 ife_prio =0 ;__u32 ife_prio_v =0 ;__u32 ife_mark =0 ;
@@ -125,6 +126,7 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,if (get_u16 (&ife_type, *argv,0 ))invarg ("ife type is invalid" , *argv);fprintf (stderr,"IFE type 0x%x\n" , ife_type); + user_type =1 ; }else if (matches (*argv,"dst" ) ==0 ) {NEXT_ARG (); daddr = *argv;
@@ -185,7 +187,7 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,if (daddr)addattr_l (n,MAX_MSG ,TCA_IFE_DMAC , dbuf,ETH_ALEN ); -if (ife_type) +if (user_type)addattr_l (n,MAX_MSG ,TCA_IFE_TYPE , &ife_type,2 );if (saddr)addattr_l (n,MAX_MSG ,TCA_IFE_SMAC , sbuf,ETH_ALEN );
Signature · 1 line
2.11.0
Re: [PATCH iproute2 1/4] tc: m_ife: allow ife type to zero
Quoted 13 lines · On Mon, 28 Aug 2017 15:07:35 -0400 Alexander Aring <[email protected]> wrote:
This patch allows to set an ethertype for IFE which is zero. There is no kernel side validation which forbids a type to zero.
Signed-off-by Alexander Aring <[email protected]>--- tc/m_ife.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)tc/m_ife.c +0
-0
tc/m_ife.c static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p, · line 66
Quoted 4 lines
tc/m_ife.c +1
-0@@ -63,6 +63,7 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,char dbuf[ETH_ALEN ];char sbuf[ETH_ALEN ];__u16 ife_type =0 ; +int user_type =0 ;
Please use bool if it is a flag value
Re: [PATCH iproute2 1/4] tc: m_ife: allow ife type to zero
In reply to Alexander AringQuoted 4 lines · Alexander Aring
This patch allows to set an ethertype for IFE which is zero. There is no kernel side validation which forbids a type to zero.
Signed-off-by Alexander Aring <[email protected]>
cheers,
jamal
PATCH 2/4 tc: m_ife: print IEEE ethertype format
In reply to Alexander AringThis patch uses the usually IEEE format to display an ethertype which is 4-digits and every digit in upper case.
--- tc/m_ife.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tc/m_ife.c +1 -1
@@ -125,7 +125,7 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,NEXT_ARG ();if (get_u16 (&ife_type, *argv,0 ))invarg ("ife type is invalid" , *argv); -fprintf (stderr,"IFE type 0x%x\n" , ife_type); +fprintf (stderr,"IFE type 0x%04X\n" , ife_type); user_type =1 ; }else if (matches (*argv,"dst" ) ==0 ) {NEXT_ARG ();
Signature · 1 line
2.11.0
Re: [PATCH iproute2 2/4] tc: m_ife: print IEEE ethertype format
Quoted 13 lines · On Mon, 28 Aug 2017 15:07:36 -0400 Alexander Aring <[email protected]> wrote:
This patch uses the usually IEEE format to display an ethertype which is 4-digits and every digit in upper case.
Signed-off-by Alexander Aring <[email protected]>--- tc/m_ife.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tc/m_ife.c +0
-0
tc/m_ife.c static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p, · line 131
Quoted 8 lines
tc/m_ife.c +1
-1@@ -125,7 +125,7 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,NEXT_ARG ();if (get_u16 (&ife_type, *argv,0 ))invarg ("ife type is invalid" , *argv); -fprintf (stderr,"IFE type 0x%x\n" , ife_type); +fprintf (stderr,"IFE type 0x%04X\n" , ife_type); user_type =1 ; }else if (matches (*argv,"dst" ) ==0 ) {NEXT_ARG ();
Why upper case?
Re: [PATCH iproute2 2/4] tc: m_ife: print IEEE ethertype format
In reply to Alexander AringAlex,
I think we should get rid of these fprintfs instead of fixing them. They were originally intended to be debug outputs.
cheers,
jamal
Quoted 22 lines · Alexander Aring
This patch uses the usually IEEE format to display an ethertype which is 4-digits and every digit in upper case.
Signed-off-by Alexander Aring <[email protected]>--- tc/m_ife.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tc/m_ife.c +1
-1@@ -125,7 +125,7 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,NEXT_ARG ();if (get_u16 (&ife_type, *argv,0 ))invarg ("ife type is invalid" , *argv); -fprintf (stderr,"IFE type 0x%x\n" , ife_type); +fprintf (stderr,"IFE type 0x%04X\n" , ife_type); user_type =1 ; }else if (matches (*argv,"dst" ) ==0 ) {NEXT_ARG ();
Re: [PATCH iproute2 2/4] tc: m_ife: print IEEE ethertype format
Quoted 17 lines · On Mon, 28 Aug 2017 18:18:04 -0400 Jamal Hadi Salim <[email protected]> wrote:
Alex,
I think we should get rid of these fprintfs instead of fixing them. They were originally intended to be debug outputs.
cheers,
jamalQuoted 8 lines · Alexander Aring
This patch uses the usually IEEE format to display an ethertype which is 4-digits and every digit in upper case.
Signed-off-by Alexander Aring <[email protected]>--- tc/m_ife.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
Quoted 6 lines
tc/m_ife.c +0
-0tc/m_ife.c static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p, · line 131
Quoted 8 lines
tc/m_ife.c +1
-1@@ -125,7 +125,7 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,NEXT_ARG ();if (get_u16 (&ife_type, *argv,0 ))invarg ("ife type is invalid" , *argv); -fprintf (stderr,"IFE type 0x%x\n" , ife_type); +fprintf (stderr,"IFE type 0x%04X\n" , ife_type); user_type =1 ; }else if (matches (*argv,"dst" ) ==0 ) {NEXT_ARG ();
For iproute commands the show output is supposed to match the corresponding set inputs.
Re: [PATCH iproute2 2/4] tc: m_ife: print IEEE ethertype format
Quoted 1 line · Stephen Hemminger
On Mon, 28 Aug 2017 18:18:04 -0400
[..]
Quoted 13 lines
Quoted 11 lines
tc/m_ife.c static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p, · line 131
Quoted 10 lines
tc/m_ife.c +1
-1@@ -125,7 +125,7 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,NEXT_ARG ();if (get_u16 (&ife_type, *argv,0 ))invarg ("ife type is invalid" , *argv); -fprintf (stderr,"IFE type 0x%x\n" , ife_type); +fprintf (stderr,"IFE type 0x%04X\n" , ife_type); user_type =1 ; }else if (matches (*argv,"dst" ) ==0 ) {NEXT_ARG ();
Quoted 2 lines
For iproute commands the show output is supposed to match the corresponding set inputs.
These were being printed at parse time ...
cheers,
jamal
PATCH 3/4 tc: m_ife: report about kernels default type
In reply to Alexander AringThis patch will report about if the ethertype for IFE is not specified that the default IFE type is used.
--- tc/m_ife.c | 2 ++ 1 file changed, 2 insertions(+)
tc/m_ife.c +2 -0
@@ -189,6 +189,8 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,addattr_l (n,MAX_MSG ,TCA_IFE_DMAC , dbuf,ETH_ALEN );if (user_type)addattr_l (n,MAX_MSG ,TCA_IFE_TYPE , &ife_type,2 ); +else +fprintf (stderr,"IFE type 0x%04X\n" ,ETH_P_IFE );if (saddr)addattr_l (n,MAX_MSG ,TCA_IFE_SMAC , sbuf,ETH_ALEN );
Signature · 1 line
2.11.0
Re: [PATCH iproute2 3/4] tc: m_ife: report about kernels default type
Same comment as previous patch.
cheers,
jamal
Quoted 22 lines · Alexander Aring
This patch will report about if the ethertype for IFE is not specified that the default IFE type is used.
Signed-off-by Alexander Aring <[email protected]>--- tc/m_ife.c | 2 ++ 1 file changed, 2 insertions(+)tc/m_ife.c +2
-0@@ -189,6 +189,8 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,addattr_l (n,MAX_MSG ,TCA_IFE_DMAC , dbuf,ETH_ALEN );if (user_type)addattr_l (n,MAX_MSG ,TCA_IFE_TYPE , &ife_type,2 ); +else +fprintf (stderr,"IFE type 0x%04X\n" ,ETH_P_IFE );if (saddr)addattr_l (n,MAX_MSG ,TCA_IFE_SMAC , sbuf,ETH_ALEN );
PATCH 4/4 man: tc-ife: add default type note
In reply to Alexander AringThis patch updates the tc-ife man page that the default IFE ethertype will be used if it's not specified.
--- man/man8/tc-ife.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
man/man8/tc-ife.8 +1 -1
@@ -82,7 +82,7 @@ is required only when Optional six byte destination or source MAC address to encode. .TP .BI type " TYPE" -Optional 16-bit ethertype to encode. +Optional 16-bit ethertype to encode. If not specified value of 0xED3E will be used. .TP .BI CONTROL Action to take following an encode/decode.
Signature · 1 line
2.11.0
Re: [PATCH iproute2 4/4] man: tc-ife: add default type note
Quoted 4 lines · Alexander Aring
This patch updates the tc-ife man page that the default IFE ethertype will be used if it's not specified.
Signed-off-by Alexander Aring <[email protected]>
cheers,
jamal