root/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. mlx5e_get_tls_tx_context
  2. mlx5e_get_tls_rx_context
  3. mlx5e_tls_build_netdev
  4. mlx5e_tls_init
  5. mlx5e_tls_cleanup
  6. mlx5e_tls_get_count
  7. mlx5e_tls_get_strings
  8. mlx5e_tls_get_stats

   1 /*
   2  * Copyright (c) 2018 Mellanox Technologies. All rights reserved.
   3  *
   4  * This software is available to you under a choice of one of two
   5  * licenses.  You may choose to be licensed under the terms of the GNU
   6  * General Public License (GPL) Version 2, available from the file
   7  * COPYING in the main directory of this source tree, or the
   8  * OpenIB.org BSD license below:
   9  *
  10  *     Redistribution and use in source and binary forms, with or
  11  *     without modification, are permitted provided that the following
  12  *     conditions are met:
  13  *
  14  *      - Redistributions of source code must retain the above
  15  *        copyright notice, this list of conditions and the following
  16  *        disclaimer.
  17  *
  18  *      - Redistributions in binary form must reproduce the above
  19  *        copyright notice, this list of conditions and the following
  20  *        disclaimer in the documentation and/or other materials
  21  *        provided with the distribution.
  22  *
  23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30  * SOFTWARE.
  31  *
  32  */
  33 #ifndef __MLX5E_TLS_H__
  34 #define __MLX5E_TLS_H__
  35 
  36 #include "accel/tls.h"
  37 #include "en_accel/ktls.h"
  38 
  39 #ifdef CONFIG_MLX5_EN_TLS
  40 #include <net/tls.h>
  41 #include "en.h"
  42 
  43 struct mlx5e_tls_sw_stats {
  44         atomic64_t tx_tls_drop_metadata;
  45         atomic64_t tx_tls_drop_resync_alloc;
  46         atomic64_t tx_tls_drop_no_sync_data;
  47         atomic64_t tx_tls_drop_bypass_required;
  48         atomic64_t rx_tls_drop_resync_request;
  49         atomic64_t rx_tls_resync_request;
  50         atomic64_t rx_tls_resync_reply;
  51         atomic64_t rx_tls_auth_fail;
  52 };
  53 
  54 struct mlx5e_tls {
  55         struct mlx5e_tls_sw_stats sw_stats;
  56 };
  57 
  58 struct mlx5e_tls_offload_context_tx {
  59         struct tls_offload_context_tx base;
  60         u32 expected_seq;
  61         __be32 swid;
  62 };
  63 
  64 static inline struct mlx5e_tls_offload_context_tx *
  65 mlx5e_get_tls_tx_context(struct tls_context *tls_ctx)
  66 {
  67         BUILD_BUG_ON(sizeof(struct mlx5e_tls_offload_context_tx) >
  68                      TLS_OFFLOAD_CONTEXT_SIZE_TX);
  69         return container_of(tls_offload_ctx_tx(tls_ctx),
  70                             struct mlx5e_tls_offload_context_tx,
  71                             base);
  72 }
  73 
  74 struct mlx5e_tls_offload_context_rx {
  75         struct tls_offload_context_rx base;
  76         __be32 handle;
  77 };
  78 
  79 static inline struct mlx5e_tls_offload_context_rx *
  80 mlx5e_get_tls_rx_context(struct tls_context *tls_ctx)
  81 {
  82         BUILD_BUG_ON(sizeof(struct mlx5e_tls_offload_context_rx) >
  83                      TLS_OFFLOAD_CONTEXT_SIZE_RX);
  84         return container_of(tls_offload_ctx_rx(tls_ctx),
  85                             struct mlx5e_tls_offload_context_rx,
  86                             base);
  87 }
  88 
  89 void mlx5e_tls_build_netdev(struct mlx5e_priv *priv);
  90 int mlx5e_tls_init(struct mlx5e_priv *priv);
  91 void mlx5e_tls_cleanup(struct mlx5e_priv *priv);
  92 
  93 int mlx5e_tls_get_count(struct mlx5e_priv *priv);
  94 int mlx5e_tls_get_strings(struct mlx5e_priv *priv, uint8_t *data);
  95 int mlx5e_tls_get_stats(struct mlx5e_priv *priv, u64 *data);
  96 
  97 #else
  98 
  99 static inline void mlx5e_tls_build_netdev(struct mlx5e_priv *priv)
 100 {
 101         if (mlx5_accel_is_ktls_device(priv->mdev))
 102                 mlx5e_ktls_build_netdev(priv);
 103 }
 104 
 105 static inline int mlx5e_tls_init(struct mlx5e_priv *priv) { return 0; }
 106 static inline void mlx5e_tls_cleanup(struct mlx5e_priv *priv) { }
 107 static inline int mlx5e_tls_get_count(struct mlx5e_priv *priv) { return 0; }
 108 static inline int mlx5e_tls_get_strings(struct mlx5e_priv *priv, uint8_t *data) { return 0; }
 109 static inline int mlx5e_tls_get_stats(struct mlx5e_priv *priv, u64 *data) { return 0; }
 110 
 111 #endif
 112 
 113 #endif /* __MLX5E_TLS_H__ */

/* [<][>][^][v][top][bottom][index][help] */