1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /****************************************************************************
3 * Driver for Solarflare network controllers and boards
4 * Copyright 2023, Advanced Micro Devices, Inc.
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.
11 #ifndef EFX_TC_CONNTRACK_H
12 #define EFX_TC_CONNTRACK_H
13 #include "net_driver.h"
15 #if IS_ENABLED(CONFIG_SFC_SRIOV)
16 #include <linux/refcount.h>
17 #include <net/netfilter/nf_flow_table.h>
19 struct efx_tc_ct_zone
{
21 struct rhash_head linkage
;
23 struct nf_flowtable
*nf_ft
;
25 struct mutex mutex
; /* protects cts list */
26 struct list_head cts
; /* list of efx_tc_ct_entry in this zone */
29 /* create/uncreate/teardown hashtables */
30 int efx_tc_init_conntrack(struct efx_nic
*efx
);
31 void efx_tc_destroy_conntrack(struct efx_nic
*efx
);
32 void efx_tc_fini_conntrack(struct efx_nic
*efx
);
34 struct efx_tc_ct_zone
*efx_tc_ct_register_zone(struct efx_nic
*efx
, u16 zone
,
35 struct nf_flowtable
*ct_ft
);
36 void efx_tc_ct_unregister_zone(struct efx_nic
*efx
,
37 struct efx_tc_ct_zone
*ct_zone
);
39 struct efx_tc_ct_entry
{
41 struct rhash_head linkage
;
45 __be32 src_ip
, dst_ip
, nat_ip
;
46 struct in6_addr src_ip6
, dst_ip6
;
47 __be16 l4_sport
, l4_dport
, l4_natport
; /* Ports (UDP, TCP) */
48 struct efx_tc_ct_zone
*zone
;
50 struct efx_tc_counter
*cnt
;
51 struct list_head list
; /* entry on zone->cts */
54 #endif /* CONFIG_SFC_SRIOV */
55 #endif /* EFX_TC_CONNTRACK_H */