Skip to content
Snippets Groups Projects
Commit b0301e57 authored by Rastogi, Deepansh's avatar Rastogi, Deepansh Committed by Kenneth Johansson
Browse files

Merge pull request #214 in SW_PON/linux from...

Merge pull request #214 in SW_PON/linux from feature/UGW_SW-20794-extmark-to-prio-conversion-for-qos to xrx500

* commit '369b606d3183ee96a62001f8a7aa62620cd70d8a':
  UGW_SW-20794: Extracting skb->priority from extension mark
parent ad0028af
Branches
No related tags found
No related merge requests found
......@@ -416,6 +416,32 @@ int32_t (*ppa_hook_reset_qos_wfq)(uint32_t portid, uint32_t queueid, uint32_t fl
#endif /*end of CONFIG_PPA_QOS*/
#ifdef CONFIG_INTEL_IPQOS_MARK_SKBPRIO
/*
* Function to mark priority based on specific criteria
*/
static inline
int skb_mark_priority(struct sk_buff *skb)
{
unsigned old_priority = skb->priority;
/*
* IPQoS in UGW: added copy of nfmark set in classifier to skb->priority to be used in hardware queues.
* nfmark range = 1-8 if QoS is enabled; priority range = 0-7; else preserve original priority
*/
#ifdef CONFIG_NETWORK_EXTMARK
if (skb->extmark) {
unsigned value;
GET_DATA_FROM_MARK_OPT(skb->extmark, QUEPRIO_MASK, QUEPRIO_START_BIT_POS, value);
if (value)
skb->priority = value - 1;
}
#endif /* CONFIG_NETWORK_EXTMARK*/
return old_priority;
}
#endif /* CONFIG_INTEL_IPQOS_MARK_SKBPRIO*/
#if defined(CONFIG_PPA_API_SW_FASTPATH)
/**************************************************************************************************
* PPA based software acceleration function hook
......@@ -861,6 +887,35 @@ static struct nf_hook_ops ipt_hook_ops[] __read_mostly = {
}
};
#if defined(CONFIG_INTEL_IPQOS)
static unsigned int ppa_qos_postrt_hook_fn(void *priv,
struct sk_buff *skb,
const struct nf_hook_state *state)
{
#if defined(CONFIG_INTEL_IPQOS_MARK_SKBPRIO)
skb_mark_priority(skb);
#endif
return NF_ACCEPT;
}
static struct nf_hook_ops qos_hook_ops[] __read_mostly = {
/* hook for post-routing ipv4 packets */
{
.hook = ppa_qos_postrt_hook_fn,
.hooknum = 4, /*NF_IP_POST_ROUTING*/
.pf = PF_INET,
.priority = NF_IP_PRI_LAST,
},
/* hook for post-routing ipv6 packets */
{
.hook = ppa_qos_postrt_hook_fn,
.hooknum = 4, /*NF_IP_POST_ROUTING*/
.pf = PF_INET6,
.priority = NF_IP6_PRI_LAST,
}
};
#endif /* CONFIG_INTEL_IPQOS*/
#if defined(CONFIG_PPA_BR_SESS_LEARNING)
static unsigned int ppa_br_prert_hook_fn (void *priv,
struct sk_buff *skb,
......@@ -903,8 +958,31 @@ static struct nf_hook_ops ebt_hook_ops[] __read_mostly = {
.priority = NF_BR_PRI_NAT_SRC,
}
};
#endif /* CONFIG_PPA_BR_SESS_LEARNING*/
#if defined(CONFIG_INTEL_IPQOS)
static unsigned int ppa_qos_br_postrt_hook_fn(void *priv,
struct sk_buff *skb,
const struct nf_hook_state *state)
{
#if defined(CONFIG_INTEL_IPQOS_MARK_SKBPRIO)
skb_mark_priority(skb);
#endif
return NF_ACCEPT;
}
static struct nf_hook_ops qos_ebt_hook_ops[] __read_mostly = {
/* hook for bridge post-routing packets */
{
.hook = ppa_qos_br_postrt_hook_fn,
.hooknum = 4, /*NF_BR_POST_ROUTING*/
.pf = NFPROTO_BRIDGE,
.priority = NF_BR_PRI_NAT_SRC,
}
};
#endif /* CONFIG_INTEL_IPQOS*/
/*Refresh conntrack for this many jiffies and do accounting */
/*This replictes the functionality of kernel api __nf_ct_refresh_acct*/
void ppa_nf_ct_refresh_acct(struct nf_conn *ct,
......@@ -972,9 +1050,19 @@ void ppa_unregister_delhook(void)
int ppa_api_register_hooks(void)
{
int ret = 0;
#if defined(CONFIG_INTEL_IPQOS)
/*qos ipt hooks*/
nf_register_hooks(qos_hook_ops, ARRAY_SIZE(qos_hook_ops));
#endif /* CONFIG_INTEL_IPQOS*/
/*ipt hooks*/
nf_register_hooks(ipt_hook_ops, ARRAY_SIZE(ipt_hook_ops));
#if defined(CONFIG_INTEL_IPQOS)
/*qos ebt hooks*/
nf_register_hooks(qos_ebt_hook_ops, ARRAY_SIZE(qos_ebt_hook_ops));
#endif /* CONFIG_INTEL_IPQOS*/
#if defined(CONFIG_PPA_BR_SESS_LEARNING)
/*ebt hooks*/
nf_register_hooks(ebt_hook_ops, ARRAY_SIZE(ebt_hook_ops));
......
......@@ -89,6 +89,19 @@ config UDP_REDIRECT
You can say Y here if you want to use hooks from kernel for
UDP re-direction (KPI2UDP redirection)
config INTEL_IPQOS
bool "IPQOS support"
help
Intel IPQOS support
config INTEL_IPQOS_MARK_SKBPRIO
bool "Will derive skb prio from nfmark(0-31) bits 6-9"
depends on INTEL_IPQOS
help
Select this to to derive skb priority from nfmark.
If unsure, say N.
if INET
source "net/ipv4/Kconfig"
source "net/ipv6/Kconfig"
......
......@@ -554,6 +554,9 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
__be16 not_last_frag;
struct rtable *rt = skb_rtable(skb);
int err = 0;
#ifdef CONFIG_INTEL_IPQOS_MARK_SKBPRIO
__u32 old_priority = skb->priority;
#endif
/* for offloaded checksums cleanup checksum before fragmentation */
if (skb->ip_summed == CHECKSUM_PARTIAL &&
......@@ -648,6 +651,9 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
ip_send_check(iph);
}
#ifdef CONFIG_INTEL_IPQOS_MARK_SKBPRIO
skb->priority = old_priority;
#endif
err = output(net, sk, skb);
if (!err)
......@@ -785,6 +791,9 @@ slow_path:
ip_send_check(iph);
#ifdef CONFIG_INTEL_IPQOS_MARK_SKBPRIO
skb2->priority = old_priority;
#endif
err = output(net, sk, skb2);
if (err)
goto fail;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment