From 5a7e5accc695e5cf0ed840f59042dba4cbe0aae3 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sat, 12 May 2018 10:00:17 +0800 Subject: [PATCH] net: move stack variable at top of VLAN strip function In function 'rte_vlan_strip': rte_ether.h:357:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] struct vlan_hdr *vh = (struct vlan_hdr *)(eh + 1); Fixes: c974021a5949 ("ether: add soft vlan encap/decap") Cc: stable@dpdk.org Signed-off-by: Andy Green Reviewed-by: Stephen Hemminger --- lib/librte_net/rte_ether.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index 95d0a533fd..27c9195944 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -350,11 +350,12 @@ static inline int rte_vlan_strip(struct rte_mbuf *m) { struct ether_hdr *eh = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct vlan_hdr *vh; if (eh->ether_type != rte_cpu_to_be_16(ETHER_TYPE_VLAN)) return -1; - struct vlan_hdr *vh = (struct vlan_hdr *)(eh + 1); + vh = (struct vlan_hdr *)(eh + 1); m->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED; m->vlan_tci = rte_be_to_cpu_16(vh->vlan_tci); -- 2.20.1