[Open-FCoE] [PATCH 12/18] devtools fip: change FWWN descriptor to fabric descriptor.

Joe Eykholt jeykholt at cisco.com
Sat Oct 25 01:39:17 UTC 2008


devtools fip: change FWWN descriptor to fabric descriptor.



Signed-off-by: Joe Eykholt <jeykholt at cisco.com>
---
 usr/common/include/fc_fip.h            |   13 ++++++++++++-
 usr/common/libfc/include/fc_fip_subr.h |    1 +
 usr/common/libfc/src/fc/fc_fip_subr.c  |   20 ++++++++++++++------
 usr/ofc/tools/fcgw/src/fcgw_fip.c      |    4 ++--
 4 files changed, 29 insertions(+), 9 deletions(-)


diff --git a/usr/common/include/fc_fip.h b/usr/common/include/fc_fip.h
index 99ea2a5..a8ee2de 100644
--- a/usr/common/include/fc_fip.h
+++ b/usr/common/include/fc_fip.h
@@ -127,7 +127,7 @@ enum fip_desc_type {
 	FIP_DT_MAC =	2,		/* MAC address */
 	FIP_DT_MAP_OUI = 3,		/* FC-MAP OUI */
 	FIP_DT_NAME =	4,		/* name */
-	FIP_DT_FWWN =	5,		/* fabric name */
+	FIP_DT_FAB =	5,		/* fabric descriptor */
 	FIP_DT_FCOE_SIZE = 6,		/* max FCoE frame size */
 	FIP_DT_FLOGI =	7,		/* FLOGI request or response */
 	FIP_DT_FDISC =	8,		/* FDISC request or response */
@@ -175,6 +175,17 @@ struct fip_wwn_desc {
 };
 
 /*
+ * FIP_DT_FAB descriptor.
+ */
+struct fip_fab_desc {
+	struct fip_desc fd_desc;
+	net16_t		fd_vfid;	/* virtual fabric ID */
+	net8_t		fd_resvd;
+	net24_t		fd_map;		/* FC-MAP value */
+	net64_t		fd_wwn;		/* fabric name */
+} __attribute__((packed));
+
+/*
  * FIP_DT_FCOE_SIZE descriptor.
  */
 struct fip_size_desc {
diff --git a/usr/common/libfc/include/fc_fip_subr.h b/usr/common/libfc/include/fc_fip_subr.h
index 1ee0daa..9e2ddb8 100644
--- a/usr/common/libfc/include/fc_fip_subr.h
+++ b/usr/common/libfc/include/fc_fip_subr.h
@@ -31,6 +31,7 @@ struct fip_descs {
 	u_int		fip_map;	/* FC-MAP OUI */
 	fc_wwn_t	fip_name;	/* name descriptor value */
 	fc_wwn_t	fip_fwwn;	/* fabric name */
+	u_int16_t	fip_vfid;	/* virtual fabric ID */
 	u_int		fip_fcoe_size;	/* max FCoE frame size */
 	u_int		fip_fka;	/* keep-alive period (secs.) */
 	struct fc_frame_header *fip_fh;	/* frame header inside buffer */
diff --git a/usr/common/libfc/src/fc/fc_fip_subr.c b/usr/common/libfc/src/fc/fc_fip_subr.c
index f9d0126..f582c26 100644
--- a/usr/common/libfc/src/fc/fc_fip_subr.c
+++ b/usr/common/libfc/src/fc/fc_fip_subr.c
@@ -111,11 +111,15 @@ static int fip_desc_decaps(const struct fip_desc *desc, void *arg)
 		tp->fip_name =
 		    net64_get(&((struct fip_wwn_desc *)desc)->fd_wwn);
 		break;
-	case FIP_DT_FWWN:
-		if (dlen != sizeof(struct fip_wwn_desc))
+	case FIP_DT_FAB:
+		if (dlen != sizeof(struct fip_fab_desc))
 			goto len_err;
 		tp->fip_fwwn =
-		    net64_get(&((struct fip_wwn_desc *) desc)->fd_wwn);
+		    net64_get(&((struct fip_fab_desc *) desc)->fd_wwn);
+		tp->fip_vfid =
+		    net16_get(&((struct fip_fab_desc *) desc)->fd_vfid);
+		tp->fip_map =
+		    net24_get(&((struct fip_fab_desc *) desc)->fd_map);
 		break;
 	case FIP_DT_FCOE_SIZE:
 		if (dlen != sizeof(struct fip_size_desc))
@@ -227,12 +231,16 @@ int fip_frame_encaps(void *buf, size_t len, struct fip_descs *tp,
 			net64_put(&((struct fip_wwn_desc *)desc)->fd_wwn,
 				  tp->fip_name);
 			break;
-		case FIP_DT_FWWN:
-			dlen = sizeof(struct fip_wwn_desc);
+		case FIP_DT_FAB:
+			dlen = sizeof(struct fip_fab_desc);
 			if (dlen > rlen)
 				goto err;
-			net64_put(&((struct fip_wwn_desc *)desc)->fd_wwn,
+			net64_put(&((struct fip_fab_desc *)desc)->fd_wwn,
 				  tp->fip_fwwn);
+			net24_put(&((struct fip_fab_desc *)desc)->fd_map,
+				  tp->fip_map);
+			net16_put(&((struct fip_fab_desc *)desc)->fd_vfid,
+				  tp->fip_vfid);
 			break;
 		case FIP_DT_FCOE_SIZE:
 			dlen = sizeof(struct fip_size_desc);
diff --git a/usr/ofc/tools/fcgw/src/fcgw_fip.c b/usr/ofc/tools/fcgw/src/fcgw_fip.c
index 2799ffc..9fc7070 100644
--- a/usr/ofc/tools/fcgw/src/fcgw_fip.c
+++ b/usr/ofc/tools/fcgw/src/fcgw_fip.c
@@ -492,8 +492,8 @@ int fcgw_fip_adv_send(struct fip_state *fip, struct fip_descs *tp,
 	len = sizeof(buf) - sizeof(*eh);
 	rc = fip_frame_encaps(fiph, len, tp,
 			      (1 << FIP_DT_PRI) | (1 << FIP_DT_MAC) |
-			      (1 << FIP_DT_MAP_OUI) | (1 << FIP_DT_NAME) |
-			      (1 << FIP_DT_FWWN) | (1 << FIP_DT_FKA));
+			      (1 << FIP_DT_NAME) |
+			      (1 << FIP_DT_FAB) | (1 << FIP_DT_FKA));
 	if (rc != 0) {
 		SA_LOG("encaps failed rc %d", rc);
 		return rc;





More information about the devel mailing list