linux/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
   2/* Copyright (c) 2020 Mellanox Technologies. */
   3
   4#ifndef __MLX5_EN_REP_TC_H__
   5#define __MLX5_EN_REP_TC_H__
   6
   7#include <linux/skbuff.h>
   8#include "en_tc.h"
   9#include "en_rep.h"
  10
  11#if IS_ENABLED(CONFIG_MLX5_CLS_ACT)
  12
  13int mlx5e_rep_tc_init(struct mlx5e_rep_priv *rpriv);
  14void mlx5e_rep_tc_cleanup(struct mlx5e_rep_priv *rpriv);
  15
  16int mlx5e_rep_tc_netdevice_event_register(struct mlx5e_rep_priv *rpriv);
  17void mlx5e_rep_tc_netdevice_event_unregister(struct mlx5e_rep_priv *rpriv);
  18
  19void mlx5e_rep_tc_enable(struct mlx5e_priv *priv);
  20void mlx5e_rep_tc_disable(struct mlx5e_priv *priv);
  21
  22int mlx5e_rep_tc_event_port_affinity(struct mlx5e_priv *priv);
  23
  24void mlx5e_rep_update_flows(struct mlx5e_priv *priv,
  25                            struct mlx5e_encap_entry *e,
  26                            bool neigh_connected,
  27                            unsigned char ha[ETH_ALEN]);
  28
  29int mlx5e_rep_encap_entry_attach(struct mlx5e_priv *priv,
  30                                 struct mlx5e_encap_entry *e,
  31                                 struct mlx5e_neigh *m_neigh,
  32                                 struct net_device *neigh_dev);
  33void mlx5e_rep_encap_entry_detach(struct mlx5e_priv *priv,
  34                                  struct mlx5e_encap_entry *e);
  35
  36int mlx5e_rep_setup_tc(struct net_device *dev, enum tc_setup_type type,
  37                       void *type_data);
  38
  39bool mlx5e_rep_tc_update_skb(struct mlx5_cqe64 *cqe,
  40                             struct sk_buff *skb,
  41                             struct mlx5e_tc_update_priv *tc_priv);
  42void mlx5_rep_tc_post_napi_receive(struct mlx5e_tc_update_priv *tc_priv);
  43
  44#else /* CONFIG_MLX5_CLS_ACT */
  45
  46struct mlx5e_rep_priv;
  47static inline int
  48mlx5e_rep_tc_init(struct mlx5e_rep_priv *rpriv) { return 0; }
  49static inline void
  50mlx5e_rep_tc_cleanup(struct mlx5e_rep_priv *rpriv) {}
  51
  52static inline int
  53mlx5e_rep_tc_netdevice_event_register(struct mlx5e_rep_priv *rpriv) { return 0; }
  54static inline void
  55mlx5e_rep_tc_netdevice_event_unregister(struct mlx5e_rep_priv *rpriv) {}
  56
  57static inline void
  58mlx5e_rep_tc_enable(struct mlx5e_priv *priv) {}
  59static inline void
  60mlx5e_rep_tc_disable(struct mlx5e_priv *priv) {}
  61
  62static inline int
  63mlx5e_rep_tc_event_port_affinity(struct mlx5e_priv *priv) { return NOTIFY_DONE; }
  64
  65static inline int
  66mlx5e_rep_setup_tc(struct net_device *dev, enum tc_setup_type type,
  67                   void *type_data) { return -EOPNOTSUPP; }
  68
  69struct mlx5e_tc_update_priv;
  70static inline bool
  71mlx5e_rep_tc_update_skb(struct mlx5_cqe64 *cqe,
  72                        struct sk_buff *skb,
  73                        struct mlx5e_tc_update_priv *tc_priv) { return true; }
  74static inline void
  75mlx5_rep_tc_post_napi_receive(struct mlx5e_tc_update_priv *tc_priv) {}
  76
  77#endif /* CONFIG_MLX5_CLS_ACT */
  78
  79#endif /* __MLX5_EN_REP_TC_H__ */
  80