fcoe: VN2VN target mode fixes
Subsystems (4)
Hannes Reinecke
maintainercover fcoe: VN2VN target mode fixes
Hi all,
When setting up a VN2VN FCoE target there is no real need to run fcoeadm, especially if DCB is disabled.
So this patchset implements a VIP VLAN responder which can be enabled by writing to the sysfs attribute 'fip_vlan_responder'. Additionally there are some fixes for VN2VN mode, most notably the multicast address update when changing modes.
As usual, comments and reviews are welcome.
Hannes Reinecke (6):
fc_fip: Update to latest FC-BB-6 draft
fcoe: use enum for fip_mode
fcoe: fcoe->realdev is always set
fcoe: Update multicast addresses on FIP mode change
fcoe: implement FIP VLAN responder
fcoe: Use default VLAN for FIP VLAN discovery
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 6 +- drivers/scsi/fcoe/fcoe.c | 95 ++++++++++++++-- drivers/scsi/fcoe/fcoe.h | 1 + drivers/scsi/fcoe/fcoe_ctlr.c | 234 +++++++++++++++++++++++++++++++++++++- drivers/scsi/fcoe/fcoe_sysfs.c | 39 +++++++ drivers/scsi/fnic/fnic_fcs.c | 6 +- drivers/scsi/fnic/fnic_fip.h | 8 -- include/scsi/fc/fc_fip.h | 21 +++- include/scsi/libfc.h | 1 + include/scsi/libfcoe.h | 19 ++-- 10 files changed, 391 insertions(+), 39 deletions(-)
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 1/6 fc_fip: Update to latest FC-BB-6 draft
Update to latest FC-BB-6 draft to include FIP VN2VN VLAN notifications and additional flags.
--- drivers/scsi/fcoe/fcoe_ctlr.c | 8 ++++---- drivers/scsi/fnic/fnic_fcs.c | 4 ++-- drivers/scsi/fnic/fnic_fip.h | 8 -------- include/scsi/fc/fc_fip.h | 21 +++++++++++++++++---- 4 files changed, 23 insertions(+), 18 deletions(-)
drivers/scsi/fcoe/fcoe_ctlr.c +4 -4
@@ -991,7 +991,7 @@ static int fcoe_ctlr_parse_adv(struct fcoe_ctlr *fip,LIBFCOE_FIP_DBG (fip,"unexpected descriptor type %x " "in FIP adv\n" , desc->fip_dtype);/* standard says ignore unknown descriptors >= 128 */ -if (desc->fip_dtype <FIP_DT_VENDOR_BASE ) +if (desc->fip_dtype <FIP_DT_NON_CRITICAL )return -EINVAL ;break ; }
@@ -1232,7 +1232,7 @@ static void fcoe_ctlr_recv_els(struct fcoe_ctlr *fip, struct sk_buff *skb)LIBFCOE_FIP_DBG (fip,"unexpected descriptor type %x " "in FIP adv\n" , desc->fip_dtype);/* standard says ignore unknown descriptors >= 128 */ -if (desc->fip_dtype <FIP_DT_VENDOR_BASE ) +if (desc->fip_dtype <FIP_DT_NON_CRITICAL ) goto drop;if (desc_cnt <=2 ) { LIBFCOE_FIP_DBG(fip, "FIP descriptors "
@@ -1410,7 +1410,7 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip,break ;default :/* standard says ignore unknown descriptors >= 128 */ -if (desc->fip_dtype <FIP_DT_VENDOR_BASE ) +if (desc->fip_dtype <FIP_DT_NON_CRITICAL ) goto err;break ; }
@@ -2338,7 +2338,7 @@ static int fcoe_ctlr_vn_parse(struct fcoe_ctlr *fip,LIBFCOE_FIP_DBG (fip,"unexpected descriptor type %x " "in FIP probe\n" , dtype);/* standard says ignore unknown descriptors >= 128 */ -if (dtype <FIP_DT_VENDOR_BASE ) +if (dtype <FIP_DT_NON_CRITICAL )return -EINVAL ;break ; }
drivers/scsi/fnic/fnic_fcs.c +2 -2
@@ -359,7 +359,7 @@ static void fnic_fcoe_send_vlan_req(struct fnic *fnic) vlan->fip.fip_ver =FIP_VER_ENCAPS (FIP_VER ); vlan->fip.fip_op =htons (FIP_OP_VLAN ); - vlan->fip.fip_subcode =FIP_SC_VL_REQ ; + vlan->fip.fip_subcode =FIP_SC_VL_NOTE ; vlan->fip.fip_dl_len =htons (sizeof (vlan->desc) /FIP_BPW ); vlan->desc.mac.fd_desc.fip_dtype =FIP_DT_MAC ;
@@ -551,7 +551,7 @@ static int fnic_fcoe_handle_fip_frame(struct fnic *fnic, struct sk_buff *skb) goto drop;/* pass it on to fcoe */ ret =1 ; - }else if (op ==FIP_OP_VLAN && sub ==FIP_SC_VL_REP ) { + }else if (op ==FIP_OP_VLAN && sub ==FIP_SC_VL_NOTE ) {/* set the vlan as used */ fnic_fcoe_process_vlan_resp (fnic, skb); ret =0 ;
drivers/scsi/fnic/fnic_fip.h +0 -8
@@ -26,14 +26,6 @@#define FINC_MAX_FLOGI_REJECTS 8 -/* -* FIP_DT_VLAN descriptor. -*/ -struct fip_vlan_desc { -struct fip_desc fd_desc; -__be16 fd_vlan; -} __attribute__((packed)); -struct vlan {__be16 vid;__be16 type;
include/scsi/fc/fc_fip.h +17 -4
@@ -22,7 +22,7 @@/* * This version is based on: * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf -* and T11 FC-BB-6 10-019v4.pdf (June 2010 VN2VN proposal) +* and T11 FC-BB-6 13-091v5.pdf (December 2013 VN2VN proposal) */ #define FIP_DEF_PRI 128/* default selection priority */
@@ -109,8 +109,9 @@ enum fip_reset_subcode {* Subcodes for FIP_OP_VLAN. */ enum fip_vlan_subcode { -FIP_SC_VL_REQ =1 ,/* request */ -FIP_SC_VL_REP =2 ,/* reply */ +FIP_SC_VL_REQ =1 ,/* vlan request */ +FIP_SC_VL_NOTE =2 ,/* vlan notification */ +FIP_SC_VL_VN2VN_NOTE =3 ,/* VN2VN vlan notification */ };/*
@@ -130,6 +131,8 @@ enum fip_vn2vn_subcode {enum fip_flag {FIP_FL_FPMA =0x8000 ,/* supports FPMA fabric-provided MACs */ FIP_FL_SPMA =0x4000 ,/* supports SPMA server-provided MACs */ +FIP_FL_FCF =0x0020 ,/* originated from a controlling FCF */ +FIP_FL_FDF =0x0010 ,/* originated from an FDF */ FIP_FL_REC_OR_P2P =0x0008 ,/* configured addr or point-to-point */ FIP_FL_AVAIL =0x0004 ,/* available for FLOGI/ELP */ FIP_FL_SOL =0x0002 ,/* this is a solicited message */
@@ -161,7 +164,9 @@ enum fip_desc_type {FIP_DT_VLAN =14 ,/* vlan number */ FIP_DT_FC4F =15 ,/* FC-4 features */ FIP_DT_LIMIT ,/* max defined desc_type + 1 */ - FIP_DT_VENDOR_BASE = 128, /* first vendor-specific desc_type */ +FIP_DT_NON_CRITICAL =128 ,/* First non-critical descriptor */ +FIP_DT_CLR_VLINKS =128 ,/* Clear virtual links reason code */ + FIP_DT_VENDOR_BASE = 241, /* first vendor-specific desc_type */ };/*
@@ -259,6 +264,14 @@ enum fip_fka_flags {/* FIP_DT_FKA flags */ /* +* FIP_DT_VLAN descriptor +*/ +struct fip_vlan_desc { +struct fip_desc fd_desc; +__be16 fd_vlan;/* Note: highest 4 bytes are unused */ +} __attribute__((packed)); + +/* * FIP_DT_FC4F - FC-4 features. */ struct fip_fc4_feat {
Signature · 1 line
1.8.5.6
Re: [PATCH 1/6] fc_fip: Update to latest FC-BB-6 draft
Quoted 4 lines · Hannes Reinecke
Update to latest FC-BB-6 draft to include FIP VN2VN VLAN notifications and additional flags.
Signed-off-by Hannes Reinecke <[email protected]>
Signature · 10 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hannes Reinecke
maintainerPATCH 2/6 fcoe: use enum for fip_mode
In reply to Hannes ReineckeThe FIP mode is independent on the FIP state machine, so use a separate enum for that instead of overloading it with state machine values.
--- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 6 +++--- drivers/scsi/fcoe/fcoe.c | 6 +++--- drivers/scsi/fcoe/fcoe_ctlr.c | 2 +- drivers/scsi/fnic/fnic_fcs.c | 2 +- include/scsi/libfcoe.h | 14 ++++++++------ 5 files changed, 16 insertions(+), 14 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +3 -3
@@ -57,7 +57,7 @@ static struct scsi_host_template bnx2fc_shost_template;static struct fc_function_template bnx2fc_transport_function;static struct fcoe_sysfs_function_template bnx2fc_fcoe_sysfs_templ;static struct fc_function_template bnx2fc_vport_xport_function; -static int bnx2fc_create (struct net_device *netdev,enum fip_state fip_mode); +static int bnx2fc_create (struct net_device *netdev,enum fip_mode fip_mode);static void __bnx2fc_destroy (struct bnx2fc_interface *interface);static int bnx2fc_destroy (struct net_device *net_device);static int bnx2fc_enable (struct net_device *netdev);
@@ -2260,7 +2260,7 @@ enum bnx2fc_create_link_state {* Returns: 0 for success */ static int _bnx2fc_create (struct net_device *netdev, -enum fip_state fip_mode, +enum fip_mode fip_mode,enum bnx2fc_create_link_state link_state) {struct fcoe_ctlr_device *cdev;
@@ -2412,7 +2412,7 @@ mod_err:* * Returns: 0 for success */ -static int bnx2fc_create (struct net_device *netdev,enum fip_state fip_mode) +static int bnx2fc_create (struct net_device *netdev,enum fip_mode fip_mode) {return _bnx2fc_create (netdev, fip_mode,BNX2FC_CREATE_LINK_UP ); }
drivers/scsi/fcoe/fcoe.c +3 -3
@@ -107,7 +107,7 @@ static int fcoe_dcb_app_notification(struct notifier_block *notifier, ulong event, void *ptr);static bool fcoe_match (struct net_device *netdev); -static int fcoe_create (struct net_device *netdev,enum fip_state fip_mode); +static int fcoe_create (struct net_device *netdev,enum fip_mode fip_mode);static int fcoe_destroy (struct net_device *netdev);static int fcoe_enable (struct net_device *netdev);static int fcoe_disable (struct net_device *netdev);
@@ -2133,7 +2133,7 @@ enum fcoe_create_link_state {* consolidation of code can be done when that interface is * removed. */ -static int _fcoe_create (struct net_device *netdev,enum fip_state fip_mode, +static int _fcoe_create (struct net_device *netdev,enum fip_mode fip_mode,enum fcoe_create_link_state link_state) {int rc =0 ;
@@ -2222,7 +2222,7 @@ out:* * Returns: 0 for success */ -static int fcoe_create (struct net_device *netdev,enum fip_state fip_mode) +static int fcoe_create (struct net_device *netdev,enum fip_mode fip_mode) {return _fcoe_create (netdev, fip_mode,FCOE_CREATE_LINK_UP ); }
drivers/scsi/fcoe/fcoe_ctlr.c +1 -1
@@ -2864,7 +2864,7 @@ unlock:* when nothing is happening. */ static void fcoe_ctlr_mode_set (struct fc_lport *lport,struct fcoe_ctlr *fip, -enum fip_state fip_mode) +enum fip_mode fip_mode) {void *priv;
drivers/scsi/fnic/fnic_fcs.c +1 -1
@@ -1308,7 +1308,7 @@ void fnic_handle_fip_timer(struct fnic *fnic) }spin_unlock_irqrestore (&fnic->fnic_lock, flags); -if (fnic->ctlr.mode ==FIP_ST_NON_FIP ) +if (fnic->ctlr.mode ==FIP_MODE_NON_FIP )return ;spin_lock_irqsave (&fnic->vlans_lock, flags);
include/scsi/libfcoe.h +8 -6
@@ -78,10 +78,12 @@ enum fip_state {* The mode is the state that is to be entered after link up. * It must not change after fcoe_ctlr_init() sets it. */ -#define FIP_MODE_AUTO FIP_ST_AUTO -#define FIP_MODE_NON_FIP FIP_ST_NON_FIP -#define FIP_MODE_FABRIC FIP_ST_ENABLED -#define FIP_MODE_VN2VN FIP_ST_VNMP_START +enum fip_mode { +FIP_MODE_AUTO =FIP_ST_AUTO , +FIP_MODE_NON_FIP , +FIP_MODE_FABRIC , +FIP_MODE_VN2VN , +};/** * struct fcoe_ctlr - FCoE Controller and FIP state
@@ -124,7 +126,7 @@ enum fip_state {*/ struct fcoe_ctlr {enum fip_state state; -enum fip_state mode; +enum fip_mode mode;struct fc_lport *lp;struct fcoe_fcf *sel_fcf;struct list_head fcfs;
@@ -311,7 +313,7 @@ struct fcoe_transport {struct list_head list;bool (*match) (struct net_device *device);int (*alloc) (struct net_device *device); -int (*create) (struct net_device *device,enum fip_state fip_mode); +int (*create) (struct net_device *device,enum fip_mode fip_mode);int (*destroy) (struct net_device *device);int (*enable) (struct net_device *device);int (*disable) (struct net_device *device);
Signature · 1 line
1.8.5.6
Re: [PATCH 2/6] fcoe: use enum for fip_mode
Quoted 5 lines · Hannes Reinecke
The FIP mode is independent on the FIP state machine, so use a separate enum for that instead of overloading it with state machine values.
Signed-off-by Hannes Reinecke <[email protected]>
Signature · 10 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hannes Reinecke
maintainerPATCH 3/6 fcoe: fcoe->realdev is always set
In reply to Hannes Reinecke'->realdev' is always set, so this check is pointless.
--- drivers/scsi/fcoe/fcoe.c | 3 --- 1 file changed, 3 deletions(-)
drivers/scsi/fcoe/fcoe.c +0 -3
@@ -770,9 +770,6 @@ static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev) fcoe = port->priv; realdev = fcoe->realdev; -if (!realdev) -return ; -/* No FDMI state m/c for NPIV ports */ if (lport->vport)return ;
Signature · 1 line
1.8.5.6
Re: [PATCH 3/6] fcoe: fcoe->realdev is always set
Quoted 3 lines · Hannes Reinecke
'->realdev' is always set, so this check is pointless.
Signed-off-by Hannes Reinecke <[email protected]>
Signature · 10 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hannes Reinecke
maintainerPATCH 4/6 fcoe: Update multicast addresses on FIP mode change
In reply to Hannes ReineckeWhen the FIP mode is changed we need to update the multicast addresses to ensure we get the correct frames.
--- drivers/scsi/fcoe/fcoe.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
drivers/scsi/fcoe/fcoe.c +29 -2
@@ -115,7 +115,7 @@ static int fcoe_disable(struct net_device *netdev);/* fcoe_syfs control interface handlers */ static int fcoe_ctlr_alloc (struct net_device *netdev);static int fcoe_ctlr_enabled (struct fcoe_ctlr_device *cdev); - +static void fcoe_ctlr_mode (struct fcoe_ctlr_device *ctlr_dev); static struct fc_seq *fcoe_elsct_send(struct fc_lport *, u32 did, struct fc_frame *,
@@ -146,8 +146,9 @@ static void fcoe_set_vport_symbolic_name(struct fc_vport *);static void fcoe_set_port_id (struct fc_lport *,u32 ,struct fc_frame *);static void fcoe_fcf_get_vlan_id (struct fcoe_fcf_device *); +static struct fcoe_sysfs_function_template fcoe_sysfs_templ = { - .set_fcoe_ctlr_mode = fcoe_ctlr_set_fip_mode, + .set_fcoe_ctlr_mode = fcoe_ctlr_mode, .set_fcoe_ctlr_enabled = fcoe_ctlr_enabled, .get_fcoe_ctlr_link_fail = fcoe_ctlr_get_lesb, .get_fcoe_ctlr_vlink_fail = fcoe_ctlr_get_lesb,
@@ -1976,6 +1977,32 @@ static int fcoe_ctlr_enabled(struct fcoe_ctlr_device *cdev) }/** +* fcoe_ctlr_mode() - Switch FIP mode +* @cdev: The FCoE Controller that is being modified +* +* When the FIP mode has been changed we need to update +* the multicast addresses to ensure we get the correct +* frames. +*/ +static void fcoe_ctlr_mode (struct fcoe_ctlr_device *ctlr_dev) +{ +struct fcoe_ctlr *ctlr =fcoe_ctlr_device_priv (ctlr_dev); +struct fcoe_interface *fcoe =fcoe_ctlr_priv (ctlr); + +if (ctlr_dev->mode ==FIP_CONN_TYPE_VN2VN && + ctlr->mode !=FIP_MODE_VN2VN ) { +dev_mc_del (fcoe->netdev,FIP_ALL_ENODE_MACS ); +dev_mc_add (fcoe->netdev,FIP_ALL_VN2VN_MACS ); +dev_mc_add (fcoe->netdev,FIP_ALL_P2P_MACS ); + }else if (ctlr->mode !=FIP_MODE_FABRIC ) { +dev_mc_del (fcoe->netdev,FIP_ALL_VN2VN_MACS ); +dev_mc_del (fcoe->netdev,FIP_ALL_P2P_MACS ); +dev_mc_add (fcoe->netdev,FIP_ALL_ENODE_MACS ); + } +fcoe_ctlr_set_fip_mode (ctlr_dev); +} + +/** * fcoe_destroy() - Destroy a FCoE interface * @netdev : The net_device object the Ethernet interface to create on *
Signature · 1 line
1.8.5.6
Re: [PATCH 4/6] fcoe: Update multicast addresses on FIP mode change
Quoted 4 lines · Hannes Reinecke
When the FIP mode is changed we need to update the multicast addresses to ensure we get the correct frames.
Signed-off-by Hannes Reinecke <[email protected]>
Signature · 10 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hannes Reinecke
maintainerPATCH 5/6 fcoe: implement FIP VLAN responder
In reply to Hannes ReineckeWhen running in VN2VN mode there is no central instance which would send out any FIP VLAN discovery notifications. So this patch adds a new sysfs attribute 'fip_vlan_responder' which will activate a FIP VLAN discovery responder.
--- drivers/scsi/fcoe/fcoe.c | 6 ++ drivers/scsi/fcoe/fcoe_ctlr.c | 224 +++++++++++++++++++++++++++++++++++++++++ drivers/scsi/fcoe/fcoe_sysfs.c | 39 +++++++ include/scsi/libfc.h | 1 + include/scsi/libfcoe.h | 5 +- 5 files changed, 274 insertions(+), 1 deletion(-)
drivers/scsi/fcoe/fcoe.c +6 -0
@@ -673,6 +673,12 @@ static int fcoe_netdev_config(struct fc_lport *lport, struct net_device *netdev) fcoe = port->priv; ctlr =fcoe_to_ctlr (fcoe); +/* Figure out the VLAN ID, if any */ +if (netdev->priv_flags &IFF_802_1Q_VLAN ) + lport->vlan =vlan_dev_vlan_id (netdev); +else + lport->vlan =0 ; +/* * Determine max frame size based on underlying device and optional * user-configured limit. If the MFS is too low, fcoe_link_ok()
drivers/scsi/fcoe/fcoe_ctlr.c +224 -0
259 lines not on this page · raw message
drivers/scsi/fcoe/fcoe_sysfs.c +39 -0
@@ -385,6 +385,44 @@ static FCOE_DEVICE_ATTR(ctlr, enabled, S_IRUGO | S_IWUSR, show_ctlr_enabled_state, store_ctlr_enabled); +static ssize_t store_ctlr_fip_resp (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct fcoe_ctlr_device *ctlr =dev_to_ctlr (dev); +struct fcoe_ctlr *fip =fcoe_ctlr_device_priv (ctlr); + +mutex_lock (&fip->ctlr_mutex); +if ((buf[1 ] =='\0' ) || ((buf[1 ] =='\n' ) && (buf[2 ] =='\0' ))) { +if (buf[0 ] =='1' ) { + fip->fip_resp =1 ; +mutex_unlock (&fip->ctlr_mutex); +return count; + } +if (buf[0 ] =='0' ) { + fip->fip_resp =0 ; +mutex_unlock (&fip->ctlr_mutex); +return count; + } + } +mutex_unlock (&fip->ctlr_mutex); +return -EINVAL ; +} + +static ssize_t show_ctlr_fip_resp (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct fcoe_ctlr_device *ctlr =dev_to_ctlr (dev); +struct fcoe_ctlr *fip =fcoe_ctlr_device_priv (ctlr); + +return sprintf (buf,"%d\n" , fip->fip_resp ?1 :0 ); +} + +static FCOE_DEVICE_ATTR(ctlr, fip_vlan_responder, S_IRUGO | S_IWUSR, + show_ctlr_fip_resp, + store_ctlr_fip_resp); + static ssize_t store_private_fcoe_ctlr_fcf_dev_loss_tmo(struct device *dev, struct device_attribute *attr,
@@ -467,6 +505,7 @@ static struct attribute_group fcoe_ctlr_lesb_attr_group = { };static struct attribute *fcoe_ctlr_attrs[] = { + &device_attr_fcoe_ctlr_fip_vlan_responder.attr, &device_attr_fcoe_ctlr_fcf_dev_loss_tmo.attr, &device_attr_fcoe_ctlr_enabled.attr, &device_attr_fcoe_ctlr_mode.attr,
include/scsi/libfc.h +1 -0
@@ -878,6 +878,7 @@ struct fc_lport {struct libfc_function_template tt;u8 link_up;u8 qfull; +u16 vlan;enum fc_lport_state state;unsigned long boot_time;struct fc_host_statistics host_stats;
include/scsi/libfcoe.h +4 -1
@@ -110,8 +110,10 @@ enum fip_mode {* @flogi_req_send: send of FLOGI requested * @flogi_count: number of FLOGI attempts in AUTO mode. * @map_dest: use the FC_MAP mode for destination MAC addresses. +* @fip_resp: start FIP VLAN discovery responder * @spma: supports SPMA server-provided MACs mode * @probe_tries: number of FC_IDs probed +* @priority: DCBx FCoE APP priority * @dest_addr: MAC address of the selected FC forwarder. * @ctl_src_addr: the native MAC address of our local port. * @send: LLD-supplied function to handle sending FIP Ethernet frames
@@ -149,7 +151,8 @@ struct fcoe_ctlr {u16 flogi_oxid;u8 flogi_req_send;u8 flogi_count; -u8 map_dest; +bool map_dest; +bool fip_resp;u8 spma;u8 probe_tries;u8 priority;
Signature · 1 line
1.8.5.6
Re: [PATCH 5/6] fcoe: implement FIP VLAN responder
Quoted 7 lines · Hannes Reinecke
When running in VN2VN mode there is no central instance which would send out any FIP VLAN discovery notifications. So this patch adds a new sysfs attribute '
fip_vlan_responder' which will activate a FIP VLAN discovery responder.Signed-off-by Hannes Reinecke <[email protected]>---
[...]
Quoted 8 lines
drivers/scsi/fcoe/fcoe_ctlr.c +8
-0+/** +* fcoe_ctlr_vlan_send() - Send a FIP VLAN Notification +* @fip: The FCoE controller +* @sub: sub-opcode for vlan notification or vn2vn vlan notification +* @dest: The destination Ethernet MAC address +* @min_len: minimum size of the Ethernet payload to be sent +*/ +static void fcoe_ctlr_vlan_send(struct fcoe_ctlr *fip,
drivers/scsi/fcoe/fcoe_ctlr.c drop: · line 2834
Quoted 10 lines
drivers/scsi/fcoe/fcoe_ctlr.c +10
-0+enum fip_vlan_subcode sub, + const u8 *dest) +{ + struct sk_buff *skb; +struct fip_frame { +struct ethhdr eth; +struct fip_header fip; +struct fip_mac_desc mac; +struct fip_vlan_desc vlan; + } __packed * frame;
Hmmm this is the 2nd time fip_frame is defined in fcoe_ctlr.c. I'd prefere having the type definition somewhere else in this file and then use it in fcoe_ctlr_vlan_send() and fcoe_ctlr_vn_send().
drivers/scsi/fcoe/fcoe_ctlr.c drop: · line 2844
Quoted 10 lines
drivers/scsi/fcoe/fcoe_ctlr.c +10
-0+size_t len; +size_t dlen; + + len =sizeof (*frame); + dlen =sizeof (frame->mac) +sizeof (frame->vlan); + len =max (len,sizeof (struct ethhdr )); + + skb =dev_alloc_skb (len); +if (!skb) +return ;
dev_alloc_skb() uses GFP_ATOMIC so it's actually not unlikely to fail so please return -ENOMEM here, just so the caller knows what happened.
Quoted 33 lines
drivers/scsi/fcoe/fcoe_ctlr.c +33
-0+ +LIBFCOE_FIP_DBG (fip,"fip %s vlan notification, vlan %d\n" , + fip->mode ==FIP_MODE_VN2VN ?"vn2vn" :"fcf" , + fip->lp->vlan); + + frame = (struct fip_frame *)skb->data; +memset (frame,0 , len); +memcpy (frame->eth.h_dest, dest,ETH_ALEN ); + +memcpy (frame->eth.h_source, fip->ctl_src_addr,ETH_ALEN ); + frame->eth.h_proto =htons (ETH_P_FIP ); + + frame->fip.fip_ver =FIP_VER_ENCAPS (FIP_VER ); + frame->fip.fip_op =htons (FIP_OP_VLAN ); + frame->fip.fip_subcode = sub; + frame->fip.fip_dl_len =htons (dlen /FIP_BPW ); + + frame->mac.fd_desc.fip_dtype =FIP_DT_MAC ; + frame->mac.fd_desc.fip_dlen =sizeof (frame->mac) /FIP_BPW ; +memcpy (frame->mac.fd_mac, fip->ctl_src_addr,ETH_ALEN ); + + frame->vlan.fd_desc.fip_dtype =FIP_DT_VLAN ; + frame->vlan.fd_desc.fip_dlen =sizeof (frame->vlan) /FIP_BPW ; +put_unaligned_be16 (fip->lp->vlan, &frame->vlan.fd_vlan); + +skb_put (skb, len); + skb->protocol =htons (ETH_P_FIP ); + skb->priority = fip->priority; +skb_reset_mac_header (skb); +skb_reset_network_header (skb); + + fip->send (fip, skb); +}
Signature · 10 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hannes Reinecke
maintainerRe: [PATCH 5/6] fcoe: implement FIP VLAN responder
Quoted 25 lines · Johannes Thumshirn
Quoted 7 lines · Hannes Reinecke
When running in VN2VN mode there is no central instance which would send out any FIP VLAN discovery notifications. So this patch adds a new sysfs attribute '
fip_vlan_responder' which will activate a FIP VLAN discovery responder.Signed-off-by Hannes Reinecke <[email protected]>---
[...]
Quoted 14 lines
drivers/scsi/fcoe/fcoe_ctlr.c +14
-0+/** +* fcoe_ctlr_vlan_send() - Send a FIP VLAN Notification +* @fip: The FCoE controller +* @sub: sub-opcode for vlan notification or vn2vn vlan notification +* @dest: The destination Ethernet MAC address +* @min_len: minimum size of the Ethernet payload to be sent +*/ +static void fcoe_ctlr_vlan_send (struct fcoe_ctlr *fip, +enum fip_vlan_subcode sub, +const u8 *dest) +{ +struct sk_buff *skb; +struct fip_frame { +struct ethhdr eth;
Quoted 9 lines
drivers/scsi/fcoe/fcoe_ctlr.c drop: · line 2834
Quoted 4 lines
drivers/scsi/fcoe/fcoe_ctlr.c +4
-0+struct fip_header fip; +struct fip_mac_desc mac; +struct fip_vlan_desc vlan; + }__packed * frame;Hmmm this is the 2nd time
fip_frameis defined infcoe_ctlr.c. I'd prefere having the type definition somewhere else in this file and then use it infcoe_ctlr_vlan_send()andfcoe_ctlr_vn_send().
This appears to be the convention in the file; every function which is sending a frame on the wire defines a local variable 'struct fip_frame' which contains the actual frame definition.
Might be that the style can be improved, but that should be a separate patch.
Quoted 5 lines
Quoted 5 lines
drivers/scsi/fcoe/fcoe_ctlr.c +5
-0+size_t len; +size_t dlen; + + len =sizeof (*frame); + dlen =sizeof (frame->mac) +sizeof (frame->vlan);
Quoted 9 lines
drivers/scsi/fcoe/fcoe_ctlr.c drop: · line 2844
Quoted 5 lines
drivers/scsi/fcoe/fcoe_ctlr.c +5
-0+ len =max (len,sizeof (struct ethhdr )); + + skb =dev_alloc_skb (len); +if (!skb) +return ;
dev_alloc_skb()usesGFP_ATOMICso it's actually not unlikely to fail so please return-ENOMEMhere, just so the caller knows what happened.
Again, the calling convention of fcoe_ctlr_send_vlan() insists on using a void return.
Yes, this should be improved, but again with another patch.
So do I need to send two additional patches for updating the infrastructure?
Cheers,
Hannes
Signature · 9 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/6] fcoe: implement FIP VLAN responder
In reply to Hannes ReineckeQuoted 6 lines · Hannes Reinecke
When running in VN2VN mode there is no central instance which would send out any FIP VLAN discovery notifications. So this patch adds a new sysfs attribute '
fip_vlan_responder' which will activate a FIP VLAN discovery responder.Signed-off-by Hannes Reinecke <[email protected]>
Signature · 10 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hannes Reinecke
maintainerPATCH 6/6 fcoe: Use default VLAN for FIP VLAN discovery
In reply to Hannes ReineckeFC-BB-6 states:
FIP protocols shall be performed on a per-VLAN basis. It is recommended to use the FIP VLAN discovery protocol on the default VLAN.
--- drivers/scsi/fcoe/fcoe.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++- drivers/scsi/fcoe/fcoe.h | 1 + 2 files changed, 49 insertions(+), 1 deletion(-)
drivers/scsi/fcoe/fcoe.c +48 -1
@@ -92,6 +92,8 @@ static struct fcoe_interfacestatic int fcoe_fip_recv (struct sk_buff *,struct net_device *,struct packet_type *,struct net_device *); +static int fcoe_fip_vlan_recv (struct sk_buff *,struct net_device *, +struct packet_type *,struct net_device *);static void fcoe_fip_send (struct fcoe_ctlr *,struct sk_buff *);static void fcoe_update_src_mac (struct fc_lport *,u8 *);
@@ -363,6 +365,12 @@ static int fcoe_interface_setup(struct fcoe_interface *fcoe, fcoe->fip_packet_type.dev = netdev;dev_add_pack (&fcoe->fip_packet_type); +if (netdev != real_dev) { + fcoe->fip_vlan_packet_type.func = fcoe_fip_vlan_recv; + fcoe->fip_vlan_packet_type.type =htons (ETH_P_FIP ); + fcoe->fip_vlan_packet_type.dev = real_dev; +dev_add_pack (&fcoe->fip_vlan_packet_type); + }return 0 ; }
@@ -450,6 +458,8 @@ static void fcoe_interface_remove(struct fcoe_interface *fcoe)*/ __dev_remove_pack (&fcoe->fcoe_packet_type);__dev_remove_pack (&fcoe->fip_packet_type); +if (netdev != fcoe->realdev) +__dev_remove_pack (&fcoe->fip_vlan_packet_type);synchronize_net ();/* Delete secondary MAC addresses */
@@ -520,6 +530,29 @@ static int fcoe_fip_recv(struct sk_buff *skb, struct net_device *netdev, }/** +* fcoe_fip_vlan_recv() - Handler for received FIP VLAN discovery frames +* @skb: The receive skb +* @netdev: The associated net device +* @ptype: The packet_type structure which was used to register this handler +* @orig_dev: The original net_device the the skb was received on. +* (in case dev is a bond) +* +* Returns: 0 for success +*/ +static int fcoe_fip_vlan_recv (struct sk_buff *skb,struct net_device *netdev, +struct packet_type *ptype, +struct net_device *orig_dev) +{ +struct fcoe_interface *fcoe; +struct fcoe_ctlr *ctlr; + + fcoe = container_of(ptype, struct fcoe_interface, fip_vlan_packet_type); + ctlr =fcoe_to_ctlr (fcoe); +fcoe_ctlr_recv (ctlr, skb); +return 0 ; +} + +/** * fcoe_port_send() - Send an Ethernet-encapsulated FIP/FCoE frame * @port: The FCoE port * @skb: The FIP/FCoE packet to be sent
@@ -539,7 +572,21 @@ static void fcoe_port_send(struct fcoe_port *port, struct sk_buff *skb)*/ static void fcoe_fip_send (struct fcoe_ctlr *fip,struct sk_buff *skb) { - skb->dev =fcoe_from_ctlr (fip)->netdev; +struct fcoe_interface *fcoe =fcoe_from_ctlr (fip); +struct fip_frame { +struct ethhdr eth; +struct fip_header fip; + } __packed *frame; + +/* +* Use default VLAN for FIP VLAN discovery protocol +*/ + frame = (struct fip_frame *)skb->data; +if (frame->fip.fip_op ==ntohs (FIP_OP_VLAN ) && + fcoe->realdev != fcoe->netdev) + skb->dev = fcoe->realdev; +else + skb->dev = fcoe->netdev;fcoe_port_send (lport_priv (fip->lp), skb); }
drivers/scsi/fcoe/fcoe.h +1 -0
@@ -80,6 +80,7 @@ struct fcoe_interface {struct net_device *realdev;struct packet_type fcoe_packet_type;struct packet_type fip_packet_type; +struct packet_type fip_vlan_packet_type;struct fc_exch_mgr *oem;u8 removed;u8 priority;
Signature · 1 line
1.8.5.6
Re: [PATCH 6/6] fcoe: Use default VLAN for FIP VLAN discovery
Quoted 6 lines · Hannes Reinecke
FC-BB-6 states:
FIP protocols shall be performed on a per-VLAN basis. It is recommended to use the FIP VLAN discovery protocol on the default VLAN.Signed-off-by Hannes Reinecke <[email protected]>
Given the removal of the duplicate fip_frame struct defition:
Signature · 10 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 6/6] fcoe: Use default VLAN for FIP VLAN discovery
In reply to Hannes ReineckeQuoted 6 lines · Hannes Reinecke
FC-BB-6 states:
FIP protocols shall be performed on a per-VLAN basis. It is recommended to use the FIP VLAN discovery protocol on the default VLAN.Signed-off-by Hannes Reinecke <[email protected]>
Signature · 10 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Martin K. Petersen
AppliedQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Hannes" == Hannes Reinecke <[email protected]> writes:
Hannes> Hi all, When setting up a VN2VN FCoE target there is no real Hannes> need to run fcoeadm, especially if DCB is disabled. So this Hannes> patchset implements a VIP VLAN responder which can be enabled by Hannes> writing to the sysfs attribute 'fip_vlan_responder'. Hannes> Additionally there are some fixes for VN2VN mode, most notably Hannes> the multicast address update when changing modes.
Applied patches 1-4 to 4.8/scsi-queue.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Quoted 10 lines · Martin K . Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Hannes" == Hannes Reinecke <[email protected]> writes:
Hannes> Hi all, When setting up a VN2VN FCoE target there is no real Hannes> need to run fcoeadm, especially if DCB is disabled. So this Hannes> patchset implements a VIP VLAN responder which can be enabled by Hannes> writing to the sysfs attribute '
fip_vlan_responder'. Hannes> Additionally there are some fixes for VN2VN mode, most notably Hannes> the multicast address update when changing modes.Applied patches 1-4 to 4.8/scsi-queue.
Hi Martin,
I've now Acked patches 5 and 6 as well, Hannes' answers clarified my concerns. Can you pick 'em up for 4.8 as well?
Thanks,
Johannes
Signature · 10 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Johannes" == Johannes Thumshirn <[email protected]> writes:
Johannes> I've now Acked patches 5 and 6 as well, Hannes' answers Johannes> clarified my concerns. Can you pick 'em up for 4.8 as well?
Done!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Quoted 6 lines · Martin K . Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Johannes" == Johannes Thumshirn <[email protected]> writes:
Johannes> I've now Acked patches 5 and 6 as well, Hannes' answers Johannes> clarified my concerns. Can you pick 'em up for 4.8 as well?
Done!
Thanks a lot.
Signature · 10 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html