hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/crypto/chelsio/chcr_crypto.h
....@@ -41,7 +41,8 @@
4141
4242 #define CCM_B0_SIZE 16
4343 #define CCM_AAD_FIELD_SIZE 2
44
-#define T6_MAX_AAD_SIZE 511
44
+// 511 - 16(For IV)
45
+#define T6_MAX_AAD_SIZE 495
4546
4647
4748 /* Define following if h/w is not dropping the AAD and IV data before
....@@ -159,9 +160,9 @@
159160 return crypto_aead_ctx(tfm);
160161 }
161162
162
-static inline struct chcr_context *c_ctx(struct crypto_ablkcipher *tfm)
163
+static inline struct chcr_context *c_ctx(struct crypto_skcipher *tfm)
163164 {
164
- return crypto_ablkcipher_ctx(tfm);
165
+ return crypto_skcipher_ctx(tfm);
165166 }
166167
167168 static inline struct chcr_context *h_ctx(struct crypto_ahash *tfm)
....@@ -171,7 +172,6 @@
171172
172173 struct ablk_ctx {
173174 struct crypto_skcipher *sw_cipher;
174
- struct crypto_cipher *aes_generic;
175175 __be32 key_ctx_hdr;
176176 unsigned int enckey_len;
177177 unsigned char ciph_mode;
....@@ -185,11 +185,10 @@
185185 dma_addr_t b0_dma;
186186 unsigned int b0_len;
187187 unsigned int op;
188
- short int aad_nents;
189
- short int src_nents;
190
- short int dst_nents;
191188 u16 imm;
192189 u16 verify;
190
+ u16 txqidx;
191
+ u16 rxqidx;
193192 u8 iv[CHCR_MAX_CRYPTO_IV_LEN + MAX_SCRATCH_PAD_SIZE];
194193 u8 *scratch_pad;
195194 };
....@@ -224,7 +223,7 @@
224223
225224 struct __aead_ctx {
226225 struct chcr_gcm_ctx gcm[0];
227
- struct chcr_authenc_ctx authenc[0];
226
+ struct chcr_authenc_ctx authenc[];
228227 };
229228
230229 struct chcr_aead_ctx {
....@@ -236,7 +235,7 @@
236235 u8 nonce[4];
237236 u16 hmac_ctrl;
238237 u16 mayverify;
239
- struct __aead_ctx ctx[0];
238
+ struct __aead_ctx ctx[];
240239 };
241240
242241 struct hmac_ctx {
....@@ -248,16 +247,17 @@
248247 struct __crypto_ctx {
249248 struct hmac_ctx hmacctx[0];
250249 struct ablk_ctx ablkctx[0];
251
- struct chcr_aead_ctx aeadctx[0];
250
+ struct chcr_aead_ctx aeadctx[];
252251 };
253252
254253 struct chcr_context {
255254 struct chcr_dev *dev;
256
- unsigned char tx_qidx;
257
- unsigned char rx_qidx;
258
- unsigned char tx_chan_id;
259
- unsigned char pci_chan_id;
260
- struct __crypto_ctx crypto_ctx[0];
255
+ unsigned char rxq_perchan;
256
+ unsigned char txq_perchan;
257
+ unsigned int ntxq;
258
+ unsigned int nrxq;
259
+ struct completion cbc_aes_aio_done;
260
+ struct __crypto_ctx crypto_ctx[];
261261 };
262262
263263 struct chcr_hctx_per_wr {
....@@ -282,30 +282,37 @@
282282 u8 *skbfr;
283283 /* SKB which is being sent to the hardware for processing */
284284 u64 data_len; /* Data len till time */
285
+ u16 txqidx;
286
+ u16 rxqidx;
285287 u8 reqlen;
286288 u8 partial_hash[CHCR_HASH_MAX_DIGEST_SIZE];
287289 u8 bfr1[CHCR_HASH_MAX_BLOCK_SIZE_128];
288290 u8 bfr2[CHCR_HASH_MAX_BLOCK_SIZE_128];
289291 };
290292
291
-struct chcr_blkcipher_req_ctx {
293
+struct chcr_skcipher_req_ctx {
292294 struct sk_buff *skb;
293295 struct scatterlist *dstsg;
294296 unsigned int processed;
295297 unsigned int last_req_len;
298
+ unsigned int partial_req;
296299 struct scatterlist *srcsg;
297300 unsigned int src_ofst;
298301 unsigned int dst_ofst;
299302 unsigned int op;
300303 u16 imm;
301304 u8 iv[CHCR_MAX_CRYPTO_IV_LEN];
305
+ u8 init_iv[CHCR_MAX_CRYPTO_IV_LEN];
306
+ u16 txqidx;
307
+ u16 rxqidx;
308
+ struct skcipher_request fallback_req; // keep at the end
302309 };
303310
304311 struct chcr_alg_template {
305312 u32 type;
306313 u32 is_registered;
307314 union {
308
- struct crypto_alg crypto;
315
+ struct skcipher_alg skcipher;
309316 struct ahash_alg hash;
310317 struct aead_alg aead;
311318 } alg;
....@@ -322,16 +329,14 @@
322329 unsigned short op_type);
323330 void chcr_add_aead_dst_ent(struct aead_request *req,
324331 struct cpl_rx_phys_dsgl *phys_cpl,
325
- unsigned int assoclen,
326332 unsigned short qid);
327
-void chcr_add_aead_src_ent(struct aead_request *req, struct ulptx_sgl *ulptx,
328
- unsigned int assoclen);
329
-void chcr_add_cipher_src_ent(struct ablkcipher_request *req,
333
+void chcr_add_aead_src_ent(struct aead_request *req, struct ulptx_sgl *ulptx);
334
+void chcr_add_cipher_src_ent(struct skcipher_request *req,
330335 void *ulptx,
331336 struct cipher_wr_param *wrparam);
332
-int chcr_cipher_dma_map(struct device *dev, struct ablkcipher_request *req);
333
-void chcr_cipher_dma_unmap(struct device *dev, struct ablkcipher_request *req);
334
-void chcr_add_cipher_dst_ent(struct ablkcipher_request *req,
337
+int chcr_cipher_dma_map(struct device *dev, struct skcipher_request *req);
338
+void chcr_cipher_dma_unmap(struct device *dev, struct skcipher_request *req);
339
+void chcr_add_cipher_dst_ent(struct skcipher_request *req,
335340 struct cpl_rx_phys_dsgl *phys_cpl,
336341 struct cipher_wr_param *wrparam,
337342 unsigned short qid);