forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/scsi/cxgbi/libcxgbi.h
....@@ -76,6 +76,14 @@
7676 #define ULP2_MAX_PDU_PAYLOAD \
7777 (ULP2_MAX_PKT_SIZE - ISCSI_PDU_NONPAYLOAD_LEN)
7878
79
+#define CXGBI_ULP2_MAX_ISO_PAYLOAD 65535
80
+
81
+#define CXGBI_MAX_ISO_DATA_IN_SKB \
82
+ min_t(u32, MAX_SKB_FRAGS << PAGE_SHIFT, CXGBI_ULP2_MAX_ISO_PAYLOAD)
83
+
84
+#define cxgbi_is_iso_config(csk) ((csk)->cdev->skb_iso_txhdr)
85
+#define cxgbi_is_iso_disabled(csk) ((csk)->disable_iso)
86
+
7987 /*
8088 * For iscsi connections HW may inserts digest bytes into the pdu. Those digest
8189 * bytes are not sent by the host but are part of the TCP payload and therefore
....@@ -120,6 +128,9 @@
120128 int wr_max_cred;
121129 int wr_cred;
122130 int wr_una_cred;
131
+#ifdef CONFIG_CHELSIO_T4_DCB
132
+ u8 dcb_priority;
133
+#endif
123134 unsigned char hcrc_len;
124135 unsigned char dcrc_len;
125136
....@@ -159,6 +170,10 @@
159170 u32 write_seq;
160171 u32 snd_win;
161172 u32 rcv_win;
173
+
174
+ bool disable_iso;
175
+ u32 no_tx_credits;
176
+ unsigned long prev_iso_ts;
162177 };
163178
164179 /*
....@@ -200,6 +215,8 @@
200215 void *handle;
201216 void *arp_err_handler;
202217 struct sk_buff *wr_next;
218
+ u16 iscsi_hdr_len;
219
+ u8 ulp_mode;
203220 };
204221
205222 enum cxgbi_skcb_flags {
....@@ -215,6 +232,7 @@
215232 SKCBF_RX_HCRC_ERR, /* header digest error */
216233 SKCBF_RX_DCRC_ERR, /* data digest error */
217234 SKCBF_RX_PAD_ERR, /* padding byte error */
235
+ SKCBF_TX_ISO, /* iso cpl in tx skb */
218236 };
219237
220238 struct cxgbi_skb_cb {
....@@ -222,18 +240,18 @@
222240 struct cxgbi_skb_rx_cb rx;
223241 struct cxgbi_skb_tx_cb tx;
224242 };
225
- unsigned char ulp_mode;
226243 unsigned long flags;
227244 unsigned int seq;
228245 };
229246
230247 #define CXGBI_SKB_CB(skb) ((struct cxgbi_skb_cb *)&((skb)->cb[0]))
231248 #define cxgbi_skcb_flags(skb) (CXGBI_SKB_CB(skb)->flags)
232
-#define cxgbi_skcb_ulp_mode(skb) (CXGBI_SKB_CB(skb)->ulp_mode)
233249 #define cxgbi_skcb_tcp_seq(skb) (CXGBI_SKB_CB(skb)->seq)
234250 #define cxgbi_skcb_rx_ddigest(skb) (CXGBI_SKB_CB(skb)->rx.ddigest)
235251 #define cxgbi_skcb_rx_pdulen(skb) (CXGBI_SKB_CB(skb)->rx.pdulen)
236252 #define cxgbi_skcb_tx_wr_next(skb) (CXGBI_SKB_CB(skb)->tx.wr_next)
253
+#define cxgbi_skcb_tx_iscsi_hdrlen(skb) (CXGBI_SKB_CB(skb)->tx.iscsi_hdr_len)
254
+#define cxgbi_skcb_tx_ulp_mode(skb) (CXGBI_SKB_CB(skb)->tx.ulp_mode)
237255
238256 static inline void cxgbi_skcb_set_flag(struct sk_buff *skb,
239257 enum cxgbi_skcb_flags flag)
....@@ -455,6 +473,7 @@
455473 #define CXGBI_FLAG_IPV4_SET 0x10
456474 #define CXGBI_FLAG_USE_PPOD_OFLDQ 0x40
457475 #define CXGBI_FLAG_DDP_OFF 0x100
476
+#define CXGBI_FLAG_DEV_ISO_OFF 0x400
458477
459478 struct cxgbi_device {
460479 struct list_head list_head;
....@@ -474,6 +493,7 @@
474493 unsigned int pfvf;
475494 unsigned int rx_credit_thres;
476495 unsigned int skb_tx_rsvd;
496
+ u32 skb_iso_txhdr;
477497 unsigned int skb_rx_extra; /* for msg coalesced mode */
478498 unsigned int tx_max_size;
479499 unsigned int rx_max_size;
....@@ -520,35 +540,40 @@
520540 struct cxgbi_sock *csk;
521541 };
522542
523
-#define MAX_PDU_FRAGS ((ULP2_MAX_PDU_PAYLOAD + 512 - 1) / 512)
524543 struct cxgbi_task_data {
544
+#define CXGBI_TASK_SGL_CHECKED 0x1
545
+#define CXGBI_TASK_SGL_COPY 0x2
546
+ u8 flags;
525547 unsigned short nr_frags;
526
- struct page_frag frags[MAX_PDU_FRAGS];
548
+ struct page_frag frags[MAX_SKB_FRAGS];
527549 struct sk_buff *skb;
528550 unsigned int dlen;
529551 unsigned int offset;
530552 unsigned int count;
531553 unsigned int sgoffset;
554
+ u32 total_count;
555
+ u32 total_offset;
556
+ u32 max_xmit_dlength;
532557 struct cxgbi_task_tag_info ttinfo;
533558 };
534559 #define iscsi_task_cxgbi_data(task) \
535560 ((task)->dd_data + sizeof(struct iscsi_tcp_task))
536561
537
-static inline void *cxgbi_alloc_big_mem(unsigned int size,
538
- gfp_t gfp)
539
-{
540
- void *p = kzalloc(size, gfp | __GFP_NOWARN);
541
-
542
- if (!p)
543
- p = vzalloc(size);
544
-
545
- return p;
546
-}
547
-
548
-static inline void cxgbi_free_big_mem(void *addr)
549
-{
550
- kvfree(addr);
551
-}
562
+struct cxgbi_iso_info {
563
+#define CXGBI_ISO_INFO_FSLICE 0x1
564
+#define CXGBI_ISO_INFO_LSLICE 0x2
565
+#define CXGBI_ISO_INFO_IMM_ENABLE 0x4
566
+ u8 flags;
567
+ u8 op;
568
+ u8 ahs;
569
+ u8 num_pdu;
570
+ u32 mpdu;
571
+ u32 burst_size;
572
+ u32 len;
573
+ u32 segment_offset;
574
+ u32 datasn_offset;
575
+ u32 buffer_offset;
576
+};
552577
553578 static inline void cxgbi_set_iscsi_ipv4(struct cxgbi_hba *chba, __be32 ipaddr)
554579 {
....@@ -614,8 +639,9 @@
614639 void cxgbi_ddp_set_one_ppod(struct cxgbi_pagepod *,
615640 struct cxgbi_task_tag_info *,
616641 struct scatterlist **sg_pp, unsigned int *sg_off);
617
-void cxgbi_ddp_ppm_setup(void **ppm_pp, struct cxgbi_device *,
618
- struct cxgbi_tag_format *, unsigned int ppmax,
619
- unsigned int llimit, unsigned int start,
620
- unsigned int rsvd_factor);
642
+int cxgbi_ddp_ppm_setup(void **ppm_pp, struct cxgbi_device *cdev,
643
+ struct cxgbi_tag_format *tformat,
644
+ unsigned int iscsi_size, unsigned int llimit,
645
+ unsigned int start, unsigned int rsvd_factor,
646
+ unsigned int edram_start, unsigned int edram_size);
621647 #endif /*__LIBCXGBI_H__*/