File Index
Files and directories
Sign in
FILE

fip.h

File preview with syntax highlighting.

linux-6.19.14/drivers/scsi/fnic/fip.h C
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
  3 * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
  4 * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
  5 */
  6#ifndef _FIP_H_
  7#define _FIP_H_
  8
  9#include "fdls_fc.h"
 10#include "fnic_fdls.h"
 11#include <scsi/fc/fc_fip.h>
 12
 13/* Drop the cast from the standard definition */
 14#define FCOE_ALL_FCFS_MAC {0x01, 0x10, 0x18, 0x01, 0x00, 0x02}
 15#define FCOE_MAX_SIZE 0x082E
 16
 17#define FCOE_CTLR_FIPVLAN_TOV (3*1000)
 18#define FCOE_CTLR_FCS_TOV     (3*1000)
 19#define FCOE_CTLR_MAX_SOL      (5*1000)
 20
 21#define FIP_DISC_SOL_LEN (6)
 22#define FIP_VLAN_REQ_LEN (2)
 23#define FIP_ENODE_KA_LEN (2)
 24#define FIP_VN_KA_LEN (7)
 25#define FIP_FLOGI_LEN (38)
 26
 27enum fdls_vlan_state {
 28	FIP_VLAN_AVAIL,
 29	FIP_VLAN_SENT
 30};
 31
 32enum fdls_fip_state {
 33	FDLS_FIP_INIT,
 34	FDLS_FIP_VLAN_DISCOVERY_STARTED,
 35	FDLS_FIP_FCF_DISCOVERY_STARTED,
 36	FDLS_FIP_FLOGI_STARTED,
 37	FDLS_FIP_FLOGI_COMPLETE,
 38};
 39
 40/*
 41 * VLAN entry.
 42 */
 43struct fcoe_vlan {
 44	struct list_head list;
 45	uint16_t vid;		/* vlan ID */
 46	uint16_t sol_count;	/* no. of sols sent */
 47	uint16_t state;		/* state */
 48};
 49
 50struct fip_vlan_req {
 51	struct ethhdr eth;
 52	struct fip_header fip;
 53	struct fip_mac_desc mac_desc;
 54} __packed;
 55
 56struct fip_vlan_notif {
 57	struct fip_header fip;
 58	struct fip_vlan_desc vlans_desc[];
 59} __packed;
 60
 61struct fip_vn_port_ka {
 62	struct ethhdr eth;
 63	struct fip_header fip;
 64	struct fip_mac_desc mac_desc;
 65	struct fip_vn_desc vn_port_desc;
 66} __packed;
 67
 68struct fip_enode_ka {
 69	struct ethhdr eth;
 70	struct fip_header fip;
 71	struct fip_mac_desc mac_desc;
 72} __packed;
 73
 74struct fip_cvl {
 75	struct fip_header fip;
 76	struct fip_mac_desc fcf_mac_desc;
 77	struct fip_wwn_desc name_desc;
 78	struct fip_vn_desc vn_ports_desc[];
 79} __packed;
 80
 81struct fip_flogi_desc {
 82	struct fip_desc fd_desc;
 83	uint16_t rsvd;
 84	struct fc_std_flogi flogi;
 85} __packed;
 86
 87struct fip_flogi_rsp_desc {
 88	struct fip_desc fd_desc;
 89	uint16_t rsvd;
 90	struct fc_std_flogi flogi;
 91} __packed;
 92
 93struct fip_flogi {
 94	struct ethhdr eth;
 95	struct fip_header fip;
 96	struct fip_flogi_desc flogi_desc;
 97	struct fip_mac_desc mac_desc;
 98} __packed;
 99
100struct fip_flogi_rsp {
101	struct fip_header fip;
102	struct fip_flogi_rsp_desc rsp_desc;
103	struct fip_mac_desc mac_desc;
104} __packed;
105
106struct fip_discovery {
107	struct ethhdr eth;
108	struct fip_header fip;
109	struct fip_mac_desc mac_desc;
110	struct fip_wwn_desc name_desc;
111	struct fip_size_desc fcoe_desc;
112} __packed;
113
114struct fip_disc_adv {
115	struct fip_header fip;
116	struct fip_pri_desc prio_desc;
117	struct fip_mac_desc mac_desc;
118	struct fip_wwn_desc name_desc;
119	struct fip_fab_desc fabric_desc;
120	struct fip_fka_desc fka_adv_desc;
121} __packed;
122
123void fnic_fcoe_process_vlan_resp(struct fnic *fnic, struct fip_header *fiph);
124void fnic_fcoe_fip_discovery_resp(struct fnic *fnic, struct fip_header *fiph);
125void fnic_fcoe_process_flogi_resp(struct fnic *fnic, struct fip_header *fiph);
126void fnic_work_on_fip_timer(struct work_struct *work);
127void fnic_work_on_fcs_ka_timer(struct work_struct *work);
128void fnic_fcoe_send_vlan_req(struct fnic *fnic);
129void fnic_fcoe_start_fcf_discovery(struct fnic *fnic);
130void fnic_fcoe_start_flogi(struct fnic *fnic);
131void fnic_fcoe_process_cvl(struct fnic *fnic, struct fip_header *fiph);
132void fnic_vlan_discovery_timeout(struct fnic *fnic);
133
134extern struct workqueue_struct *fnic_fip_queue;
135
136#ifdef FNIC_DEBUG
137static inline void
138fnic_debug_dump_fip_frame(struct fnic *fnic, struct ethhdr *eth,
139				int len, char *pfx)
140{
141	struct fip_header *fiph = (struct fip_header *)(eth + 1);
142	u16 op = be16_to_cpu(fiph->fip_op);
143	u8 sub = fiph->fip_subcode;
144
145	FNIC_FCS_DBG(KERN_DEBUG, fnic->host, fnic->fnic_num,
146		"FIP %s packet contents: op: 0x%x sub: 0x%x (len = %d)",
147		pfx, op, sub, len);
148
149	fnic_debug_dump(fnic, (uint8_t *)eth, len);
150}
151
152#else /* FNIC_DEBUG */
153
154static inline void
155fnic_debug_dump_fip_frame(struct fnic *fnic, struct ethhdr *eth,
156				int len, char *pfx) {}
157#endif /* FNIC_DEBUG */
158
159#endif	/* _FIP_H_ */
~/ Read-only file preview.