19730ffcbSVarun Prakash /* 29730ffcbSVarun Prakash * Copyright (c) 2016 Chelsio Communications, Inc. 39730ffcbSVarun Prakash * 49730ffcbSVarun Prakash * This program is free software; you can redistribute it and/or modify 59730ffcbSVarun Prakash * it under the terms of the GNU General Public License as published by 69730ffcbSVarun Prakash * the Free Software Foundation. 79730ffcbSVarun Prakash * 89730ffcbSVarun Prakash */ 99730ffcbSVarun Prakash 109730ffcbSVarun Prakash #ifndef __CXGBIT_LRO_H__ 119730ffcbSVarun Prakash #define __CXGBIT_LRO_H__ 129730ffcbSVarun Prakash 139730ffcbSVarun Prakash #include <linux/kernel.h> 149730ffcbSVarun Prakash #include <linux/module.h> 159730ffcbSVarun Prakash #include <linux/errno.h> 169730ffcbSVarun Prakash #include <linux/types.h> 179730ffcbSVarun Prakash #include <linux/skbuff.h> 189730ffcbSVarun Prakash 199730ffcbSVarun Prakash #define LRO_FLUSH_LEN_MAX 65535 209730ffcbSVarun Prakash 219730ffcbSVarun Prakash struct cxgbit_lro_cb { 229730ffcbSVarun Prakash struct cxgbit_sock *csk; 239730ffcbSVarun Prakash u32 pdu_totallen; 249730ffcbSVarun Prakash u32 offset; 259730ffcbSVarun Prakash u8 pdu_idx; 269730ffcbSVarun Prakash bool complete; 279730ffcbSVarun Prakash }; 289730ffcbSVarun Prakash 299730ffcbSVarun Prakash enum cxgbit_pducb_flags { 309730ffcbSVarun Prakash PDUCBF_RX_HDR = (1 << 0), /* received pdu header */ 319730ffcbSVarun Prakash PDUCBF_RX_DATA = (1 << 1), /* received pdu payload */ 329730ffcbSVarun Prakash PDUCBF_RX_STATUS = (1 << 2), /* received ddp status */ 339730ffcbSVarun Prakash PDUCBF_RX_DATA_DDPD = (1 << 3), /* pdu payload ddp'd */ 34*79e57cfeSVarun Prakash PDUCBF_RX_DDP_CMP = (1 << 4), /* ddp completion */ 35*79e57cfeSVarun Prakash PDUCBF_RX_HCRC_ERR = (1 << 5), /* header digest error */ 36*79e57cfeSVarun Prakash PDUCBF_RX_DCRC_ERR = (1 << 6), /* data digest error */ 379730ffcbSVarun Prakash }; 389730ffcbSVarun Prakash 399730ffcbSVarun Prakash struct cxgbit_lro_pdu_cb { 409730ffcbSVarun Prakash u8 flags; 419730ffcbSVarun Prakash u8 frags; 429730ffcbSVarun Prakash u8 hfrag_idx; 439730ffcbSVarun Prakash u8 nr_dfrags; 449730ffcbSVarun Prakash u8 dfrag_idx; 459730ffcbSVarun Prakash bool complete; 469730ffcbSVarun Prakash u32 seq; 479730ffcbSVarun Prakash u32 pdulen; 489730ffcbSVarun Prakash u32 hlen; 499730ffcbSVarun Prakash u32 dlen; 509730ffcbSVarun Prakash u32 doffset; 519730ffcbSVarun Prakash u32 ddigest; 529730ffcbSVarun Prakash void *hdr; 539730ffcbSVarun Prakash }; 549730ffcbSVarun Prakash 559730ffcbSVarun Prakash #define LRO_SKB_MAX_HEADROOM \ 569730ffcbSVarun Prakash (sizeof(struct cxgbit_lro_cb) + \ 579730ffcbSVarun Prakash (MAX_SKB_FRAGS * sizeof(struct cxgbit_lro_pdu_cb))) 589730ffcbSVarun Prakash 599730ffcbSVarun Prakash #define LRO_SKB_MIN_HEADROOM \ 609730ffcbSVarun Prakash (sizeof(struct cxgbit_lro_cb) + \ 619730ffcbSVarun Prakash sizeof(struct cxgbit_lro_pdu_cb)) 629730ffcbSVarun Prakash 639730ffcbSVarun Prakash #define cxgbit_skb_lro_cb(skb) ((struct cxgbit_lro_cb *)skb->data) 649730ffcbSVarun Prakash #define cxgbit_skb_lro_pdu_cb(skb, i) \ 659730ffcbSVarun Prakash ((struct cxgbit_lro_pdu_cb *)(skb->data + sizeof(struct cxgbit_lro_cb) \ 669730ffcbSVarun Prakash + (i * sizeof(struct cxgbit_lro_pdu_cb)))) 679730ffcbSVarun Prakash 689730ffcbSVarun Prakash #define CPL_RX_ISCSI_DDP_STATUS_DDP_SHIFT 16 /* ddp'able */ 699730ffcbSVarun Prakash #define CPL_RX_ISCSI_DDP_STATUS_PAD_SHIFT 19 /* pad error */ 709730ffcbSVarun Prakash #define CPL_RX_ISCSI_DDP_STATUS_HCRC_SHIFT 20 /* hcrc error */ 719730ffcbSVarun Prakash #define CPL_RX_ISCSI_DDP_STATUS_DCRC_SHIFT 21 /* dcrc error */ 729730ffcbSVarun Prakash 739730ffcbSVarun Prakash #endif /*__CXGBIT_LRO_H_*/ 74