mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
scsi: fnic: Add and integrate support for FIP
Add and integrate support for FCoE Initialization (protocol) FIP. This protocol will be exercised on Cisco UCS rack servers. Add support to specifically print FIP related debug messages. Replace existing definitions to handle new data structures. Clean up old and obsolete definitions. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202409291955.FcMZfNSt-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202412081904.pXwdx15J-lkp@intel.com/ Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com> Co-developed-by: Gian Carlo Boffa <gcboffa@cisco.com> Signed-off-by: Gian Carlo Boffa <gcboffa@cisco.com> Co-developed-by: Arulprabhu Ponnusamy <arulponn@cisco.com> Signed-off-by: Arulprabhu Ponnusamy <arulponn@cisco.com> Co-developed-by: Arun Easi <aeasi@cisco.com> Signed-off-by: Arun Easi <aeasi@cisco.com> Co-developed-by: Karan Tilak Kumar <kartilak@cisco.com> Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com> Link: https://lore.kernel.org/r/20241212020312.4786-9-kartilak@cisco.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
09c1e6ab4a
commit
098585aa8a
@@ -2,6 +2,7 @@
|
||||
obj-$(CONFIG_FCOE_FNIC) += fnic.o
|
||||
|
||||
fnic-y := \
|
||||
fip.o\
|
||||
fnic_attrs.o \
|
||||
fnic_isr.o \
|
||||
fnic_main.o \
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,157 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright 2008 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright 2007 Nuova Systems, Inc. All rights reserved.
|
||||
*/
|
||||
#ifndef _FIP_H_
|
||||
#define _FIP_H_
|
||||
|
||||
#include "fdls_fc.h"
|
||||
#include "fnic_fdls.h"
|
||||
#include <scsi/fc/fc_fip.h>
|
||||
|
||||
/* Drop the cast from the standard definition */
|
||||
#define FCOE_ALL_FCFS_MAC {0x01, 0x10, 0x18, 0x01, 0x00, 0x02}
|
||||
#define FCOE_MAX_SIZE 0x082E
|
||||
|
||||
#define FCOE_CTLR_FIPVLAN_TOV (3*1000)
|
||||
#define FCOE_CTLR_FCS_TOV (3*1000)
|
||||
#define FCOE_CTLR_MAX_SOL (5*1000)
|
||||
|
||||
#define FIP_DISC_SOL_LEN (6)
|
||||
#define FIP_VLAN_REQ_LEN (2)
|
||||
#define FIP_ENODE_KA_LEN (2)
|
||||
#define FIP_VN_KA_LEN (7)
|
||||
#define FIP_FLOGI_LEN (38)
|
||||
|
||||
enum fdls_vlan_state {
|
||||
FIP_VLAN_AVAIL,
|
||||
FIP_VLAN_SENT
|
||||
};
|
||||
|
||||
enum fdls_fip_state {
|
||||
FDLS_FIP_INIT,
|
||||
FDLS_FIP_VLAN_DISCOVERY_STARTED,
|
||||
FDLS_FIP_FCF_DISCOVERY_STARTED,
|
||||
FDLS_FIP_FLOGI_STARTED,
|
||||
FDLS_FIP_FLOGI_COMPLETE,
|
||||
};
|
||||
|
||||
/*
|
||||
* VLAN entry.
|
||||
*/
|
||||
struct fcoe_vlan {
|
||||
struct list_head list;
|
||||
uint16_t vid; /* vlan ID */
|
||||
uint16_t sol_count; /* no. of sols sent */
|
||||
uint16_t state; /* state */
|
||||
};
|
||||
|
||||
struct fip_vlan_req {
|
||||
struct ethhdr eth;
|
||||
struct fip_header fip;
|
||||
struct fip_mac_desc mac_desc;
|
||||
} __packed;
|
||||
|
||||
struct fip_vlan_notif {
|
||||
struct fip_header fip;
|
||||
struct fip_vlan_desc vlans_desc[];
|
||||
} __packed;
|
||||
|
||||
struct fip_vn_port_ka {
|
||||
struct ethhdr eth;
|
||||
struct fip_header fip;
|
||||
struct fip_mac_desc mac_desc;
|
||||
struct fip_vn_desc vn_port_desc;
|
||||
} __packed;
|
||||
|
||||
struct fip_enode_ka {
|
||||
struct ethhdr eth;
|
||||
struct fip_header fip;
|
||||
struct fip_mac_desc mac_desc;
|
||||
} __packed;
|
||||
|
||||
struct fip_cvl {
|
||||
struct fip_header fip;
|
||||
struct fip_mac_desc fcf_mac_desc;
|
||||
struct fip_wwn_desc name_desc;
|
||||
struct fip_vn_desc vn_ports_desc[];
|
||||
} __packed;
|
||||
|
||||
struct fip_flogi_desc {
|
||||
struct fip_desc fd_desc;
|
||||
uint16_t rsvd;
|
||||
struct fc_std_flogi flogi;
|
||||
} __packed;
|
||||
|
||||
struct fip_flogi_rsp_desc {
|
||||
struct fip_desc fd_desc;
|
||||
uint16_t rsvd;
|
||||
struct fc_std_flogi flogi;
|
||||
} __packed;
|
||||
|
||||
struct fip_flogi {
|
||||
struct ethhdr eth;
|
||||
struct fip_header fip;
|
||||
struct fip_flogi_desc flogi_desc;
|
||||
struct fip_mac_desc mac_desc;
|
||||
} __packed;
|
||||
|
||||
struct fip_flogi_rsp {
|
||||
struct fip_header fip;
|
||||
struct fip_flogi_rsp_desc rsp_desc;
|
||||
struct fip_mac_desc mac_desc;
|
||||
} __packed;
|
||||
|
||||
struct fip_discovery {
|
||||
struct ethhdr eth;
|
||||
struct fip_header fip;
|
||||
struct fip_mac_desc mac_desc;
|
||||
struct fip_wwn_desc name_desc;
|
||||
struct fip_size_desc fcoe_desc;
|
||||
} __packed;
|
||||
|
||||
struct fip_disc_adv {
|
||||
struct fip_header fip;
|
||||
struct fip_pri_desc prio_desc;
|
||||
struct fip_mac_desc mac_desc;
|
||||
struct fip_wwn_desc name_desc;
|
||||
struct fip_fab_desc fabric_desc;
|
||||
struct fip_fka_desc fka_adv_desc;
|
||||
} __packed;
|
||||
|
||||
void fnic_fcoe_process_vlan_resp(struct fnic *fnic, struct fip_header *fiph);
|
||||
void fnic_fcoe_fip_discovery_resp(struct fnic *fnic, struct fip_header *fiph);
|
||||
void fnic_fcoe_process_flogi_resp(struct fnic *fnic, struct fip_header *fiph);
|
||||
void fnic_work_on_fip_timer(struct work_struct *work);
|
||||
void fnic_work_on_fcs_ka_timer(struct work_struct *work);
|
||||
void fnic_fcoe_send_vlan_req(struct fnic *fnic);
|
||||
void fnic_fcoe_start_fcf_discovery(struct fnic *fnic);
|
||||
void fnic_fcoe_start_flogi(struct fnic *fnic);
|
||||
void fnic_fcoe_process_cvl(struct fnic *fnic, struct fip_header *fiph);
|
||||
void fnic_vlan_discovery_timeout(struct fnic *fnic);
|
||||
|
||||
#ifdef FNIC_DEBUG
|
||||
static inline void
|
||||
fnic_debug_dump_fip_frame(struct fnic *fnic, struct ethhdr *eth,
|
||||
int len, char *pfx)
|
||||
{
|
||||
struct fip_header *fiph = (struct fip_header *)(eth + 1);
|
||||
u16 op = be16_to_cpu(fiph->fip_op);
|
||||
u8 sub = fiph->fip_subcode;
|
||||
|
||||
FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, fnic->fnic_num,
|
||||
"FIP %s packet contents: op: 0x%x sub: 0x%x (len = %d)",
|
||||
pfx, op, sub, len);
|
||||
|
||||
fnic_debug_dump(fnic, (uint8_t *)eth, len);
|
||||
}
|
||||
|
||||
#else /* FNIC_DEBUG */
|
||||
|
||||
static inline void
|
||||
fnic_debug_dump_fip_frame(struct fnic *fnic, struct ethhdr *eth,
|
||||
int len, char *pfx) {}
|
||||
#endif /* FNIC_DEBUG */
|
||||
|
||||
#endif /* _FIP_H_ */
|
||||
@@ -235,6 +235,12 @@ do { \
|
||||
"fnic<%d>: %s: %d: " fmt, fnic_num,\
|
||||
__func__, __LINE__, ##args);)
|
||||
|
||||
#define FNIC_FIP_DBG(kern_level, host, fnic_num, fmt, args...) \
|
||||
FNIC_CHECK_LOGGING(FNIC_FCS_LOGGING, \
|
||||
shost_printk(kern_level, host, \
|
||||
"fnic<%d>: %s: %d: " fmt, fnic_num,\
|
||||
__func__, __LINE__, ##args);)
|
||||
|
||||
#define FNIC_SCSI_DBG(kern_level, host, fnic_num, fmt, args...) \
|
||||
FNIC_CHECK_LOGGING(FNIC_SCSI_LOGGING, \
|
||||
shost_printk(kern_level, host, \
|
||||
@@ -416,13 +422,15 @@ struct fnic {
|
||||
/*** FIP related data members -- start ***/
|
||||
void (*set_vlan)(struct fnic *, u16 vlan);
|
||||
struct work_struct fip_frame_work;
|
||||
struct sk_buff_head fip_frame_queue;
|
||||
struct work_struct fip_timer_work;
|
||||
struct list_head fip_frame_queue;
|
||||
struct timer_list fip_timer;
|
||||
struct list_head vlans;
|
||||
spinlock_t vlans_lock;
|
||||
|
||||
struct work_struct event_work;
|
||||
struct list_head evlist;
|
||||
struct timer_list retry_fip_timer;
|
||||
struct timer_list fcs_ka_timer;
|
||||
struct timer_list enode_ka_timer;
|
||||
struct timer_list vn_ka_timer;
|
||||
struct list_head vlan_list;
|
||||
/*** FIP related data members -- end ***/
|
||||
|
||||
/* copy work queue cache line section */
|
||||
@@ -472,9 +480,6 @@ int fnic_rq_cmpl_handler(struct fnic *fnic, int);
|
||||
int fnic_alloc_rq_frame(struct vnic_rq *rq);
|
||||
void fnic_free_rq_buf(struct vnic_rq *rq, struct vnic_rq_buf *buf);
|
||||
void fnic_flush_tx(struct work_struct *work);
|
||||
void fnic_eth_send(struct fcoe_ctlr *, struct sk_buff *skb);
|
||||
void fnic_set_port_id(struct fc_lport *, u32, struct fc_frame *);
|
||||
void fnic_update_mac(struct fc_lport *, u8 *new);
|
||||
void fnic_update_mac_locked(struct fnic *, u8 *new);
|
||||
|
||||
int fnic_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
|
||||
@@ -503,7 +508,7 @@ int fnic_is_abts_pending(struct fnic *, struct scsi_cmnd *);
|
||||
void fnic_handle_fip_frame(struct work_struct *work);
|
||||
void fnic_handle_fip_event(struct fnic *fnic);
|
||||
void fnic_fcoe_reset_vlans(struct fnic *fnic);
|
||||
void fnic_fcoe_evlist_free(struct fnic *fnic);
|
||||
extern void fnic_handle_fip_timer(struct timer_list *t);
|
||||
|
||||
static inline int
|
||||
fnic_chk_state_flags_locked(struct fnic *fnic, unsigned long st_flags)
|
||||
|
||||
+120
-735
File diff suppressed because it is too large
Load Diff
@@ -1,48 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright 2008 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright 2007 Nuova Systems, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _FNIC_FIP_H_
|
||||
#define _FNIC_FIP_H_
|
||||
|
||||
|
||||
#define FCOE_CTLR_START_DELAY 2000 /* ms after first adv. to choose FCF */
|
||||
#define FCOE_CTLR_FIPVLAN_TOV 2000 /* ms after FIP VLAN disc */
|
||||
#define FCOE_CTLR_MAX_SOL 8
|
||||
|
||||
#define FINC_MAX_FLOGI_REJECTS 8
|
||||
|
||||
struct vlan {
|
||||
__be16 vid;
|
||||
__be16 type;
|
||||
};
|
||||
|
||||
/*
|
||||
* VLAN entry.
|
||||
*/
|
||||
struct fcoe_vlan {
|
||||
struct list_head list;
|
||||
u16 vid; /* vlan ID */
|
||||
u16 sol_count; /* no. of sols sent */
|
||||
u16 state; /* state */
|
||||
};
|
||||
|
||||
enum fip_vlan_state {
|
||||
FIP_VLAN_AVAIL = 0, /* don't do anything */
|
||||
FIP_VLAN_SENT = 1, /* sent */
|
||||
FIP_VLAN_USED = 2, /* succeed */
|
||||
FIP_VLAN_FAILED = 3, /* failed to response */
|
||||
};
|
||||
|
||||
struct fip_vlan {
|
||||
struct ethhdr eth;
|
||||
struct fip_header fip;
|
||||
struct {
|
||||
struct fip_mac_desc mac;
|
||||
struct fip_wwn_desc wwnn;
|
||||
} desc;
|
||||
};
|
||||
|
||||
#endif /* __FINC_FIP_H_ */
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "vnic_intr.h"
|
||||
#include "vnic_stats.h"
|
||||
#include "fnic_io.h"
|
||||
#include "fnic_fip.h"
|
||||
#include "fnic.h"
|
||||
#include "fnic_fdls.h"
|
||||
#include "fdls_fc.h"
|
||||
@@ -87,12 +86,13 @@ module_param(fnic_max_qdepth, uint, S_IRUGO|S_IWUSR);
|
||||
MODULE_PARM_DESC(fnic_max_qdepth, "Queue depth to report for each LUN");
|
||||
|
||||
static struct libfc_function_template fnic_transport_template = {
|
||||
.lport_set_port_id = fnic_set_port_id,
|
||||
.fcp_abort_io = fnic_empty_scsi_cleanup,
|
||||
.fcp_cleanup = fnic_empty_scsi_cleanup,
|
||||
.exch_mgr_reset = fnic_exch_mgr_reset
|
||||
};
|
||||
|
||||
struct workqueue_struct *fnic_fip_queue;
|
||||
|
||||
static int fnic_slave_alloc(struct scsi_device *sdev)
|
||||
{
|
||||
struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
|
||||
@@ -415,13 +415,6 @@ static void fnic_notify_timer(struct timer_list *t)
|
||||
round_jiffies(jiffies + FNIC_NOTIFY_TIMER_PERIOD));
|
||||
}
|
||||
|
||||
static void fnic_fip_notify_timer(struct timer_list *t)
|
||||
{
|
||||
struct fnic *fnic = from_timer(fnic, t, fip_timer);
|
||||
|
||||
/* Placeholder function */
|
||||
}
|
||||
|
||||
static void fnic_notify_timer_start(struct fnic *fnic)
|
||||
{
|
||||
switch (vnic_dev_get_intr_mode(fnic->vdev)) {
|
||||
@@ -535,17 +528,6 @@ static void fnic_iounmap(struct fnic *fnic)
|
||||
iounmap(fnic->bar0.vaddr);
|
||||
}
|
||||
|
||||
/**
|
||||
* fnic_get_mac() - get assigned data MAC address for FIP code.
|
||||
* @lport: local port.
|
||||
*/
|
||||
static u8 *fnic_get_mac(struct fc_lport *lport)
|
||||
{
|
||||
struct fnic *fnic = lport_priv(lport);
|
||||
|
||||
return fnic->data_src_addr;
|
||||
}
|
||||
|
||||
static void fnic_set_vlan(struct fnic *fnic, u16 vlan_id)
|
||||
{
|
||||
vnic_dev_set_default_vlan(fnic->vdev, vlan_id);
|
||||
@@ -829,25 +811,22 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
fnic->vlan_hw_insert = 1;
|
||||
fnic->vlan_id = 0;
|
||||
|
||||
/* Initialize the FIP fcoe_ctrl struct */
|
||||
fnic->ctlr.send = fnic_eth_send;
|
||||
fnic->ctlr.update_mac = fnic_update_mac;
|
||||
fnic->ctlr.get_src_addr = fnic_get_mac;
|
||||
if (fnic->config.flags & VFCF_FIP_CAPABLE) {
|
||||
dev_info(&fnic->pdev->dev, "firmware supports FIP\n");
|
||||
/* enable directed and multicast */
|
||||
vnic_dev_packet_filter(fnic->vdev, 1, 1, 0, 0, 0);
|
||||
vnic_dev_add_addr(fnic->vdev, FIP_ALL_ENODE_MACS);
|
||||
vnic_dev_add_addr(fnic->vdev, fnic->ctlr.ctl_src_addr);
|
||||
fnic->set_vlan = fnic_set_vlan;
|
||||
fcoe_ctlr_init(&fnic->ctlr, FIP_MODE_AUTO);
|
||||
timer_setup(&fnic->fip_timer, fnic_fip_notify_timer, 0);
|
||||
spin_lock_init(&fnic->vlans_lock);
|
||||
INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame);
|
||||
INIT_WORK(&fnic->event_work, fnic_handle_event);
|
||||
skb_queue_head_init(&fnic->fip_frame_queue);
|
||||
INIT_LIST_HEAD(&fnic->evlist);
|
||||
INIT_LIST_HEAD(&fnic->vlans);
|
||||
INIT_LIST_HEAD(&fnic->fip_frame_queue);
|
||||
INIT_LIST_HEAD(&fnic->vlan_list);
|
||||
timer_setup(&fnic->retry_fip_timer, fnic_handle_fip_timer, 0);
|
||||
timer_setup(&fnic->fcs_ka_timer, fnic_handle_fcs_ka_timer, 0);
|
||||
timer_setup(&fnic->enode_ka_timer, fnic_handle_enode_ka_timer, 0);
|
||||
timer_setup(&fnic->vn_ka_timer, fnic_handle_vn_ka_timer, 0);
|
||||
fnic->set_vlan = fnic_set_vlan;
|
||||
} else {
|
||||
dev_info(&fnic->pdev->dev, "firmware uses non-FIP mode\n");
|
||||
fcoe_ctlr_init(&fnic->ctlr, FIP_MODE_NON_FIP);
|
||||
@@ -1057,10 +1036,13 @@ static void fnic_remove(struct pci_dev *pdev)
|
||||
fnic_free_txq(&fnic->tx_queue);
|
||||
|
||||
if (fnic->config.flags & VFCF_FIP_CAPABLE) {
|
||||
del_timer_sync(&fnic->fip_timer);
|
||||
skb_queue_purge(&fnic->fip_frame_queue);
|
||||
del_timer_sync(&fnic->retry_fip_timer);
|
||||
del_timer_sync(&fnic->fcs_ka_timer);
|
||||
del_timer_sync(&fnic->enode_ka_timer);
|
||||
del_timer_sync(&fnic->vn_ka_timer);
|
||||
|
||||
fnic_free_txq(&fnic->fip_frame_queue);
|
||||
fnic_fcoe_reset_vlans(fnic);
|
||||
fnic_fcoe_evlist_free(fnic);
|
||||
}
|
||||
|
||||
if ((fnic_fdmi_support == 1) && (fnic->iport.fabric.fdmi_pending > 0))
|
||||
|
||||
Reference in New Issue
Block a user