Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * This program is free software; you may redistribute it and/or modify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * it under the terms of the GNU General Public License as published by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * the Free Software Foundation; version 2 of the License.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #ifndef _FNIC_RES_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define _FNIC_RES_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include "wq_enet_desc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include "rq_enet_desc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include "vnic_wq.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include "vnic_rq.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include "fnic_io.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include "fcpio.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include "vnic_wq_copy.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include "vnic_cq_copy.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) static inline void fnic_queue_wq_desc(struct vnic_wq *wq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 				      void *os_buf, dma_addr_t dma_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 				      unsigned int len, unsigned int fc_eof,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 				      int vlan_tag_insert,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 				      unsigned int vlan_tag,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 				      int cq_entry, int sop, int eop)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	struct wq_enet_desc *desc = vnic_wq_next_desc(wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	wq_enet_desc_enc(desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 			 (u64)dma_addr | VNIC_PADDR_TARGET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 			 (u16)len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 			 0, /* mss_or_csum_offset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 			 (u16)fc_eof,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 			 0, /* offload_mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 			 (u8)eop, (u8)cq_entry,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 			 1, /* fcoe_encap */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 			 (u8)vlan_tag_insert,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 			 (u16)vlan_tag,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 			 0 /* loopback */);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	vnic_wq_post(wq, os_buf, dma_addr, len, sop, eop);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) static inline void fnic_queue_wq_eth_desc(struct vnic_wq *wq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 				      void *os_buf, dma_addr_t dma_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 				      unsigned int len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 				      int vlan_tag_insert,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 				      unsigned int vlan_tag,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 				      int cq_entry)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	struct wq_enet_desc *desc = vnic_wq_next_desc(wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	wq_enet_desc_enc(desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 			 (u64)dma_addr | VNIC_PADDR_TARGET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 			 (u16)len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 			 0, /* mss_or_csum_offset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 			 0, /* fc_eof */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 			 0, /* offload_mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 			 1, /* eop */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 			 (u8)cq_entry,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 			 0, /* fcoe_encap */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 			 (u8)vlan_tag_insert,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 			 (u16)vlan_tag,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 			 0 /* loopback */);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	vnic_wq_post(wq, os_buf, dma_addr, len, 1, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) static inline void fnic_queue_wq_copy_desc_icmnd_16(struct vnic_wq_copy *wq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 						    u32 req_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 						    u32 lunmap_id, u8 spl_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 						    u32 sgl_cnt, u32 sense_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 						    u64 sgl_addr, u64 sns_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 						    u8 crn, u8 pri_ta,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 						    u8 flags, u8 *scsi_cdb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 						    u8 cdb_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 						    u32 data_len, u8 *lun,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 						    u32 d_id, u16 mss,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 						    u32 ratov, u32 edtov)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	struct fcpio_host_req *desc = vnic_wq_copy_next_desc(wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	desc->hdr.type = FCPIO_ICMND_16; /* enum fcpio_type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	desc->hdr.status = 0;            /* header status entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	desc->hdr._resvd = 0;            /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	desc->hdr.tag.u.req_id = req_id; /* id for this request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	desc->u.icmnd_16.lunmap_id = lunmap_id; /* index into lunmap table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	desc->u.icmnd_16.special_req_flags = spl_flags; /* exch req flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	desc->u.icmnd_16._resvd0[0] = 0;        /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	desc->u.icmnd_16._resvd0[1] = 0;        /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	desc->u.icmnd_16._resvd0[2] = 0;        /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	desc->u.icmnd_16.sgl_cnt = sgl_cnt;     /* scatter-gather list count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	desc->u.icmnd_16.sense_len = sense_len; /* sense buffer length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	desc->u.icmnd_16.sgl_addr = sgl_addr;   /* scatter-gather list addr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	desc->u.icmnd_16.sense_addr = sns_addr; /* sense buffer address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	desc->u.icmnd_16.crn = crn;             /* SCSI Command Reference No.*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	desc->u.icmnd_16.pri_ta = pri_ta; 	/* SCSI Pri & Task attribute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	desc->u.icmnd_16._resvd1 = 0;           /* reserved: should be 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	desc->u.icmnd_16.flags = flags;         /* command flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	memset(desc->u.icmnd_16.scsi_cdb, 0, CDB_16);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	memcpy(desc->u.icmnd_16.scsi_cdb, scsi_cdb, cdb_len);    /* SCSI CDB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	desc->u.icmnd_16.data_len = data_len;   /* length of data expected */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	memcpy(desc->u.icmnd_16.lun, lun, LUN_ADDRESS);  /* LUN address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	desc->u.icmnd_16._resvd2 = 0;          	/* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	hton24(desc->u.icmnd_16.d_id, d_id);	/* FC vNIC only: Target D_ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	desc->u.icmnd_16.mss = mss;            	/* FC vNIC only: max burst */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	desc->u.icmnd_16.r_a_tov = ratov; /*FC vNIC only: Res. Alloc Timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	desc->u.icmnd_16.e_d_tov = edtov; /*FC vNIC only: Err Detect Timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	vnic_wq_copy_post(wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) static inline void fnic_queue_wq_copy_desc_itmf(struct vnic_wq_copy *wq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 						u32 req_id, u32 lunmap_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 						u32 tm_req, u32 tm_id, u8 *lun,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 						u32 d_id, u32 r_a_tov,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 						u32 e_d_tov)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	struct fcpio_host_req *desc = vnic_wq_copy_next_desc(wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	desc->hdr.type = FCPIO_ITMF;     /* enum fcpio_type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	desc->hdr.status = 0;            /* header status entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	desc->hdr._resvd = 0;            /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	desc->hdr.tag.u.req_id = req_id; /* id for this request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	desc->u.itmf.lunmap_id = lunmap_id; /* index into lunmap table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	desc->u.itmf.tm_req = tm_req;       /* SCSI Task Management request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	desc->u.itmf.t_tag = tm_id;         /* tag of fcpio to be aborted */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	desc->u.itmf._resvd = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	memcpy(desc->u.itmf.lun, lun, LUN_ADDRESS);  /* LUN address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	desc->u.itmf._resvd1 = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	hton24(desc->u.itmf.d_id, d_id);    /* FC vNIC only: Target D_ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	desc->u.itmf.r_a_tov = r_a_tov;     /* FC vNIC only: R_A_TOV in msec */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	desc->u.itmf.e_d_tov = e_d_tov;     /* FC vNIC only: E_D_TOV in msec */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	vnic_wq_copy_post(wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) static inline void fnic_queue_wq_copy_desc_flogi_reg(struct vnic_wq_copy *wq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 						     u32 req_id, u8 format,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 						     u32 s_id, u8 *gw_mac)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	struct fcpio_host_req *desc = vnic_wq_copy_next_desc(wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	desc->hdr.type = FCPIO_FLOGI_REG;     /* enum fcpio_type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	desc->hdr.status = 0;                 /* header status entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	desc->hdr._resvd = 0;                 /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	desc->hdr.tag.u.req_id = req_id;      /* id for this request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	desc->u.flogi_reg.format = format;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	desc->u.flogi_reg._resvd = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	hton24(desc->u.flogi_reg.s_id, s_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	memcpy(desc->u.flogi_reg.gateway_mac, gw_mac, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	vnic_wq_copy_post(wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) static inline void fnic_queue_wq_copy_desc_fip_reg(struct vnic_wq_copy *wq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 						   u32 req_id, u32 s_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 						   u8 *fcf_mac, u8 *ha_mac,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 						   u32 r_a_tov, u32 e_d_tov)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	struct fcpio_host_req *desc = vnic_wq_copy_next_desc(wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	desc->hdr.type = FCPIO_FLOGI_FIP_REG; /* enum fcpio_type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	desc->hdr.status = 0;                 /* header status entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	desc->hdr._resvd = 0;                 /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	desc->hdr.tag.u.req_id = req_id;      /* id for this request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	desc->u.flogi_fip_reg._resvd0 = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	hton24(desc->u.flogi_fip_reg.s_id, s_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	memcpy(desc->u.flogi_fip_reg.fcf_mac, fcf_mac, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	desc->u.flogi_fip_reg._resvd1 = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	desc->u.flogi_fip_reg.r_a_tov = r_a_tov;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	desc->u.flogi_fip_reg.e_d_tov = e_d_tov;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	memcpy(desc->u.flogi_fip_reg.ha_mac, ha_mac, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	desc->u.flogi_fip_reg._resvd2 = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	vnic_wq_copy_post(wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) static inline void fnic_queue_wq_copy_desc_fw_reset(struct vnic_wq_copy *wq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 						    u32 req_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	struct fcpio_host_req *desc = vnic_wq_copy_next_desc(wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	desc->hdr.type = FCPIO_RESET;     /* enum fcpio_type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	desc->hdr.status = 0;             /* header status entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	desc->hdr._resvd = 0;             /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	desc->hdr.tag.u.req_id = req_id;  /* id for this request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	vnic_wq_copy_post(wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) static inline void fnic_queue_wq_copy_desc_lunmap(struct vnic_wq_copy *wq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 						  u32 req_id, u64 lunmap_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 						  u32 lunmap_len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	struct fcpio_host_req *desc = vnic_wq_copy_next_desc(wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	desc->hdr.type = FCPIO_LUNMAP_REQ;	/* enum fcpio_type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	desc->hdr.status = 0;			/* header status entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	desc->hdr._resvd = 0;			/* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	desc->hdr.tag.u.req_id = req_id;	/* id for this request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	desc->u.lunmap_req.addr = lunmap_addr;	/* address of the buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	desc->u.lunmap_req.len = lunmap_len;	/* len of the buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	vnic_wq_copy_post(wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) static inline void fnic_queue_rq_desc(struct vnic_rq *rq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 				      void *os_buf, dma_addr_t dma_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 				      u16 len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	struct rq_enet_desc *desc = vnic_rq_next_desc(rq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	rq_enet_desc_enc(desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 		(u64)dma_addr | VNIC_PADDR_TARGET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 		RQ_ENET_TYPE_ONLY_SOP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 		(u16)len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	vnic_rq_post(rq, os_buf, 0, dma_addr, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) struct fnic;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) int fnic_get_vnic_config(struct fnic *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) int fnic_alloc_vnic_resources(struct fnic *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) void fnic_free_vnic_resources(struct fnic *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) void fnic_get_res_counts(struct fnic *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) int fnic_set_nic_config(struct fnic *fnic, u8 rss_default_cpu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 			u8 rss_hash_type, u8 rss_hash_bits, u8 rss_base_cpu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 			u8 rss_enable, u8 tso_ipid_split_en,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 			u8 ig_vlan_strip_en);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) #endif /* _FNIC_RES_H_ */