18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* Copyright(c) 1999 - 2018 Intel Corporation. */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#ifndef _IXGBE_FCOE_H 58c2ecf20Sopenharmony_ci#define _IXGBE_FCOE_H 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <scsi/fc/fc_fs.h> 88c2ecf20Sopenharmony_ci#include <scsi/fc/fc_fcoe.h> 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/* shift bits within STAT fo FCSTAT */ 118c2ecf20Sopenharmony_ci#define IXGBE_RXDADV_FCSTAT_SHIFT 4 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* ddp user buffer */ 148c2ecf20Sopenharmony_ci#define IXGBE_BUFFCNT_MAX 256 /* 8 bits bufcnt */ 158c2ecf20Sopenharmony_ci#define IXGBE_FCPTR_ALIGN 16 168c2ecf20Sopenharmony_ci#define IXGBE_FCPTR_MAX (IXGBE_BUFFCNT_MAX * sizeof(dma_addr_t)) 178c2ecf20Sopenharmony_ci#define IXGBE_FCBUFF_4KB 0x0 188c2ecf20Sopenharmony_ci#define IXGBE_FCBUFF_8KB 0x1 198c2ecf20Sopenharmony_ci#define IXGBE_FCBUFF_16KB 0x2 208c2ecf20Sopenharmony_ci#define IXGBE_FCBUFF_64KB 0x3 218c2ecf20Sopenharmony_ci#define IXGBE_FCBUFF_MAX 65536 /* 64KB max */ 228c2ecf20Sopenharmony_ci#define IXGBE_FCBUFF_MIN 4096 /* 4KB min */ 238c2ecf20Sopenharmony_ci#define IXGBE_FCOE_DDP_MAX 512 /* 9 bits xid */ 248c2ecf20Sopenharmony_ci#define IXGBE_FCOE_DDP_MAX_X550 2048 /* 11 bits xid */ 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* Default traffic class to use for FCoE */ 278c2ecf20Sopenharmony_ci#define IXGBE_FCOE_DEFTC 3 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/* fcerr */ 308c2ecf20Sopenharmony_ci#define IXGBE_FCERR_BADCRC 0x00100000 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci/* FCoE DDP for target mode */ 338c2ecf20Sopenharmony_ci#define __IXGBE_FCOE_TARGET 1 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cistruct ixgbe_fcoe_ddp { 368c2ecf20Sopenharmony_ci int len; 378c2ecf20Sopenharmony_ci u32 err; 388c2ecf20Sopenharmony_ci unsigned int sgc; 398c2ecf20Sopenharmony_ci struct scatterlist *sgl; 408c2ecf20Sopenharmony_ci dma_addr_t udp; 418c2ecf20Sopenharmony_ci u64 *udl; 428c2ecf20Sopenharmony_ci struct dma_pool *pool; 438c2ecf20Sopenharmony_ci}; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci/* per cpu variables */ 468c2ecf20Sopenharmony_cistruct ixgbe_fcoe_ddp_pool { 478c2ecf20Sopenharmony_ci struct dma_pool *pool; 488c2ecf20Sopenharmony_ci u64 noddp; 498c2ecf20Sopenharmony_ci u64 noddp_ext_buff; 508c2ecf20Sopenharmony_ci}; 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_cistruct ixgbe_fcoe { 538c2ecf20Sopenharmony_ci struct ixgbe_fcoe_ddp_pool __percpu *ddp_pool; 548c2ecf20Sopenharmony_ci atomic_t refcnt; 558c2ecf20Sopenharmony_ci spinlock_t lock; 568c2ecf20Sopenharmony_ci struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX_X550]; 578c2ecf20Sopenharmony_ci void *extra_ddp_buffer; 588c2ecf20Sopenharmony_ci dma_addr_t extra_ddp_buffer_dma; 598c2ecf20Sopenharmony_ci unsigned long mode; 608c2ecf20Sopenharmony_ci u8 up; 618c2ecf20Sopenharmony_ci}; 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci#endif /* _IXGBE_FCOE_H */ 64