* [PATCH net-next 18/27] net/skbuff: add macros for VLAN_PRESENT bit
[not found] <cover.1481586602.git.mirq-linux@rere.qmqm.pl>
@ 2016-12-13 0:12 ` Michał Mirosław
2016-12-13 0:12 ` Michał Mirosław
2016-12-13 0:12 ` [PATCH net-next 20/27] net/bpf_jit: MIPS: split VLAN_PRESENT bit handling from VLAN_TCI Michał Mirosław
1 sibling, 1 reply; 5+ messages in thread
From: Michał Mirosław @ 2016-12-13 0:12 UTC (permalink / raw)
To: netdev
Cc: Russell King, moderated list:ARM PORT, Ralf Baechle,
open list:MIPS, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman, open list:LINUX FOR POWERPC (32-BIT AND 64-BIT),
David S. Miller, open list:SPARC + UltraSPARC (sparc/sparc64)
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
include/linux/skbuff.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 332e767..4a85a1f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -768,6 +768,12 @@ struct sk_buff {
__u32 priority;
int skb_iif;
__u32 hash;
+#define PKT_VLAN_PRESENT_BIT 4 // CFI (12-th bit) in TCI
+#ifdef __BIG_ENDIAN
+#define PKT_VLAN_PRESENT_OFFSET() offsetof(struct sk_buff, vlan_tci)
+#else
+#define PKT_VLAN_PRESENT_OFFSET() (offsetof(struct sk_buff, vlan_tci) + 1)
+#endif
__be16 vlan_proto;
__u16 vlan_tci;
#if defined(CONFIG_NET_RX_BUSY_POLL) || defined(CONFIG_XPS)
--
2.10.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 18/27] net/skbuff: add macros for VLAN_PRESENT bit
2016-12-13 0:12 ` [PATCH net-next 18/27] net/skbuff: add macros for VLAN_PRESENT bit Michał Mirosław
@ 2016-12-13 0:12 ` Michał Mirosław
0 siblings, 0 replies; 5+ messages in thread
From: Michał Mirosław @ 2016-12-13 0:12 UTC (permalink / raw)
To: netdev
Cc: Russell King, moderated list:ARM PORT, Ralf Baechle,
open list:MIPS, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman, open list:LINUX FOR POWERPC 32-BIT AND 64-BIT,
David S. Miller, open list:SPARC + UltraSPARC sparc/sparc64
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
include/linux/skbuff.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 332e767..4a85a1f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -768,6 +768,12 @@ struct sk_buff {
__u32 priority;
int skb_iif;
__u32 hash;
+#define PKT_VLAN_PRESENT_BIT 4 // CFI (12-th bit) in TCI
+#ifdef __BIG_ENDIAN
+#define PKT_VLAN_PRESENT_OFFSET() offsetof(struct sk_buff, vlan_tci)
+#else
+#define PKT_VLAN_PRESENT_OFFSET() (offsetof(struct sk_buff, vlan_tci) + 1)
+#endif
__be16 vlan_proto;
__u16 vlan_tci;
#if defined(CONFIG_NET_RX_BUSY_POLL) || defined(CONFIG_XPS)
--
2.10.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 20/27] net/bpf_jit: MIPS: split VLAN_PRESENT bit handling from VLAN_TCI
[not found] <cover.1481586602.git.mirq-linux@rere.qmqm.pl>
2016-12-13 0:12 ` [PATCH net-next 18/27] net/skbuff: add macros for VLAN_PRESENT bit Michał Mirosław
@ 2016-12-13 0:12 ` Michał Mirosław
2016-12-13 0:12 ` Michał Mirosław
2016-12-13 1:22 ` Ralf Baechle
1 sibling, 2 replies; 5+ messages in thread
From: Michał Mirosław @ 2016-12-13 0:12 UTC (permalink / raw)
To: netdev; +Cc: Ralf Baechle, open list:MIPS
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
arch/mips/net/bpf_jit.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
index 49a2e22..4b12b5d 100644
--- a/arch/mips/net/bpf_jit.c
+++ b/arch/mips/net/bpf_jit.c
@@ -1138,19 +1138,23 @@ static int build_body(struct jit_ctx *ctx)
emit_load(r_A, r_skb, off, ctx);
break;
case BPF_ANC | SKF_AD_VLAN_TAG:
- case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
ctx->flags |= SEEN_SKB | SEEN_A;
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
vlan_tci) != 2);
off = offsetof(struct sk_buff, vlan_tci);
emit_half_load(r_s0, r_skb, off, ctx);
- if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) {
- emit_andi(r_A, r_s0, (u16)~VLAN_TAG_PRESENT, ctx);
- } else {
- emit_andi(r_A, r_s0, VLAN_TAG_PRESENT, ctx);
- /* return 1 if present */
- emit_sltu(r_A, r_zero, r_A, ctx);
- }
+#ifdef VLAN_TAG_PRESENT
+ emit_andi(r_A, r_s0, (u16)~VLAN_TAG_PRESENT, ctx);
+#endif
+ break;
+ case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
+ ctx->flags |= SEEN_SKB | SEEN_A;
+ emit_load_byte(r_A, r_skb, PKT_VLAN_PRESENT_OFFSET(), ctx);
+ if (PKT_VLAN_PRESENT_BIT)
+ emit_srl(r_A, r_A, PKT_VLAN_PRESENT_BIT, ctx);
+ emit_andi(r_A, r_s0, 1, ctx);
+ /* return 1 if present */
+ emit_sltu(r_A, r_zero, r_A, ctx);
break;
case BPF_ANC | SKF_AD_PKTTYPE:
ctx->flags |= SEEN_SKB;
--
2.10.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 20/27] net/bpf_jit: MIPS: split VLAN_PRESENT bit handling from VLAN_TCI
2016-12-13 0:12 ` [PATCH net-next 20/27] net/bpf_jit: MIPS: split VLAN_PRESENT bit handling from VLAN_TCI Michał Mirosław
@ 2016-12-13 0:12 ` Michał Mirosław
2016-12-13 1:22 ` Ralf Baechle
1 sibling, 0 replies; 5+ messages in thread
From: Michał Mirosław @ 2016-12-13 0:12 UTC (permalink / raw)
To: netdev; +Cc: Ralf Baechle, open list:MIPS
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
arch/mips/net/bpf_jit.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
index 49a2e22..4b12b5d 100644
--- a/arch/mips/net/bpf_jit.c
+++ b/arch/mips/net/bpf_jit.c
@@ -1138,19 +1138,23 @@ static int build_body(struct jit_ctx *ctx)
emit_load(r_A, r_skb, off, ctx);
break;
case BPF_ANC | SKF_AD_VLAN_TAG:
- case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
ctx->flags |= SEEN_SKB | SEEN_A;
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
vlan_tci) != 2);
off = offsetof(struct sk_buff, vlan_tci);
emit_half_load(r_s0, r_skb, off, ctx);
- if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) {
- emit_andi(r_A, r_s0, (u16)~VLAN_TAG_PRESENT, ctx);
- } else {
- emit_andi(r_A, r_s0, VLAN_TAG_PRESENT, ctx);
- /* return 1 if present */
- emit_sltu(r_A, r_zero, r_A, ctx);
- }
+#ifdef VLAN_TAG_PRESENT
+ emit_andi(r_A, r_s0, (u16)~VLAN_TAG_PRESENT, ctx);
+#endif
+ break;
+ case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
+ ctx->flags |= SEEN_SKB | SEEN_A;
+ emit_load_byte(r_A, r_skb, PKT_VLAN_PRESENT_OFFSET(), ctx);
+ if (PKT_VLAN_PRESENT_BIT)
+ emit_srl(r_A, r_A, PKT_VLAN_PRESENT_BIT, ctx);
+ emit_andi(r_A, r_s0, 1, ctx);
+ /* return 1 if present */
+ emit_sltu(r_A, r_zero, r_A, ctx);
break;
case BPF_ANC | SKF_AD_PKTTYPE:
ctx->flags |= SEEN_SKB;
--
2.10.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 20/27] net/bpf_jit: MIPS: split VLAN_PRESENT bit handling from VLAN_TCI
2016-12-13 0:12 ` [PATCH net-next 20/27] net/bpf_jit: MIPS: split VLAN_PRESENT bit handling from VLAN_TCI Michał Mirosław
2016-12-13 0:12 ` Michał Mirosław
@ 2016-12-13 1:22 ` Ralf Baechle
1 sibling, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2016-12-13 1:22 UTC (permalink / raw)
To: Michał Mirosław; +Cc: netdev, open list:MIPS
I assume you want to merge this together with the rest of you series, so
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Cheers,
Ralf
On Tue, Dec 13, 2016 at 01:12:39AM +0100, Michał Mirosław wrote:
> Date: Tue, 13 Dec 2016 01:12:39 +0100 (CET)
> From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> To: netdev@vger.kernel.org
> Cc: Ralf Baechle <ralf@linux-mips.org>, "open list:MIPS"
> <linux-mips@linux-mips.org>
> Subject: [PATCH net-next 20/27] net/bpf_jit: MIPS: split VLAN_PRESENT bit
> handling from VLAN_TCI
> Content-Type: text/plain; charset=UTF-8
>
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
> arch/mips/net/bpf_jit.c | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
> index 49a2e22..4b12b5d 100644
> --- a/arch/mips/net/bpf_jit.c
> +++ b/arch/mips/net/bpf_jit.c
> @@ -1138,19 +1138,23 @@ static int build_body(struct jit_ctx *ctx)
> emit_load(r_A, r_skb, off, ctx);
> break;
> case BPF_ANC | SKF_AD_VLAN_TAG:
> - case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
> ctx->flags |= SEEN_SKB | SEEN_A;
> BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
> vlan_tci) != 2);
> off = offsetof(struct sk_buff, vlan_tci);
> emit_half_load(r_s0, r_skb, off, ctx);
> - if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) {
> - emit_andi(r_A, r_s0, (u16)~VLAN_TAG_PRESENT, ctx);
> - } else {
> - emit_andi(r_A, r_s0, VLAN_TAG_PRESENT, ctx);
> - /* return 1 if present */
> - emit_sltu(r_A, r_zero, r_A, ctx);
> - }
> +#ifdef VLAN_TAG_PRESENT
> + emit_andi(r_A, r_s0, (u16)~VLAN_TAG_PRESENT, ctx);
> +#endif
> + break;
> + case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
> + ctx->flags |= SEEN_SKB | SEEN_A;
> + emit_load_byte(r_A, r_skb, PKT_VLAN_PRESENT_OFFSET(), ctx);
> + if (PKT_VLAN_PRESENT_BIT)
> + emit_srl(r_A, r_A, PKT_VLAN_PRESENT_BIT, ctx);
> + emit_andi(r_A, r_s0, 1, ctx);
> + /* return 1 if present */
> + emit_sltu(r_A, r_zero, r_A, ctx);
> break;
> case BPF_ANC | SKF_AD_PKTTYPE:
> ctx->flags |= SEEN_SKB;
> --
> 2.10.2
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-12-13 1:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <cover.1481586602.git.mirq-linux@rere.qmqm.pl>
2016-12-13 0:12 ` [PATCH net-next 18/27] net/skbuff: add macros for VLAN_PRESENT bit Michał Mirosław
2016-12-13 0:12 ` Michał Mirosław
2016-12-13 0:12 ` [PATCH net-next 20/27] net/bpf_jit: MIPS: split VLAN_PRESENT bit handling from VLAN_TCI Michał Mirosław
2016-12-13 0:12 ` Michał Mirosław
2016-12-13 1:22 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).