The array will be used to simplify the code that prints/reads pkg flags.
Sorted the array in order of printing the flags in pktgen_if_show()
Note: Renamed IPSEC_ON => IPSEC for simplicity.
No visible behavior change expected.
Signed-off-by: Dmitry Safonov
---
net/core/pktgen.c | 64 +++
1 file changed, 41 insertions(+), 23 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index ab63943ffd03..51f273319baf 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -184,25 +184,43 @@
#define func_enter() pr_debug("entering %s\n", __func__);
+#define PKT_FLAGS \
+ pf(IPV6)/* Interface in IPV6 Mode */\
+ pf(IPSRC_RND) /* IP-Src Random */\
+ pf(IPDST_RND) /* IP-Dst Random */\
+ pf(TXSIZE_RND) /* Transmit size is random */ \
+ pf(UDPSRC_RND) /* UDP-Src Random */\
+ pf(UDPDST_RND) /* UDP-Dst Random */\
+ pf(UDPCSUM) /* Include UDP checksum */ \
+ pf(NO_TIMESTAMP)/* Don't timestamp packets (default TS) */ \
+ pf(MPLS_RND)/* Random MPLS labels */\
+ pf(QUEUE_MAP_RND) /* queue map Random */ \
+ pf(QUEUE_MAP_CPU) /* queue map mirrors smp_processor_id() */ \
+ pf(FLOW_SEQ)/* Sequential flows */ \
+ pf(IPSEC) /* ipsec on for flows */\
+ pf(MACSRC_RND) /* MAC-Src Random */\
+ pf(MACDST_RND) /* MAC-Dst Random */\
+ pf(VID_RND) /* Random VLAN ID */\
+ pf(SVID_RND)/* Random SVLAN ID */ \
+ pf(NODE)/* Node memory alloc*/ \
+
+#define pf(flag) flag##_SHIFT,
+enum pkt_flags {
+ PKT_FLAGS
+};
+#undef pf
+
+#define pf(flag) static const __u32 F_##flag = (1<flags & F_IPSEC_ON) {
+ if (pkt_dev->flags & F_IPSEC) {
seq_puts(seq, "IPSEC ");
if (pkt_dev->spi)
seq_printf(seq, "spi:%u", pkt_dev->spi);
@@ -1304,10 +1322,10 @@ static ssize_t pktgen_if_write(struct file *file,
pkt_dev->flags &= ~F_QUEUE_MAP_CPU;
#ifdef CONFIG_XFRM
else if (strcmp(f, "IPSEC") == 0)
- pkt_dev->flags |= F_IPSEC_ON;
+ pkt_dev->flags |= F_IPSEC;
else if (strcmp(f, "!IPSEC") == 0)
- pkt_dev->flags &= ~F_IPSEC_ON;
+ pkt_dev->flags &= ~F_IPSEC;
#endif
else if (strcmp(f, "!IPV6") == 0)
@@ -2550,7 +2568,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
pkt_dev->flows[flow].cur_daddr =
pkt_dev->cur_daddr;
#ifdef CONFIG_XFRM
- if (pkt_dev->flags & F_IPSEC_ON)
+ if (pkt_dev->flags & F_IPSEC)
get_ipsec_sa(pkt_dev, flow);
#endif
pkt_dev->nflows++;
@@ -2655,7 +2673,7 @@ static void free_SAs(struct pktgen_dev *pkt_dev)
static int process_ipsec(struct