From bf43434f44d414c77c08f32ea9efefdb99ea3927 Mon Sep 17 00:00:00 2001 From: "Rp, Vijaykumar" <vijaykumar.rp@intel.com> Date: Fri, 23 Feb 2018 05:34:08 +0100 Subject: [PATCH] Merge pull request #253 in SW_PON/linux from bugfix/UGW_SW-20918-copy-vlan-pcp-to-extmark to xrx500 * commit 'e907b80c84619df7c90ac29ab3869d7b7c480821': Using VLAN_PRIO_SHIFT macro Fixed Review Comments UGW_SW-20918 : copy VLAN ID and PCP vlaue to extmark for 802.1p classification --- drivers/net/ethernet/lantiq/ppa/ppa_hook.c | 27 +++++++++++++++++++++- net/Kconfig | 8 +++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/lantiq/ppa/ppa_hook.c b/drivers/net/ethernet/lantiq/ppa/ppa_hook.c index 7287c7d07..d8cd51818 100644 --- a/drivers/net/ethernet/lantiq/ppa/ppa_hook.c +++ b/drivers/net/ethernet/lantiq/ppa/ppa_hook.c @@ -53,7 +53,6 @@ /* * Common Head File */ -/*#include <linux/autoconf.h>*/ #include <linux/version.h> #include <generated/autoconf.h> #include <asm/atomic.h> @@ -977,6 +976,23 @@ static struct nf_hook_ops ebt_hook_ops[] __read_mostly = { #endif /* CONFIG_PPA_BR_SESS_LEARNING*/ #if defined(CONFIG_INTEL_IPQOS) +#if defined(CONFIG_VLAN_8021Q_COPY_TO_EXTMARK) +static unsigned int ppa_qos_br_prert_hook_fn(void *priv, + struct sk_buff *skb, + const struct nf_hook_state *state) +{ + u16 vlan_id = skb_vlan_tag_get_id(skb); + u16 vlan_tci = skb->vlan_tci; + u32 vprio = (vlan_tci >> VLAN_PRIO_SHIFT); + + SET_DATA_FROM_MARK_OPT(skb->extmark, VLANID_MASK, + VLANID_START_BIT_POS, vlan_id); + SET_DATA_FROM_MARK_OPT(skb->extmark, VPRIO_MASK, + VPRIO_START_BIT_POS, vprio); + return NF_ACCEPT; +} +#endif + static unsigned int ppa_qos_br_postrt_hook_fn(void *priv, struct sk_buff *skb, const struct nf_hook_state *state) @@ -988,6 +1004,15 @@ static unsigned int ppa_qos_br_postrt_hook_fn(void *priv, } static struct nf_hook_ops qos_ebt_hook_ops[] __read_mostly = { +#if defined(CONFIG_VLAN_8021Q_COPY_TO_EXTMARK) + /* hook for bridge pre-routing packets */ + { + .hook = ppa_qos_br_prert_hook_fn, + .hooknum = NF_BR_PRE_ROUTING, + .pf = NFPROTO_BRIDGE, + .priority = NF_BR_PRI_NAT_DST_BRIDGED, + }, +#endif /* hook for bridge post-routing packets */ { .hook = ppa_qos_br_postrt_hook_fn, diff --git a/net/Kconfig b/net/Kconfig index 6c054c9a7..12ec83381 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -110,6 +110,14 @@ config INTEL_IPQOS_ACCEL_DISABLE If unsure say N +config VLAN_8021Q_COPY_TO_EXTMARK + bool "Will copy 8021Q vlan-id and vlan-prio into extmark" + depends on VLAN_8021Q && NETWORK_EXTMARK + help + Select this to copy 8021Q valn-id and vlan-prio into extmark. + + If unsure, say N. + if INET source "net/ipv4/Kconfig" source "net/ipv6/Kconfig" -- GitLab