diff --git a/drivers/net/ethernet/lantiq/ppa/ppa_hook.c b/drivers/net/ethernet/lantiq/ppa/ppa_hook.c index 7287c7d07115ef896fd1a36dcea0bf7bfcf233f7..d8cd5181802bc21c6a5a367c3e7d962061057174 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 6c054c9a7844b6157f70316d8d306123c1d4332d..12ec833811d3ca075c0214bdd7b4b7cb059adc88 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"