Merge "net: Changes to support Shortcut Forward Engine"

This commit is contained in:
qctecmdr 2020-11-19 14:10:18 -08:00 • committed by Gerrit - the friendly Code Review server
commit 815d09f601
5 changed files with 48 additions and 0 deletions

View file

@ -814,6 +814,10 @@ struct sk_buff {
__u8 ipvs_property:1;
__u8 inner_protocol_type:1;
#ifdef CONFIG_ENABLE_SFE
__u8 fast_forwarded:1;
#endif
__u8 remcsum_offload:1;
#ifdef CONFIG_NET_SWITCHDEV
__u8 offload_fwd_mark:1;

View file

@ -114,6 +114,10 @@ struct nf_conn {
unsigned long nattype_entry;
#endif
#ifdef CONFIG_ENABLE_SFE
void *sfe_entry;
#endif
/* Storage reserved for other modules, must be the last member */
union nf_conntrack_proto proto;

View file

@ -43,11 +43,17 @@ void nf_conntrack_cleanup_end(void);
bool nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
const struct nf_conntrack_tuple *orig);
extern bool (*nattype_refresh_timer)
(unsigned long nattype,
unsigned long timeout_value)
__rcu __read_mostly;
#ifdef CONFIG_ENABLE_SFE
extern void (*delete_sfe_entry)(struct nf_conn *ct);
#endif
/* Find a connection corresponding to a tuple. */
struct nf_conntrack_tuple_hash *
nf_conntrack_find_get(struct net *net,

View file

@ -4730,6 +4730,11 @@ void process_embms_receive_skb(struct sk_buff *skb)
embms_recv(skb);
}
#ifdef CONFIG_ENABLE_SFE
int (*athrs_fast_nat_recv)(struct sk_buff *skb) __rcu __read_mostly;
EXPORT_SYMBOL(athrs_fast_nat_recv);
#endif
static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc,
struct packet_type **ppt_prev)
{
@ -4740,6 +4745,9 @@ static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc,
bool deliver_exact = false;
int ret = NET_RX_DROP;
__be16 type;
#ifdef CONFIG_ENABLE_SFE
int (*fast_recv)(struct sk_buff *skb);
#endif
net_timestamp_check(!netdev_tstamp_prequeue, skb);
@ -4813,6 +4821,16 @@ skip_taps:
process_embms_receive_skb(skb);
skip_classify:
#ifdef CONFIG_ENABLE_SFE
fast_recv = rcu_dereference(athrs_fast_nat_recv);
if (fast_recv) {
if (fast_recv(skb)) {
ret = NET_RX_SUCCESS;
goto out;
}
}
#endif
if (pfmemalloc && !skb_pfmemalloc_protocol(skb))
goto drop;

View file

@ -599,10 +599,18 @@ static void destroy_gre_conntrack(struct nf_conn *ct)
#endif
}
#ifdef CONFIG_ENABLE_SFE
void (*delete_sfe_entry)(struct nf_conn *ct) __rcu __read_mostly;
EXPORT_SYMBOL(delete_sfe_entry);
#endif
static void
destroy_conntrack(struct nf_conntrack *nfct)
{
struct nf_conn *ct = (struct nf_conn *)nfct;
#ifdef CONFIG_ENABLE_SFE
void (*delete_entry)(struct nf_conn *ct);
#endif
pr_debug("destroy_conntrack(%p)\n", ct);
WARN_ON(atomic_read(&nfct->use) != 0);
@ -615,6 +623,14 @@ destroy_conntrack(struct nf_conntrack *nfct)
if (unlikely(nf_ct_protonum(ct) == IPPROTO_GRE))
destroy_gre_conntrack(ct);
#ifdef CONFIG_ENABLE_SFE
if (ct->sfe_entry) {
delete_entry = rcu_dereference(delete_sfe_entry);
if (delete_entry)
delete_entry(ct);
}
#endif
local_bh_disable();
/* Expectations will have been removed in clean_from_lists,
* except TFTP can create an expectation on the first packet,