chcr_core.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * This file is part of the Chelsio T6 Crypto driver for Linux.
  3. *
  4. * Copyright (c) 2003-2016 Chelsio Communications, Inc. All rights reserved.
  5. *
  6. * This software is available to you under a choice of one of two
  7. * licenses. You may choose to be licensed under the terms of the GNU
  8. * General Public License (GPL) Version 2, available from the file
  9. * COPYING in the main directory of this source tree, or the
  10. * OpenIB.org BSD license below:
  11. *
  12. * Redistribution and use in source and binary forms, with or
  13. * without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above
  17. * copyright notice, this list of conditions and the following
  18. * disclaimer.
  19. *
  20. * - Redistributions in binary form must reproduce the above
  21. * copyright notice, this list of conditions and the following
  22. * disclaimer in the documentation and/or other materials
  23. * provided with the distribution.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  29. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  30. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  31. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  32. * SOFTWARE.
  33. *
  34. */
  35. #ifndef __CHCR_CORE_H__
  36. #define __CHCR_CORE_H__
  37. #include <crypto/algapi.h>
  38. #include "t4_hw.h"
  39. #include "cxgb4.h"
  40. #include "cxgb4_uld.h"
  41. #define DRV_MODULE_NAME "chcr"
  42. #define DRV_VERSION "1.0.0.0"
  43. #define MAX_PENDING_REQ_TO_HW 20
  44. #define CHCR_TEST_RESPONSE_TIMEOUT 1000
  45. #define PAD_ERROR_BIT 1
  46. #define CHK_PAD_ERR_BIT(x) (((x) >> PAD_ERROR_BIT) & 1)
  47. #define MAC_ERROR_BIT 0
  48. #define CHK_MAC_ERR_BIT(x) (((x) >> MAC_ERROR_BIT) & 1)
  49. #define MAX_SALT 4
  50. struct uld_ctx;
  51. struct _key_ctx {
  52. __be32 ctx_hdr;
  53. u8 salt[MAX_SALT];
  54. __be64 reserverd;
  55. unsigned char key[0];
  56. };
  57. struct chcr_wr {
  58. struct fw_crypto_lookaside_wr wreq;
  59. struct ulp_txpkt ulptx;
  60. struct ulptx_idata sc_imm;
  61. struct cpl_tx_sec_pdu sec_cpl;
  62. struct _key_ctx key_ctx;
  63. };
  64. struct chcr_dev {
  65. spinlock_t lock_chcr_dev;
  66. struct uld_ctx *u_ctx;
  67. unsigned char tx_channel_id;
  68. };
  69. struct uld_ctx {
  70. struct list_head entry;
  71. struct cxgb4_lld_info lldi;
  72. struct chcr_dev *dev;
  73. };
  74. int assign_chcr_device(struct chcr_dev **dev);
  75. int chcr_send_wr(struct sk_buff *skb);
  76. int start_crypto(void);
  77. int stop_crypto(void);
  78. int chcr_uld_rx_handler(void *handle, const __be64 *rsp,
  79. const struct pkt_gl *pgl);
  80. int chcr_handle_resp(struct crypto_async_request *req, unsigned char *input,
  81. int err);
  82. #endif /* __CHCR_CORE_H__ */