net: dcb: match dcb_app protocol field with 802.1Qaz spec
Subsystems (2)
PATCH 1/3 net: dcb: match dcb_app protocol field with 802.1Qaz spec
The dcb_app protocol field is a __u32 however the 802.1Qaz specification defines it as a 16 bit field. This patch brings the structure inline with the spec making it a __u16.
---
include/linux/dcbnl.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/dcbnl.h +1 -1
@@ -101,7 +101,7 @@ struct ieee_pfc {*/ struct dcb_app {__u8 selector; -__u32 protocol; +__u16 protocol;__u8 priority; };
PATCH 2/3 net: dcb: use _safe() version of list iterators
Use _safe() version of list iterator macros in dcb_setapp().
---
net/dcb/dcbnl.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
net/dcb/dcbnl.c +3 -3
@@ -1605,18 +1605,18 @@ u8 dcb_getapp(struct net_device *dev, struct dcb_app *app)EXPORT_SYMBOL (dcb_getapp);/** -* ixgbe_dcbnl_setapp - add dcb application data to app list +* dcbnl_setapp - add dcb application data to app list * * Priority 0 is the default priority this removes applications * from the app list if the priority is set to zero. */ u8 dcb_setapp (struct net_device *dev,struct dcb_app *new) { -struct dcb_app_type *itr; +struct dcb_app_type *itr, *tmp;spin_lock (&dcb_lock);/* Search for existing match and replace */ -list_for_each_entry (itr, &dcb_app_list, list) { +list_for_each_entry_safe (itr, tmp, &dcb_app_list, list) {if (itr->app.selector == new->selector && itr->app.protocol == new->protocol && (strncmp (itr->name, dev->name,IFNAMSIZ ) ==0 )) {
David Miller
maintainerRe: [net-2.6 PATCH 2/3] net: dcb: use _safe() version of list iterators
From: John Fastabend <[email protected]>
Date: Mon, 31 Jan 2011 14:00:54 -0800
Quoted 3 lines
Use
_safe()version of list iterator macros indcb_setapp().Signed-off-by John Fastabend <[email protected]>
Why? It's unnecessary overhead, since we always branch to "out", and therefore out of the list traversal loop, any time we list_del() something on the list.
Re: [net-2.6 PATCH 2/3] net: dcb: use _safe() version of list iterators
Quoted 10 lines · David Miller
From: John Fastabend <[email protected]>
Date: Mon, 31 Jan 2011 14:00:54 -0800Quoted 3 lines
Use
_safe()version of list iterator macros indcb_setapp().Signed-off-by John Fastabend <[email protected]>Why? It's unnecessary overhead, since we always branch to "out", and therefore out of the list traversal loop, any time we
list_del()something on the list.
Of course you are right there is no reason for this. Thanks.
PATCH 3/3 net: dcb: application priority is per net_device
In reply to John FastabendThe app_data priority may not be the same for all net devices. In order for stacks with application notifiers to identify the specific net device dcb_app_type should be passed in the ptr.
This allows handlers to use dev_get_by_name() to pin priority to net devices.
---
net/dcb/dcbnl.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
net/dcb/dcbnl.c +5 -1
@@ -1613,6 +1613,10 @@ EXPORT_SYMBOL(dcb_getapp);u8 dcb_setapp (struct net_device *dev,struct dcb_app *new) {struct dcb_app_type *itr, *tmp; +struct dcb_app_type event; + +memcpy (&event.name, dev->name,sizeof (event.name)); +memcpy (&event.app, new,sizeof (event.app));spin_lock (&dcb_lock);/* Search for existing match and replace */
@@ -1644,7 +1648,7 @@ u8 dcb_setapp(struct net_device *dev, struct dcb_app *new) } out:spin_unlock (&dcb_lock); -call_dcbevent_notifiers (DCB_APP_EVENT , new); +call_dcbevent_notifiers (DCB_APP_EVENT , &event);return 0 ; }EXPORT_SYMBOL (dcb_setapp);
David Miller
maintainerRe: [net-2.6 PATCH 3/3] net: dcb: application priority is per net_device
From: John Fastabend <[email protected]>
Date: Mon, 31 Jan 2011 14:00:59 -0800
Quoted 8 lines
The
app_datapriority may not be the same for all net devices. In order for stacks with application notifiers to identify the specific net devicedcb_app_typeshould be passed in the ptr.This allows handlers to use
dev_get_by_name()to pin priority to net devices.Signed-off-by John Fastabend <[email protected]>
Given your track record with the previous two patches (ie. they need work or are nonsense) I want someone who understands this dcbnl stuff to review this third patch before I'm willing to apply it.
Re: [net-2.6 PATCH 3/3] net: dcb: application priority is per net_device
In reply to John FastabendFrom: John Fastabend <[email protected]>
Date: Mon, 31 Jan 2011 14:00:59 -0800
Quoted 8 lines
The
app_datapriority may not be the same for all net devices. In order for stacks with application notifiers to identify the specific net devicedcb_app_typeshould be passed in the ptr.This allows handlers to use
dev_get_by_name()to pin priority to net devices.Signed-off-by John Fastabend <[email protected]>
Applied.
David Miller
maintainerFrom: John Fastabend <[email protected]>
Date: Mon, 31 Jan 2011 14:00:49 -0800
Quoted 5 lines
The
dcb_appprotocol field is a__u32however the 802.1Qaz specification defines it as a 16 bit field. This patch brings the structure inline with the spec making it a__u16.Signed-off-by John Fastabend <[email protected]>
...
include/linux/dcbnl.h struct ieee_pfc { · line 107
Quoted 9 lines
include/linux/dcbnl.h +1
-1@@ -101,7 +101,7 @@ struct ieee_pfc {*/ struct dcb_app {__u8 selector; -__u32 protocol; +__u16 protocol;__u8 priority; };
If we're going to do this, please fix this wasteful structure layout. Put the "protocol" either first, or last, so that the structure size is 4 bytes, rather than something like 8.
Quoted 9 lines · David Miller
From: John Fastabend <[email protected]>
Date: Mon, 31 Jan 2011 14:00:49 -0800Quoted 5 lines
The
dcb_appprotocol field is a__u32however the 802.1Qaz specification defines it as a 16 bit field. This patch brings the structure inline with the spec making it a__u16.Signed-off-by John Fastabend <[email protected]>...
Quoted 13 lines
include/linux/dcbnl.h struct ieee_pfc { · line 107
Quoted 9 lines
include/linux/dcbnl.h +1
-1@@ -101,7 +101,7 @@ struct ieee_pfc {*/ struct dcb_app {__u8 selector; -__u32 protocol; +__u16 protocol;__u8 priority; };If we're going to do this, please fix this wasteful structure layout. Put the "protocol" either first, or last, so that the structure size is 4 bytes, rather than something like 8.
OK I will fix this. Thanks