netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] vlan: add proto for vlan proc interface
@ 2014-03-07 12:10 Ding Tianhong
  2014-03-07 12:10 ` [PATCH net-next 1/2] vlan: add proto for " Ding Tianhong
  2014-03-07 12:10 ` [PATCH net-next 2/2] vlan: add proto and regulate the /proc/net/vlan/config Ding Tianhong
  0 siblings, 2 replies; 5+ messages in thread
From: Ding Tianhong @ 2014-03-07 12:10 UTC (permalink / raw)
  To: kaber, davem; +Cc: netdev

Ding Tianhong (2):
  vlan: add proto for proc interface
  vlan: add proto and regulate the /proc/net/vlan/config

 net/8021q/vlanproc.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

-- 
1.8.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/2] vlan: add proto for proc interface
  2014-03-07 12:10 [PATCH net-next 0/2] vlan: add proto for vlan proc interface Ding Tianhong
@ 2014-03-07 12:10 ` Ding Tianhong
  2014-03-07 12:15   ` Patrick McHardy
  2014-03-07 12:10 ` [PATCH net-next 2/2] vlan: add proto and regulate the /proc/net/vlan/config Ding Tianhong
  1 sibling, 1 reply; 5+ messages in thread
From: Ding Tianhong @ 2014-03-07 12:10 UTC (permalink / raw)
  To: kaber, davem; +Cc: netdev

The vlan could support 2 proto: 802.1q and 802.1ad, so add it to
proc interface, the user could easily distinguish the proto for
each vlan dev.

And the dev->priv_flags seems inappropriate, modify to Priv_Flags,
looks more comfortable.

---------------------- the old format: --------------------------

eth2.10  VID: 10         REORDER_HDR: 1  dev->priv_flags: 1
         total frames received            5
          total bytes received          336
      Broadcast/Multicast Rcvd            0

      total frames transmitted           13
       total bytes transmitted         1026
Device: eth2
INGRESS priority mappings: 0:0  1:0  2:0  3:0  4:0  5:0  6:0 7:0
 EGRESS priority mappings:

----------------------- the new format: -------------------------

eth2.20  Proto: 802.1q  VID: 20  REORDER_HDR: 1  Priv_Flags: 1
         total frames received            0
          total bytes received            0
      Broadcast/Multicast Rcvd            0

      total frames transmitted            0
       total bytes transmitted            0
Device: eth2
INGRESS priority mappings: 0:0  1:0  2:0  3:0  4:0  5:0  6:0 7:0
 EGRESS priority mappings:

----------------------------------------------------------------

Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 net/8021q/vlanproc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index 1d0e8921..a40abbc 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -285,8 +285,10 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset)
 
 	stats = dev_get_stats(vlandev, &temp);
 	seq_printf(seq,
-		   "%s  VID: %d	 REORDER_HDR: %i  dev->priv_flags: %hx\n",
-		   vlandev->name, vlan->vlan_id,
+		   "%s  Proto: %s  VID: %d  REORDER_HDR: %i  Priv_Flags: %hx\n",
+		   vlandev->name,
+		   vlan->vlan_proto == htons(ETH_P_8021Q) ? "802.1q" : "802.1ad",
+		   vlan->vlan_id,
 		   (int)(vlan->flags & 1), vlandev->priv_flags);
 
 	seq_printf(seq, fmt64, "total frames received", stats->rx_packets);
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/2] vlan: add proto and regulate the /proc/net/vlan/config
  2014-03-07 12:10 [PATCH net-next 0/2] vlan: add proto for vlan proc interface Ding Tianhong
  2014-03-07 12:10 ` [PATCH net-next 1/2] vlan: add proto for " Ding Tianhong
@ 2014-03-07 12:10 ` Ding Tianhong
  1 sibling, 0 replies; 5+ messages in thread
From: Ding Tianhong @ 2014-03-07 12:10 UTC (permalink / raw)
  To: kaber, davem; +Cc: netdev

The vlan support 2 proto: 802.1q and 802.1ad, so add it
to /proc/net/vlan/config, and the old format seems inappropriate,
regulate it.

---------------------- the old format: --------------------------

VLAN Dev name    | VLAN ID
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
eth2.5         | 5  | eth2
eth2.5.100     | 100  | eth2.5
eth2.5.20      | 20  | eth2.5

----------------------- the new format: -------------------------

VLAN Dev Name  | Proto   | VID  | Real Dev
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
eth2.1000      | 802.1ad | 1000 | eth2
eth2.5         | 802.1ad | 5    | eth2
eth2.5.20      | 802.1ad | 20   | eth2.5

-----------------------------------------------------------------

Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 net/8021q/vlanproc.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index a40abbc..e571347 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -254,7 +254,7 @@ static int vlan_seq_show(struct seq_file *seq, void *v)
 	if (v == SEQ_START_TOKEN) {
 		const char *nmtype = NULL;
 
-		seq_puts(seq, "VLAN Dev name	 | VLAN ID\n");
+		seq_puts(seq, "VLAN Dev Name  | Proto   | VID  | Real Dev\n");
 
 		if (vn->name_type < ARRAY_SIZE(vlan_name_type_str))
 		    nmtype =  vlan_name_type_str[vn->name_type];
@@ -265,8 +265,11 @@ static int vlan_seq_show(struct seq_file *seq, void *v)
 		const struct net_device *vlandev = v;
 		const struct vlan_dev_priv *vlan = vlan_dev_priv(vlandev);
 
-		seq_printf(seq, "%-15s| %d  | %s\n",  vlandev->name,
-			   vlan->vlan_id,    vlan->real_dev->name);
+		seq_printf(seq, "%-15s| %s | %-4d | %s\n",
+			   vlandev->name,
+			   vlan->vlan_proto == htons(ETH_P_8021Q) ?
+			   "802.1q" : "802.1ad",
+			   vlan->vlan_id, vlan->real_dev->name);
 	}
 	return 0;
 }
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 1/2] vlan: add proto for proc interface
  2014-03-07 12:10 ` [PATCH net-next 1/2] vlan: add proto for " Ding Tianhong
@ 2014-03-07 12:15   ` Patrick McHardy
  2014-03-10  1:33     ` Ding Tianhong
  0 siblings, 1 reply; 5+ messages in thread
From: Patrick McHardy @ 2014-03-07 12:15 UTC (permalink / raw)
  To: Ding Tianhong; +Cc: davem, netdev

On Fri, Mar 07, 2014 at 08:10:50PM +0800, Ding Tianhong wrote:
> The vlan could support 2 proto: 802.1q and 802.1ad, so add it to
> proc interface, the user could easily distinguish the proto for
> each vlan dev.
> 
> And the dev->priv_flags seems inappropriate, modify to Priv_Flags,
> looks more comfortable.

The proc interface is obsolete, but this doesn't mean you're allowed
to break it. This information is available through netlink. The proc
interface should not be touched.

Nacked-by: Patrick McHardy <kaber@trash.net>

> 
> ---------------------- the old format: --------------------------
> 
> eth2.10  VID: 10         REORDER_HDR: 1  dev->priv_flags: 1
>          total frames received            5
>           total bytes received          336
>       Broadcast/Multicast Rcvd            0
> 
>       total frames transmitted           13
>        total bytes transmitted         1026
> Device: eth2
> INGRESS priority mappings: 0:0  1:0  2:0  3:0  4:0  5:0  6:0 7:0
>  EGRESS priority mappings:
> 
> ----------------------- the new format: -------------------------
> 
> eth2.20  Proto: 802.1q  VID: 20  REORDER_HDR: 1  Priv_Flags: 1
>          total frames received            0
>           total bytes received            0
>       Broadcast/Multicast Rcvd            0
> 
>       total frames transmitted            0
>        total bytes transmitted            0
> Device: eth2
> INGRESS priority mappings: 0:0  1:0  2:0  3:0  4:0  5:0  6:0 7:0
>  EGRESS priority mappings:
> 
> ----------------------------------------------------------------
> 
> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> ---
>  net/8021q/vlanproc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
> index 1d0e8921..a40abbc 100644
> --- a/net/8021q/vlanproc.c
> +++ b/net/8021q/vlanproc.c
> @@ -285,8 +285,10 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset)
>  
>  	stats = dev_get_stats(vlandev, &temp);
>  	seq_printf(seq,
> -		   "%s  VID: %d	 REORDER_HDR: %i  dev->priv_flags: %hx\n",
> -		   vlandev->name, vlan->vlan_id,
> +		   "%s  Proto: %s  VID: %d  REORDER_HDR: %i  Priv_Flags: %hx\n",
> +		   vlandev->name,
> +		   vlan->vlan_proto == htons(ETH_P_8021Q) ? "802.1q" : "802.1ad",
> +		   vlan->vlan_id,
>  		   (int)(vlan->flags & 1), vlandev->priv_flags);
>  
>  	seq_printf(seq, fmt64, "total frames received", stats->rx_packets);
> -- 
> 1.8.0
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 1/2] vlan: add proto for proc interface
  2014-03-07 12:15   ` Patrick McHardy
@ 2014-03-10  1:33     ` Ding Tianhong
  0 siblings, 0 replies; 5+ messages in thread
From: Ding Tianhong @ 2014-03-10  1:33 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: davem, netdev

On 2014/3/7 20:15, Patrick McHardy wrote:
> On Fri, Mar 07, 2014 at 08:10:50PM +0800, Ding Tianhong wrote:
>> The vlan could support 2 proto: 802.1q and 802.1ad, so add it to
>> proc interface, the user could easily distinguish the proto for
>> each vlan dev.
>>
>> And the dev->priv_flags seems inappropriate, modify to Priv_Flags,
>> looks more comfortable.
> 
> The proc interface is obsolete, but this doesn't mean you're allowed
> to break it. This information is available through netlink. The proc
> interface should not be touched.
> 
> Nacked-by: Patrick McHardy <kaber@trash.net>
> 

Ok, agree.

>>
>> ---------------------- the old format: --------------------------
>>
>> eth2.10  VID: 10         REORDER_HDR: 1  dev->priv_flags: 1
>>          total frames received            5
>>           total bytes received          336
>>       Broadcast/Multicast Rcvd            0
>>
>>       total frames transmitted           13
>>        total bytes transmitted         1026
>> Device: eth2
>> INGRESS priority mappings: 0:0  1:0  2:0  3:0  4:0  5:0  6:0 7:0
>>  EGRESS priority mappings:
>>
>> ----------------------- the new format: -------------------------
>>
>> eth2.20  Proto: 802.1q  VID: 20  REORDER_HDR: 1  Priv_Flags: 1
>>          total frames received            0
>>           total bytes received            0
>>       Broadcast/Multicast Rcvd            0
>>
>>       total frames transmitted            0
>>        total bytes transmitted            0
>> Device: eth2
>> INGRESS priority mappings: 0:0  1:0  2:0  3:0  4:0  5:0  6:0 7:0
>>  EGRESS priority mappings:
>>
>> ----------------------------------------------------------------
>>
>> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
>> ---
>>  net/8021q/vlanproc.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
>> index 1d0e8921..a40abbc 100644
>> --- a/net/8021q/vlanproc.c
>> +++ b/net/8021q/vlanproc.c
>> @@ -285,8 +285,10 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset)
>>  
>>  	stats = dev_get_stats(vlandev, &temp);
>>  	seq_printf(seq,
>> -		   "%s  VID: %d	 REORDER_HDR: %i  dev->priv_flags: %hx\n",
>> -		   vlandev->name, vlan->vlan_id,
>> +		   "%s  Proto: %s  VID: %d  REORDER_HDR: %i  Priv_Flags: %hx\n",
>> +		   vlandev->name,
>> +		   vlan->vlan_proto == htons(ETH_P_8021Q) ? "802.1q" : "802.1ad",
>> +		   vlan->vlan_id,
>>  		   (int)(vlan->flags & 1), vlandev->priv_flags);
>>  
>>  	seq_printf(seq, fmt64, "total frames received", stats->rx_packets);
>> -- 
>> 1.8.0
>>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> .
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-03-10  1:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-07 12:10 [PATCH net-next 0/2] vlan: add proto for vlan proc interface Ding Tianhong
2014-03-07 12:10 ` [PATCH net-next 1/2] vlan: add proto for " Ding Tianhong
2014-03-07 12:15   ` Patrick McHardy
2014-03-10  1:33     ` Ding Tianhong
2014-03-07 12:10 ` [PATCH net-next 2/2] vlan: add proto and regulate the /proc/net/vlan/config Ding Tianhong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).