tc_conntrack.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /****************************************************************************
  3. * Driver for Solarflare network controllers and boards
  4. * Copyright 2023, Advanced Micro Devices, Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published
  8. * by the Free Software Foundation, incorporated herein by reference.
  9. */
  10. #ifndef EFX_TC_CONNTRACK_H
  11. #define EFX_TC_CONNTRACK_H
  12. #include "net_driver.h"
  13. #if IS_ENABLED(CONFIG_SFC_SRIOV)
  14. #include <linux/refcount.h>
  15. #include <net/netfilter/nf_flow_table.h>
  16. struct efx_tc_ct_zone {
  17. u16 zone;
  18. struct rhash_head linkage;
  19. refcount_t ref;
  20. struct nf_flowtable *nf_ft;
  21. struct efx_nic *efx;
  22. struct mutex mutex; /* protects cts list */
  23. struct list_head cts; /* list of efx_tc_ct_entry in this zone */
  24. };
  25. /* create/uncreate/teardown hashtables */
  26. int efx_tc_init_conntrack(struct efx_nic *efx);
  27. void efx_tc_destroy_conntrack(struct efx_nic *efx);
  28. void efx_tc_fini_conntrack(struct efx_nic *efx);
  29. struct efx_tc_ct_zone *efx_tc_ct_register_zone(struct efx_nic *efx, u16 zone,
  30. struct nf_flowtable *ct_ft);
  31. void efx_tc_ct_unregister_zone(struct efx_nic *efx,
  32. struct efx_tc_ct_zone *ct_zone);
  33. struct efx_tc_ct_entry {
  34. unsigned long cookie;
  35. struct rhash_head linkage;
  36. __be16 eth_proto;
  37. u8 ip_proto;
  38. bool dnat;
  39. __be32 src_ip, dst_ip, nat_ip;
  40. struct in6_addr src_ip6, dst_ip6;
  41. __be16 l4_sport, l4_dport, l4_natport; /* Ports (UDP, TCP) */
  42. struct efx_tc_ct_zone *zone;
  43. u32 mark;
  44. struct efx_tc_counter *cnt;
  45. struct list_head list; /* entry on zone->cts */
  46. };
  47. #endif /* CONFIG_SFC_SRIOV */
  48. #endif /* EFX_TC_CONNTRACK_H */