History

net: gso_test: fix build with gcc-12 and earlier

gcc 12 errors out with: net/core/gso_test.c:58:48: error: initializer element is not constant 58 | .segs = (const unsigned int[]) { gso_size }, This version isn't old (2022), so switch to preprocessor-bsaed constant instead of 'static const int'.

Florian Westphal committed 3 years ago

Commit 2f0968a1 parent 04317b11 file · +22 −22Browse files

Unified · Split

net/core/gso_test.c+22−22
@@ -4,7 +4,7 @@ · 3 unmodified lines
4#include <linux/skbuff.h>4#include <linux/skbuff.h>
5 5
6static const char hdr[] = "abcdefgh";6static const char hdr[] = "abcdefgh";
7static const int gso_size = 1000;7#define GSO_TEST_SIZE 1000
8 8
9static void __init_skb(struct sk_buff *skb)9static void __init_skb(struct sk_buff *skb)
10{10{
@@ -18,7 +18,7 @@ static void __init_skb(struct sk_buff *skb) · 7 unmodified lines
18 18
19 /* proto is arbitrary, as long as not ETH_P_TEB or vlan */19 /* proto is arbitrary, as long as not ETH_P_TEB or vlan */
20 skb->protocol = htons(ETH_P_ATALK);20 skb->protocol = htons(ETH_P_ATALK);
21 skb_shinfo(skb)->gso_size = gso_size;21 skb_shinfo(skb)->gso_size = GSO_TEST_SIZE;
22}22}
23 23
24enum gso_test_nr {24enum gso_test_nr {
@@ -53,70 +53,70 @@ static struct gso_test_case cases[] = { · 28 unmodified lines
53 {53 {
54 .id = GSO_TEST_NO_GSO,54 .id = GSO_TEST_NO_GSO,
55 .name = "no_gso",55 .name = "no_gso",
56 .linear_len = gso_size,56 .linear_len = GSO_TEST_SIZE,
57 .nr_segs = 1,57 .nr_segs = 1,
58 .segs = (const unsigned int[]) { gso_size },58 .segs = (const unsigned int[]) { GSO_TEST_SIZE },
59 },59 },
60 {60 {
61 .id = GSO_TEST_LINEAR,61 .id = GSO_TEST_LINEAR,
62 .name = "linear",62 .name = "linear",
63 .linear_len = gso_size + gso_size + 1,63 .linear_len = GSO_TEST_SIZE + GSO_TEST_SIZE + 1,
64 .nr_segs = 3,64 .nr_segs = 3,
65 .segs = (const unsigned int[]) { gso_size, gso_size, 1 },65 .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 1 },
66 },66 },
67 {67 {
68 .id = GSO_TEST_FRAGS,68 .id = GSO_TEST_FRAGS,
69 .name = "frags",69 .name = "frags",
70 .linear_len = gso_size,70 .linear_len = GSO_TEST_SIZE,
71 .nr_frags = 2,71 .nr_frags = 2,
72 .frags = (const unsigned int[]) { gso_size, 1 },72 .frags = (const unsigned int[]) { GSO_TEST_SIZE, 1 },
73 .nr_segs = 3,73 .nr_segs = 3,
74 .segs = (const unsigned int[]) { gso_size, gso_size, 1 },74 .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 1 },
75 },75 },
76 {76 {
77 .id = GSO_TEST_FRAGS_PURE,77 .id = GSO_TEST_FRAGS_PURE,
78 .name = "frags_pure",78 .name = "frags_pure",
79 .nr_frags = 3,79 .nr_frags = 3,
80 .frags = (const unsigned int[]) { gso_size, gso_size, 2 },80 .frags = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 2 },
81 .nr_segs = 3,81 .nr_segs = 3,
82 .segs = (const unsigned int[]) { gso_size, gso_size, 2 },82 .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 2 },
83 },83 },
84 {84 {
85 .id = GSO_TEST_GSO_PARTIAL,85 .id = GSO_TEST_GSO_PARTIAL,
86 .name = "gso_partial",86 .name = "gso_partial",
87 .linear_len = gso_size,87 .linear_len = GSO_TEST_SIZE,
88 .nr_frags = 2,88 .nr_frags = 2,
89 .frags = (const unsigned int[]) { gso_size, 3 },89 .frags = (const unsigned int[]) { GSO_TEST_SIZE, 3 },
90 .nr_segs = 2,90 .nr_segs = 2,
91 .segs = (const unsigned int[]) { 2 * gso_size, 3 },91 .segs = (const unsigned int[]) { 2 * GSO_TEST_SIZE, 3 },
92 },92 },
93 {93 {
94 /* commit 89319d3801d1: frag_list on mss boundaries */94 /* commit 89319d3801d1: frag_list on mss boundaries */
95 .id = GSO_TEST_FRAG_LIST,95 .id = GSO_TEST_FRAG_LIST,
96 .name = "frag_list",96 .name = "frag_list",
97 .linear_len = gso_size,97 .linear_len = GSO_TEST_SIZE,
98 .nr_frag_skbs = 2,98 .nr_frag_skbs = 2,
99 .frag_skbs = (const unsigned int[]) { gso_size, gso_size },99 .frag_skbs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE },
100 .nr_segs = 3,100 .nr_segs = 3,
101 .segs = (const unsigned int[]) { gso_size, gso_size, gso_size },101 .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, GSO_TEST_SIZE },
102 },102 },
103 {103 {
104 .id = GSO_TEST_FRAG_LIST_PURE,104 .id = GSO_TEST_FRAG_LIST_PURE,
105 .name = "frag_list_pure",105 .name = "frag_list_pure",
106 .nr_frag_skbs = 2,106 .nr_frag_skbs = 2,
107 .frag_skbs = (const unsigned int[]) { gso_size, gso_size },107 .frag_skbs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE },
108 .nr_segs = 2,108 .nr_segs = 2,
109 .segs = (const unsigned int[]) { gso_size, gso_size },109 .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE },
110 },110 },
111 {111 {
112 /* commit 43170c4e0ba7: GRO of frag_list trains */112 /* commit 43170c4e0ba7: GRO of frag_list trains */
113 .id = GSO_TEST_FRAG_LIST_NON_UNIFORM,113 .id = GSO_TEST_FRAG_LIST_NON_UNIFORM,
114 .name = "frag_list_non_uniform",114 .name = "frag_list_non_uniform",
115 .linear_len = gso_size,115 .linear_len = GSO_TEST_SIZE,
116 .nr_frag_skbs = 4,116 .nr_frag_skbs = 4,
117 .frag_skbs = (const unsigned int[]) { gso_size, 1, gso_size, 2 },117 .frag_skbs = (const unsigned int[]) { GSO_TEST_SIZE, 1, GSO_TEST_SIZE, 2 },
118 .nr_segs = 4,118 .nr_segs = 4,
119 .segs = (const unsigned int[]) { gso_size, gso_size, gso_size, 3 },119 .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, GSO_TEST_SIZE, 3 },
120 },120 },
121 {121 {
122 /* commit 3953c46c3ac7 ("sk_buff: allow segmenting based on frag sizes") and122 /* commit 3953c46c3ac7 ("sk_buff: allow segmenting based on frag sizes") and

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t