162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright(c) 2009 Intel Corporation. All rights reserved. 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Maintained at www.Open-FCoE.org 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#ifndef _FCOE_H_ 962306a36Sopenharmony_ci#define _FCOE_H_ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <linux/skbuff.h> 1262306a36Sopenharmony_ci#include <linux/kthread.h> 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#define FCOE_MAX_QUEUE_DEPTH 256 1562306a36Sopenharmony_ci#define FCOE_MIN_QUEUE_DEPTH 32 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci#define FCOE_WORD_TO_BYTE 4 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci#define FCOE_VERSION "0.1" 2062306a36Sopenharmony_ci#define FCOE_NAME "fcoe" 2162306a36Sopenharmony_ci#define FCOE_VENDOR "Open-FCoE.org" 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci#define FCOE_MAX_LUN 0xFFFF 2462306a36Sopenharmony_ci#define FCOE_MAX_FCP_TARGET 256 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci#define FCOE_MAX_OUTSTANDING_COMMANDS 1024 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci#define FCOE_MIN_XID 0x0000 /* the min xid supported by fcoe_sw */ 2962306a36Sopenharmony_ci#define FCOE_MAX_XID 0x0FFF /* the max xid supported by fcoe_sw */ 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ciextern unsigned int fcoe_debug_logging; 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci#define FCOE_LOGGING 0x01 /* General logging, not categorized */ 3462306a36Sopenharmony_ci#define FCOE_NETDEV_LOGGING 0x02 /* Netdevice logging */ 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci#define FCOE_CHECK_LOGGING(LEVEL, CMD) \ 3762306a36Sopenharmony_cido { \ 3862306a36Sopenharmony_ci if (unlikely(fcoe_debug_logging & LEVEL)) \ 3962306a36Sopenharmony_ci do { \ 4062306a36Sopenharmony_ci CMD; \ 4162306a36Sopenharmony_ci } while (0); \ 4262306a36Sopenharmony_ci} while (0) 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci#define FCOE_DBG(fmt, args...) \ 4562306a36Sopenharmony_ci FCOE_CHECK_LOGGING(FCOE_LOGGING, \ 4662306a36Sopenharmony_ci pr_info("fcoe: " fmt, ##args);) 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#define FCOE_NETDEV_DBG(netdev, fmt, args...) \ 4962306a36Sopenharmony_ci FCOE_CHECK_LOGGING(FCOE_NETDEV_LOGGING, \ 5062306a36Sopenharmony_ci pr_info("fcoe: %s: " fmt, \ 5162306a36Sopenharmony_ci netdev->name, ##args);) 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci/** 5462306a36Sopenharmony_ci * struct fcoe_interface - A FCoE interface 5562306a36Sopenharmony_ci * @list: Handle for a list of FCoE interfaces 5662306a36Sopenharmony_ci * @netdev: The associated net device 5762306a36Sopenharmony_ci * @fcoe_packet_type: FCoE packet type 5862306a36Sopenharmony_ci * @fip_packet_type: FIP packet type 5962306a36Sopenharmony_ci * @oem: The offload exchange manager for all local port 6062306a36Sopenharmony_ci * instances associated with this port 6162306a36Sopenharmony_ci * @removed: Indicates fcoe interface removed from net device 6262306a36Sopenharmony_ci * @priority: Priority for the FCoE packet (DCB) 6362306a36Sopenharmony_ci * This structure is 1:1 with a net device. 6462306a36Sopenharmony_ci */ 6562306a36Sopenharmony_cistruct fcoe_interface { 6662306a36Sopenharmony_ci struct list_head list; 6762306a36Sopenharmony_ci struct net_device *netdev; 6862306a36Sopenharmony_ci struct net_device *realdev; 6962306a36Sopenharmony_ci struct packet_type fcoe_packet_type; 7062306a36Sopenharmony_ci struct packet_type fip_packet_type; 7162306a36Sopenharmony_ci struct packet_type fip_vlan_packet_type; 7262306a36Sopenharmony_ci struct fc_exch_mgr *oem; 7362306a36Sopenharmony_ci u8 removed; 7462306a36Sopenharmony_ci u8 priority; 7562306a36Sopenharmony_ci}; 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci#define fcoe_to_ctlr(x) \ 7862306a36Sopenharmony_ci (struct fcoe_ctlr *)(((struct fcoe_ctlr *)(x)) - 1) 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_ci#define fcoe_from_ctlr(x) \ 8162306a36Sopenharmony_ci ((struct fcoe_interface *)((x) + 1)) 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ci/** 8462306a36Sopenharmony_ci * fcoe_netdev() - Return the net device associated with a local port 8562306a36Sopenharmony_ci * @lport: The local port to get the net device from 8662306a36Sopenharmony_ci */ 8762306a36Sopenharmony_cistatic inline struct net_device *fcoe_netdev(const struct fc_lport *lport) 8862306a36Sopenharmony_ci{ 8962306a36Sopenharmony_ci return ((struct fcoe_interface *) 9062306a36Sopenharmony_ci ((struct fcoe_port *)lport_priv(lport))->priv)->netdev; 9162306a36Sopenharmony_ci} 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci#endif /* _FCOE_H_ */ 94