Browse Source

[fc] Allow Fibre Channel ports to be explicitly named

Use the network interface name as the Fibre Channel port name.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
1415ec9c9a
3 changed files with 7 additions and 7 deletions
  1. 2
    1
      src/include/ipxe/fc.h
  2. 3
    5
      src/net/fc.c
  3. 2
    1
      src/net/fcoe.c

+ 2
- 1
src/include/ipxe/fc.h View File

325
 extern void fc_port_logout ( struct fc_port *port, int rc );
325
 extern void fc_port_logout ( struct fc_port *port, int rc );
326
 extern int fc_port_open ( struct interface *transport,
326
 extern int fc_port_open ( struct interface *transport,
327
 			  const struct fc_name *node_wwn,
327
 			  const struct fc_name *node_wwn,
328
-			  const struct fc_name *port_wwn );
328
+			  const struct fc_name *port_wwn,
329
+			  const char *name );
329
 extern struct fc_port * fc_port_find ( const char *name );
330
 extern struct fc_port * fc_port_find ( const char *name );
330
 
331
 
331
 /******************************************************************************
332
 /******************************************************************************

+ 3
- 5
src/net/fc.c View File

1178
  * @v transport		Transport interface
1178
  * @v transport		Transport interface
1179
  * @v node		Fibre Channel node name
1179
  * @v node		Fibre Channel node name
1180
  * @v port		Fibre Channel port name
1180
  * @v port		Fibre Channel port name
1181
+ * @v name		Symbolic port name
1181
  * @ret rc		Return status code
1182
  * @ret rc		Return status code
1182
  */
1183
  */
1183
 int fc_port_open ( struct interface *transport, const struct fc_name *node_wwn,
1184
 int fc_port_open ( struct interface *transport, const struct fc_name *node_wwn,
1184
-		   const struct fc_name *port_wwn ) {
1185
-	static unsigned int portindex = 0;
1185
+		   const struct fc_name *port_wwn, const char *name ) {
1186
 	struct fc_port *port;
1186
 	struct fc_port *port;
1187
 
1187
 
1188
 	/* Allocate and initialise structure */
1188
 	/* Allocate and initialise structure */
1198
 	INIT_LIST_HEAD ( &port->xchgs );
1198
 	INIT_LIST_HEAD ( &port->xchgs );
1199
 	memcpy ( &port->node_wwn, node_wwn, sizeof ( port->node_wwn ) );
1199
 	memcpy ( &port->node_wwn, node_wwn, sizeof ( port->node_wwn ) );
1200
 	memcpy ( &port->port_wwn, port_wwn, sizeof ( port->port_wwn ) );
1200
 	memcpy ( &port->port_wwn, port_wwn, sizeof ( port->port_wwn ) );
1201
-
1202
-	/* Create device name */
1203
-	snprintf ( port->name, sizeof ( port->name ), "fc%d", portindex++ );
1201
+	snprintf ( port->name, sizeof ( port->name ), "%s", name );
1204
 
1202
 
1205
 	DBGC ( port, "FCPORT %s opened as %s",
1203
 	DBGC ( port, "FCPORT %s opened as %s",
1206
 	       port->name, fc_ntoa ( &port->node_wwn ) );
1204
 	       port->name, fc_ntoa ( &port->node_wwn ) );

+ 2
- 1
src/net/fcoe.c View File

1056
 
1056
 
1057
 		/* Attach Fibre Channel port */
1057
 		/* Attach Fibre Channel port */
1058
 		if ( ( rc = fc_port_open ( &fcoe->transport, &fcoe->node_wwn.fc,
1058
 		if ( ( rc = fc_port_open ( &fcoe->transport, &fcoe->node_wwn.fc,
1059
-					   &fcoe->port_wwn.fc ) ) != 0 ) {
1059
+					   &fcoe->port_wwn.fc,
1060
+					   fcoe->netdev->name ) ) != 0 ) {
1060
 			DBGC ( fcoe, "FCoE %s could not create FC port: %s\n",
1061
 			DBGC ( fcoe, "FCoE %s could not create FC port: %s\n",
1061
 			       fcoe->netdev->name, strerror ( rc ) );
1062
 			       fcoe->netdev->name, strerror ( rc ) );
1062
 			/* We will try again on the next timer expiry */
1063
 			/* We will try again on the next timer expiry */

Loading…
Cancel
Save