Skip to contentSkip to conversation

net: dcb: match dcb_app protocol field with 802.1Qaz spec

PATCH Applied John Fastabend 2 participants 9 messages Jan 31, 2011 – Feb 13, 2011

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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
index 68cd248..bdc7ef4 100644
@@ -101,7 +101,7 @@ struct ieee_pfc {
  */
 struct dcb_app {
 	__u8	selector;
-	__u32	protocol;
+	__u16	protocol;
 	__u8	priority;
 };
 
#1 lore raw

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
index 6b03f56..e3399d6 100644
@@ -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)) {
maintainer
#2 lore raw

Re: [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 in dcb_setapp().

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.

#3 lore raw

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 -0800

Quoted 3 lines

Use _safe() version of list iterator macros in dcb_setapp().

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.

#4 lore raw

PATCH 3/3 net: dcb: application priority is per net_device

In reply to John Fastabend

The 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
index e3399d6..249bcec 100644
@@ -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);
maintainer
#5 lore raw

Re: [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_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.

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.

maintainer Applied
#6 lore raw

Re: [net-2.6 PATCH 3/3] net: dcb: application priority is per net_device

In reply to John Fastabend

From: John Fastabend <[email protected]>
Date: Mon, 31 Jan 2011 14:00:59 -0800

Quoted 8 lines

The 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.

Applied.

maintainer
#7 lore raw
In reply to John Fastabend

From: John Fastabend <[email protected]>
Date: Mon, 31 Jan 2011 14:00:49 -0800

Quoted 5 lines

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 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.

#8 lore raw
Quoted 9 lines · David Miller

From: John Fastabend <[email protected]>
Date: Mon, 31 Jan 2011 14:00:49 -0800

Quoted 5 lines

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.

...

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