Skip to content

Commit 5a4b9fe

Browse files
rmchelsiodavem330
authored andcommitted
cxgb4/chcr: complete record tx handling
Added tx handling in this patch. This includes handling of segments contain single complete record. v1->v2: - chcr_write_cpl_set_tcb_ulp is added in this patch. v3->v4: - mss calculation logic. - replaced kfree_skb with dev_kfree_skb_any. - corrected error message reported by kbuild test robot <[email protected]> Signed-off-by: Rohit Maheshwari <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8a30923 commit 5a4b9fe

File tree

8 files changed

+686
-4
lines changed

8 files changed

+686
-4
lines changed

drivers/crypto/chelsio/chcr_common.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
#define CHCR_MAX_SALT 4
1010
#define CHCR_KEYCTX_MAC_KEY_SIZE_128 0
1111
#define CHCR_KEYCTX_CIPHER_KEY_SIZE_128 0
12+
#define CHCR_SCMD_CIPHER_MODE_AES_GCM 2
13+
#define CHCR_CPL_TX_SEC_PDU_LEN_64BIT 2
14+
#define CHCR_SCMD_SEQ_NO_CTRL_64BIT 3
15+
#define CHCR_SCMD_PROTO_VERSION_TLS 0
16+
#define CHCR_SCMD_AUTH_MODE_GHASH 4
1217

1318
enum chcr_state {
1419
CHCR_INIT = 0,
@@ -93,4 +98,35 @@ static inline void *chcr_copy_to_txd(const void *src, const struct sge_txq *q,
9398
}
9499
return p;
95100
}
101+
102+
static inline unsigned int chcr_txq_avail(const struct sge_txq *q)
103+
{
104+
return q->size - 1 - q->in_use;
105+
}
106+
107+
static inline void chcr_txq_advance(struct sge_txq *q, unsigned int n)
108+
{
109+
q->in_use += n;
110+
q->pidx += n;
111+
if (q->pidx >= q->size)
112+
q->pidx -= q->size;
113+
}
114+
115+
static inline void chcr_eth_txq_stop(struct sge_eth_txq *q)
116+
{
117+
netif_tx_stop_queue(q->txq);
118+
q->q.stops++;
119+
}
120+
121+
static inline unsigned int chcr_sgl_len(unsigned int n)
122+
{
123+
n--;
124+
return (3 * n) / 2 + (n & 1) + 2;
125+
}
126+
127+
static inline unsigned int chcr_flits_to_desc(unsigned int n)
128+
{
129+
WARN_ON(n > SGE_MAX_WR_LEN / 8);
130+
return DIV_ROUND_UP(n, 8);
131+
}
96132
#endif /* __CHCR_COMMON_H__ */

drivers/crypto/chelsio/chcr_core.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ static struct cxgb4_uld_info chcr_uld_info = {
4949
.add = chcr_uld_add,
5050
.state_change = chcr_uld_state_change,
5151
.rx_handler = chcr_uld_rx_handler,
52-
#ifdef CONFIG_CHELSIO_IPSEC_INLINE
52+
#if defined(CONFIG_CHELSIO_IPSEC_INLINE) || defined(CONFIG_CHELSIO_TLS_DEVICE)
5353
.tx_handler = chcr_uld_tx_handler,
54-
#endif /* CONFIG_CHELSIO_IPSEC_INLINE */
54+
#endif /* CONFIG_CHELSIO_IPSEC_INLINE || CONFIG_CHELSIO_TLS_DEVICE */
5555
};
5656

5757
static void detach_work_fn(struct work_struct *work)
@@ -237,12 +237,22 @@ int chcr_uld_rx_handler(void *handle, const __be64 *rsp,
237237
return 0;
238238
}
239239

240-
#ifdef CONFIG_CHELSIO_IPSEC_INLINE
240+
#if defined(CONFIG_CHELSIO_IPSEC_INLINE) || defined(CONFIG_CHELSIO_TLS_DEVICE)
241241
int chcr_uld_tx_handler(struct sk_buff *skb, struct net_device *dev)
242242
{
243+
/* In case if skb's decrypted bit is set, it's nic tls packet, else it's
244+
* ipsec packet.
245+
*/
246+
#ifdef CONFIG_CHELSIO_TLS_DEVICE
247+
if (skb->decrypted)
248+
return chcr_ktls_xmit(skb, dev);
249+
#endif
250+
#ifdef CONFIG_CHELSIO_IPSEC_INLINE
243251
return chcr_ipsec_xmit(skb, dev);
252+
#endif
253+
return 0;
244254
}
245-
#endif /* CONFIG_CHELSIO_IPSEC_INLINE */
255+
#endif /* CONFIG_CHELSIO_IPSEC_INLINE || CONFIG_CHELSIO_TLS_DEVICE */
246256

247257
static void chcr_detach_device(struct uld_ctx *u_ctx)
248258
{

drivers/crypto/chelsio/chcr_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,5 +227,6 @@ void chcr_enable_ktls(struct adapter *adap);
227227
void chcr_disable_ktls(struct adapter *adap);
228228
int chcr_ktls_cpl_act_open_rpl(struct adapter *adap, unsigned char *input);
229229
int chcr_ktls_cpl_set_tcb_rpl(struct adapter *adap, unsigned char *input);
230+
int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev);
230231
#endif
231232
#endif /* __CHCR_CORE_H__ */

0 commit comments

Comments
 (0)