[net-2.6 PATCH 1/3] net: dcb: match dcb_app protocol field with 802.1Qaz spec

Subsystems: the rest

STALE5724d

9 messages, 2 authors, 2011-02-13 · open the first message on its own page

[net-2.6 PATCH 1/3] net: dcb: match dcb_app protocol field with 802.1Qaz spec

From: John Fastabend <hidden>
Date: 2011-01-31 22:05:41

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.

Signed-off-by: John Fastabend <redacted>
---

 include/linux/dcbnl.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index 68cd248..bdc7ef4 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -101,7 +101,7 @@ struct ieee_pfc {
  */
 struct dcb_app {
 	__u8	selector;
-	__u32	protocol;
+	__u16	protocol;
 	__u8	priority;
 };
 

[net-2.6 PATCH 2/3] net: dcb: use _safe() version of list iterators

From: John Fastabend <hidden>
Date: 2011-01-31 22:05:47

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

Signed-off-by: John Fastabend <redacted>
---

 net/dcb/dcbnl.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 6b03f56..e3399d6 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -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)) {

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

From: John Fastabend <hidden>
Date: 2011-01-31 22:05:52

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.

Signed-off-by: John Fastabend <redacted>
---

 net/dcb/dcbnl.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index e3399d6..249bcec 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -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);

Re: [net-2.6 PATCH 1/3] net: dcb: match dcb_app protocol field with 802.1Qaz spec

From: David Miller <davem@davemloft.net>
Date: 2011-02-01 04:40:29

From: John Fastabend <redacted>
Date: Mon, 31 Jan 2011 14:00:49 -0800
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.

Signed-off-by: John Fastabend <redacted>
 ...
quoted hunk
@@ -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.

Re: [net-2.6 PATCH 2/3] net: dcb: use _safe() version of list iterators

From: David Miller <davem@davemloft.net>
Date: 2011-02-01 04:41:38

From: John Fastabend <redacted>
Date: Mon, 31 Jan 2011 14:00:54 -0800
Use _safe() version of list iterator macros in dcb_setapp().

Signed-off-by: John Fastabend <redacted>
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 3/3] net: dcb: application priority is per net_device

From: David Miller <davem@davemloft.net>
Date: 2011-02-01 04:42:32

From: John Fastabend <redacted>
Date: Mon, 31 Jan 2011 14:00:59 -0800
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.

Signed-off-by: John Fastabend <redacted>
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 1/3] net: dcb: match dcb_app protocol field with 802.1Qaz spec

From: John Fastabend <hidden>
Date: 2011-02-05 19:39:13

On 1/31/2011 8:41 PM, David Miller wrote:
From: John Fastabend <redacted>
Date: Mon, 31 Jan 2011 14:00:49 -0800
quoted
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.

Signed-off-by: John Fastabend <redacted>
 ...
quoted
@@ -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

Re: [net-2.6 PATCH 2/3] net: dcb: use _safe() version of list iterators

From: John Fastabend <hidden>
Date: 2011-02-05 19:40:36

On 1/31/2011 8:42 PM, David Miller wrote:
From: John Fastabend <redacted>
Date: Mon, 31 Jan 2011 14:00:54 -0800
quoted
Use _safe() version of list iterator macros in dcb_setapp().

Signed-off-by: John Fastabend <redacted>
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.

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

From: David Miller <davem@davemloft.net>
Date: 2011-02-13 19:02:35

From: John Fastabend <redacted>
Date: Mon, 31 Jan 2011 14:00:59 -0800
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.

Signed-off-by: John Fastabend <redacted>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help