Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cxgb4/chtls/cxgbit: Keeping the max ofld immediate data size same in cxgb4 and ulds

The Max imm data size in cxgb4 is not similar to the max imm data size
in the chtls. This caused an mismatch in output of is_ofld_imm() of
cxgb4 and chtls. So fixed this by keeping the max wreq size of imm data
same in both chtls and cxgb4 as MAX_IMM_OFLD_TX_DATA_WR_LEN.

As cxgb4's max imm. data value for ofld packets is changed to
MAX_IMM_OFLD_TX_DATA_WR_LEN. Using the same in cxgbit also.

Fixes: 36bedb3f2e5b8 ("crypto: chtls - Inline TLS record Tx")
Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ayush Sawal and committed by
David S. Miller
2355a677 d0a0bbe7

+12 -8
+3
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
··· 46 46 #define MAX_ULD_QSETS 16 47 47 #define MAX_ULD_NPORTS 4 48 48 49 + /* ulp_mem_io + ulptx_idata + payload + padding */ 50 + #define MAX_IMM_ULPTX_WR_LEN (32 + 8 + 256 + 8) 51 + 49 52 /* CPL message priority levels */ 50 53 enum { 51 54 CPL_PRIORITY_DATA = 0, /* data messages */
+8 -3
drivers/net/ethernet/chelsio/cxgb4/sge.c
··· 2842 2842 * @skb: the packet 2843 2843 * 2844 2844 * Returns true if a packet can be sent as an offload WR with immediate 2845 - * data. We currently use the same limit as for Ethernet packets. 2845 + * data. 2846 + * FW_OFLD_TX_DATA_WR limits the payload to 255 bytes due to 8-bit field. 2847 + * However, FW_ULPTX_WR commands have a 256 byte immediate only 2848 + * payload limit. 2846 2849 */ 2847 2850 static inline int is_ofld_imm(const struct sk_buff *skb) 2848 2851 { 2849 2852 struct work_request_hdr *req = (struct work_request_hdr *)skb->data; 2850 2853 unsigned long opcode = FW_WR_OP_G(ntohl(req->wr_hi)); 2851 2854 2852 - if (opcode == FW_CRYPTO_LOOKASIDE_WR) 2855 + if (unlikely(opcode == FW_ULPTX_WR)) 2856 + return skb->len <= MAX_IMM_ULPTX_WR_LEN; 2857 + else if (opcode == FW_CRYPTO_LOOKASIDE_WR) 2853 2858 return skb->len <= SGE_MAX_WR_LEN; 2854 2859 else 2855 - return skb->len <= MAX_IMM_TX_PKT_LEN; 2860 + return skb->len <= MAX_IMM_OFLD_TX_DATA_WR_LEN; 2856 2861 } 2857 2862 2858 2863 /**
-3
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.h
··· 50 50 #define MIN_RCV_WND (24 * 1024U) 51 51 #define LOOPBACK(x) (((x) & htonl(0xff000000)) == htonl(0x7f000000)) 52 52 53 - /* ulp_mem_io + ulptx_idata + payload + padding */ 54 - #define MAX_IMM_ULPTX_WR_LEN (32 + 8 + 256 + 8) 55 - 56 53 /* for TX: a skb must have a headroom of at least TX_HEADER_LEN bytes */ 57 54 #define TX_HEADER_LEN \ 58 55 (sizeof(struct fw_ofld_tx_data_wr) + sizeof(struct sge_opaque_hdr))
+1 -2
drivers/target/iscsi/cxgbit/cxgbit_target.c
··· 86 86 if (likely(cxgbit_skcb_flags(skb) & SKCBF_TX_ISO)) 87 87 length += sizeof(struct cpl_tx_data_iso); 88 88 89 - #define MAX_IMM_TX_PKT_LEN 256 90 - return length <= MAX_IMM_TX_PKT_LEN; 89 + return length <= MAX_IMM_OFLD_TX_DATA_WR_LEN; 91 90 } 92 91 93 92 /*