-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'act_tc-offload-originating-device'
Paul Blakey says: ==================== net/sched: Pass originating device to drivers offloading ct connection Currently, drivers register to a ct zone that can be shared by multiple devices. This can be inefficient for the driver to offload, as it needs to handle all the cases where the tuple can come from, instead of where it's most likely will arive from. For example, consider the following tc rules: tc filter add dev dev1 ... flower action ct commit zone 5 \ action mirred egress redirect dev dev2 tc filter add dev dev2 ... flower action ct zone 5 \ action goto chain chain 2 tc filter add dev dev2 ... flower ct_state +trk+est ... \ action mirred egress redirect dev dev1 Both dev2 and dev1 register to the zone 5 flow table (created by act_ct). A tuple originating on dev1, going to dev2, will be offloaded to both devices, and both will need to offload both directions, resulting in 4 total rules. The traffic will only hit originiating tuple on dev1, and reply tuple on dev2. By passing the originating device that created the connection with the tuple, dev1 can choose to offload only the originating tuple, and dev2 only the reply tuple. Resulting in a more efficient offload. The first patch adds an act_ct nf conntrack extension, to temporarily store the originiating device from the skb before offloading the connection once the connection is established. Once sent to offload, it fills the tuple originating device. The second patch get this information from tuples which pass in openvswitch. The third patch is Mellanox driver ct offload implementation using this information to provide a hint to firmware of where this offloaded tuple packets will arrive from (LOCAL or UPLINK port), and thus increase insertion rate. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Showing
8 changed files
with
141 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
|
||
#ifndef _NF_CONNTRACK_ACT_CT_H | ||
#define _NF_CONNTRACK_ACT_CT_H | ||
|
||
#include <net/netfilter/nf_conntrack.h> | ||
#include <linux/netfilter/nf_conntrack_common.h> | ||
#include <net/netfilter/nf_conntrack_extend.h> | ||
|
||
struct nf_conn_act_ct_ext { | ||
int ifindex[IP_CT_DIR_MAX]; | ||
}; | ||
|
||
static inline struct nf_conn_act_ct_ext *nf_conn_act_ct_ext_find(const struct nf_conn *ct) | ||
{ | ||
#if IS_ENABLED(CONFIG_NET_ACT_CT) | ||
return nf_ct_ext_find(ct, NF_CT_EXT_ACT_CT); | ||
#else | ||
return NULL; | ||
#endif | ||
} | ||
|
||
static inline struct nf_conn_act_ct_ext *nf_conn_act_ct_ext_add(struct nf_conn *ct) | ||
{ | ||
#if IS_ENABLED(CONFIG_NET_ACT_CT) | ||
struct nf_conn_act_ct_ext *act_ct = nf_ct_ext_find(ct, NF_CT_EXT_ACT_CT); | ||
|
||
if (act_ct) | ||
return act_ct; | ||
|
||
act_ct = nf_ct_ext_add(ct, NF_CT_EXT_ACT_CT, GFP_ATOMIC); | ||
return act_ct; | ||
#else | ||
return NULL; | ||
#endif | ||
} | ||
|
||
static inline void nf_conn_act_ct_ext_fill(struct sk_buff *skb, struct nf_conn *ct, | ||
enum ip_conntrack_info ctinfo) | ||
{ | ||
#if IS_ENABLED(CONFIG_NET_ACT_CT) | ||
struct nf_conn_act_ct_ext *act_ct_ext; | ||
|
||
act_ct_ext = nf_conn_act_ct_ext_find(ct); | ||
if (dev_net(skb->dev) == &init_net && act_ct_ext) | ||
act_ct_ext->ifindex[CTINFO2DIR(ctinfo)] = skb->dev->ifindex; | ||
#endif | ||
} | ||
|
||
#endif /* _NF_CONNTRACK_ACT_CT_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters