ソースを参照

[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 14年前
コミット
1415ec9c9a
3個のファイルの変更7行の追加7行の削除
  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 ファイルの表示

@@ -325,7 +325,8 @@ extern int fc_port_login ( struct fc_port *port, struct fc_port_id *port_id,
325 325
 extern void fc_port_logout ( struct fc_port *port, int rc );
326 326
 extern int fc_port_open ( struct interface *transport,
327 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 330
 extern struct fc_port * fc_port_find ( const char *name );
330 331
 
331 332
 /******************************************************************************

+ 3
- 5
src/net/fc.c ファイルの表示

@@ -1178,11 +1178,11 @@ static struct interface_descriptor fc_port_ns_plogi_desc =
1178 1178
  * @v transport		Transport interface
1179 1179
  * @v node		Fibre Channel node name
1180 1180
  * @v port		Fibre Channel port name
1181
+ * @v name		Symbolic port name
1181 1182
  * @ret rc		Return status code
1182 1183
  */
1183 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 1186
 	struct fc_port *port;
1187 1187
 
1188 1188
 	/* Allocate and initialise structure */
@@ -1198,9 +1198,7 @@ int fc_port_open ( struct interface *transport, const struct fc_name *node_wwn,
1198 1198
 	INIT_LIST_HEAD ( &port->xchgs );
1199 1199
 	memcpy ( &port->node_wwn, node_wwn, sizeof ( port->node_wwn ) );
1200 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 1203
 	DBGC ( port, "FCPORT %s opened as %s",
1206 1204
 	       port->name, fc_ntoa ( &port->node_wwn ) );

+ 2
- 1
src/net/fcoe.c ファイルの表示

@@ -1056,7 +1056,8 @@ static void fcoe_expired ( struct retry_timer *timer, int over __unused ) {
1056 1056
 
1057 1057
 		/* Attach Fibre Channel port */
1058 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 1061
 			DBGC ( fcoe, "FCoE %s could not create FC port: %s\n",
1061 1062
 			       fcoe->netdev->name, strerror ( rc ) );
1062 1063
 			/* We will try again on the next timer expiry */

読み込み中…
キャンセル
保存