Blob Blame History Raw
From fe8ccb1c84408690a42ce2c6134a0f0018ebd46a Mon Sep 17 00:00:00 2001
From: John Fastabend <john.r.fastabend@intel.com>
Date: Wed, 6 Apr 2011 08:47:41 -0700
Subject: [PATCH 39/51] lldpad: iSCSI subtype does not send kernel setapp
 nlmsg

The iSCSI application data should be sent to the kernel
through the setapp netlink interface. This allows the
lower layer stack to query the application data and
also allows other application to use the generic getapp
interface.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Petr Sabata <psabata@redhat.com>
---
 dcb_protocol.c                 |   10 ++++++++--
 include/dcb_driver_interface.h |    2 +-
 include/dcb_types.h            |    3 +++
 lldp_dcbx_nl.c                 |    8 ++++++--
 4 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/dcb_protocol.c b/dcb_protocol.c
index 6a91574..b841259 100644
--- a/dcb_protocol.c
+++ b/dcb_protocol.c
@@ -2777,6 +2777,7 @@ int set_configuration(char *device_name, u32 EventFlag)
 		DCB_LOCAL_CHANGE_APPTLV(APP_ISCSI_STYPE)) ||
 		DCB_TEST_FLAGS(EventFlag, DCB_REMOTE_CHANGE_APPTLV(APP_ISCSI_STYPE),
 		DCB_REMOTE_CHANGE_APPTLV(APP_ISCSI_STYPE))) {
+		appgroup_attribs app_data;
 
 		/* Get Oper store */
 		app_it Oper = apptlv_find(&oper_apptlv, device_name,
@@ -2786,8 +2787,13 @@ int set_configuration(char *device_name, u32 EventFlag)
 		if (Oper == NULL || Local == NULL) {
 			return dcb_failed;
 		}
-		return set_hw_app1(device_name, Oper->second->AppData[0],
-			Local->second->protocol.OperMode);
+
+		app_data.dcb_app_idtype = DCB_APP_IDTYPE_PORTNUM;
+		app_data.dcb_app_id = APP_ISCSI_PORT;
+		app_data.dcb_app_priority = Oper->second->AppData[0];
+
+		return set_hw_app1(device_name, &app_data,
+				   Local->second->protocol.OperMode);
 	}
 	return dcb_success;
 }
diff --git a/include/dcb_driver_interface.h b/include/dcb_driver_interface.h
index 17050fe..e4b5802 100644
--- a/include/dcb_driver_interface.h
+++ b/include/dcb_driver_interface.h
@@ -43,7 +43,7 @@ int set_hw_pg(char *device_name, pgroup_attribs *pg_data, bool Opermode);
 int set_hw_pfc(char *device_name, dcb_pfc_list_type pfc_data, bool Opermode);
 
 int set_hw_app0(char *device_name, appgroup_attribs *app_data);
-int set_hw_app1(char *device_name, u8 priority, int mode);
+int set_hw_app1(char *device_name, appgroup_attribs *app_data, int mode);
 
 int set_hw_all(char *device_name);
 
diff --git a/include/dcb_types.h b/include/dcb_types.h
index 5c21650..6a4b6a9 100644
--- a/include/dcb_types.h
+++ b/include/dcb_types.h
@@ -180,6 +180,9 @@ typedef struct dcb_traffic_attribs {
 #define APP_FCOE_ETHTYPE 0x8906
 #endif
 
+/* APP PROTOCOL TYPES */
+#define APP_ISCSI_PORT 3260
+
 /* Flags */
 #define DCB_SET_FLAGS(_FlagsVar, _BitsToSet)    \
 		(_FlagsVar) = (_FlagsVar) | (_BitsToSet)
diff --git a/lldp_dcbx_nl.c b/lldp_dcbx_nl.c
index e4b2830..a860724 100644
--- a/lldp_dcbx_nl.c
+++ b/lldp_dcbx_nl.c
@@ -751,7 +751,7 @@ void run_cmd(char *cmd, ...)
 /* returns: 0 on success
  *          1 on failure
 */
-int set_hw_app1(char *ifname, u8 pri, int mode)
+int set_hw_app1(char *ifname, appgroup_attribs *app_data, int mode)
 {
 	int queue;
 
@@ -759,7 +759,7 @@ int set_hw_app1(char *ifname, u8 pri, int mode)
 			mode ? "Enabled" : "Disabled", mode);
 
 	/* find first bit set in u8 bitmask for queue_mapping */
-	queue = ffs(pri);
+	queue = ffs(app_data->dcb_app_priority);
 
 	run_cmd("tc qdisc del dev %s root 2>/dev/null", ifname, NULL, NULL);
 	if (mode) {
@@ -769,6 +769,10 @@ int set_hw_app1(char *ifname, u8 pri, int mode)
 		run_cmd("tc filter add dev %s protocol ipv6 parent 1: u32 match ip6 dport %d 0xffff action skbedit queue_mapping %d", ifname, 3260, queue);
 		run_cmd("tc filter add dev %s protocol ipv6 parent 1: u32 match ip6 sport %d 0xffff action skbedit queue_mapping %d", ifname, 3260, queue);
 	}
+
+	/* And push configuration to kernel */
+	set_hw_app0(ifname, app_data);
+
 	return(0);
 
 }
-- 
1.7.4.4