// SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 1999 - 2018 Intel Corporation. */ #include "ixgbe.h" #include <linux/if_ether.h> #include <linux/gfp.h> #include <linux/if_vlan.h> #include <generated/utsrelease.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_device.h> #include <scsi/fc/fc_fs.h> #include <scsi/fc/fc_fcoe.h> #include <scsi/libfc.h> #include <scsi/libfcoe.h> /** * ixgbe_fcoe_clear_ddp - clear the given ddp context * @ddp: ptr to the ixgbe_fcoe_ddp * * Returns : none * */ static inline void ixgbe_fcoe_clear_ddp(struct ixgbe_fcoe_ddp *ddp) { … } /** * ixgbe_fcoe_ddp_put - free the ddp context for a given xid * @netdev: the corresponding net_device * @xid: the xid that corresponding ddp will be freed * * This is the implementation of net_device_ops.ndo_fcoe_ddp_done * and it is expected to be called by ULD, i.e., FCP layer of libfc * to release the corresponding ddp context when the I/O is done. * * Returns : data length already ddp-ed in bytes */ int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid) { … } /** * ixgbe_fcoe_ddp_setup - called to set up ddp context * @netdev: the corresponding net_device * @xid: the exchange id requesting ddp * @sgl: the scatter-gather list for this request * @sgc: the number of scatter-gather items * @target_mode: 1 to setup target mode, 0 to setup initiator mode * * Returns : 1 for success and 0 for no ddp */ static int ixgbe_fcoe_ddp_setup(struct net_device *netdev, u16 xid, struct scatterlist *sgl, unsigned int sgc, int target_mode) { … } /** * ixgbe_fcoe_ddp_get - called to set up ddp context in initiator mode * @netdev: the corresponding net_device * @xid: the exchange id requesting ddp * @sgl: the scatter-gather list for this request * @sgc: the number of scatter-gather items * * This is the implementation of net_device_ops.ndo_fcoe_ddp_setup * and is expected to be called from ULD, e.g., FCP layer of libfc * to set up ddp for the corresponding xid of the given sglist for * the corresponding I/O. * * Returns : 1 for success and 0 for no ddp */ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, struct scatterlist *sgl, unsigned int sgc) { … } /** * ixgbe_fcoe_ddp_target - called to set up ddp context in target mode * @netdev: the corresponding net_device * @xid: the exchange id requesting ddp * @sgl: the scatter-gather list for this request * @sgc: the number of scatter-gather items * * This is the implementation of net_device_ops.ndo_fcoe_ddp_target * and is expected to be called from ULD, e.g., FCP layer of libfc * to set up ddp for the corresponding xid of the given sglist for * the corresponding I/O. The DDP in target mode is a write I/O request * from the initiator. * * Returns : 1 for success and 0 for no ddp */ int ixgbe_fcoe_ddp_target(struct net_device *netdev, u16 xid, struct scatterlist *sgl, unsigned int sgc) { … } /** * ixgbe_fcoe_ddp - check ddp status and mark it done * @adapter: ixgbe adapter * @rx_desc: advanced rx descriptor * @skb: the skb holding the received data * * This checks ddp status. * * Returns : < 0 indicates an error or not a FCiE ddp, 0 indicates * not passing the skb to ULD, > 0 indicates is the length of data * being ddped. */ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, union ixgbe_adv_rx_desc *rx_desc, struct sk_buff *skb) { … } /** * ixgbe_fso - ixgbe FCoE Sequence Offload (FSO) * @tx_ring: tx desc ring * @first: first tx_buffer structure containing skb, tx_flags, and protocol * @hdr_len: hdr_len to be returned * * This sets up large send offload for FCoE * * Returns : 0 indicates success, < 0 for error */ int ixgbe_fso(struct ixgbe_ring *tx_ring, struct ixgbe_tx_buffer *first, u8 *hdr_len) { … } static void ixgbe_fcoe_dma_pool_free(struct ixgbe_fcoe *fcoe, unsigned int cpu) { … } static int ixgbe_fcoe_dma_pool_alloc(struct ixgbe_fcoe *fcoe, struct device *dev, unsigned int cpu) { … } /** * ixgbe_configure_fcoe - configures registers for fcoe at start * @adapter: ptr to ixgbe adapter * * This sets up FCoE related registers * * Returns : none */ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter) { … } /** * ixgbe_free_fcoe_ddp_resources - release all fcoe ddp context resources * @adapter : ixgbe adapter * * Cleans up outstanding ddp context resources * * Returns : none */ void ixgbe_free_fcoe_ddp_resources(struct ixgbe_adapter *adapter) { … } /** * ixgbe_setup_fcoe_ddp_resources - setup all fcoe ddp context resources * @adapter: ixgbe adapter * * Sets up ddp context resouces * * Returns : 0 indicates success or -EINVAL on failure */ int ixgbe_setup_fcoe_ddp_resources(struct ixgbe_adapter *adapter) { … } static int ixgbe_fcoe_ddp_enable(struct ixgbe_adapter *adapter) { … } static void ixgbe_fcoe_ddp_disable(struct ixgbe_adapter *adapter) { … } /** * ixgbe_fcoe_enable - turn on FCoE offload feature * @netdev: the corresponding netdev * * Turns on FCoE offload feature in 82599. * * Returns : 0 indicates success or -EINVAL on failure */ int ixgbe_fcoe_enable(struct net_device *netdev) { … } /** * ixgbe_fcoe_disable - turn off FCoE offload feature * @netdev: the corresponding netdev * * Turns off FCoE offload feature in 82599. * * Returns : 0 indicates success or -EINVAL on failure */ int ixgbe_fcoe_disable(struct net_device *netdev) { … } /** * ixgbe_fcoe_get_wwn - get world wide name for the node or the port * @netdev : ixgbe adapter * @wwn : the world wide name * @type: the type of world wide name * * Returns the node or port world wide name if both the prefix and the san * mac address are valid, then the wwn is formed based on the NAA-2 for * IEEE Extended name identifier (ref. to T10 FC-LS Spec., Sec. 15.3). * * Returns : 0 on success */ int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type) { … } /** * ixgbe_fcoe_get_hbainfo - get FCoE HBA information * @netdev : ixgbe adapter * @info : HBA information * * Returns ixgbe HBA information * * Returns : 0 on success */ int ixgbe_fcoe_get_hbainfo(struct net_device *netdev, struct netdev_fcoe_hbainfo *info) { … } /** * ixgbe_fcoe_get_tc - get the current TC that fcoe is mapped to * @adapter: pointer to the device adapter structure * * Return : TC that FCoE is mapped to */ u8 ixgbe_fcoe_get_tc(struct ixgbe_adapter *adapter) { … }