Skip to content

Commit 61702d6

Browse files
committed
packet-solutions: Change struct name and improve some comments
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
1 parent fb079b1 commit 61702d6

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

common/parsing_helpers.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ struct icmphdr_common {
6060
#endif
6161

6262
#define VLAN_VID_MASK 0x0fff /* VLAN Identifier */
63-
struct vlans {
63+
/* Struct for collecting VLANs after parsing via parse_ethhdr_vlan */
64+
struct collect_vlans {
6465
__u16 id[VLAN_MAX_DEPTH];
6566
};
6667

@@ -78,7 +79,7 @@ static __always_inline int proto_is_vlan(__u16 h_proto)
7879
static __always_inline int parse_ethhdr_vlan(struct hdr_cursor *nh,
7980
void *data_end,
8081
struct ethhdr **ethhdr,
81-
struct vlans *vlans)
82+
struct collect_vlans *vlans)
8283
{
8384
struct ethhdr *eth = nh->pos;
8485
int hdrsize = sizeof(*eth);
@@ -124,7 +125,7 @@ static __always_inline int parse_ethhdr(struct hdr_cursor *nh,
124125
void *data_end,
125126
struct ethhdr **ethhdr)
126127
{
127-
/* Expect compiler to remove collect VLAN ids */
128+
/* Expect compiler removes the code that collects VLAN ids */
128129
return parse_ethhdr_vlan(nh, data_end, ethhdr, NULL);
129130
}
130131

packet-solutions/xdp_vlan02_kern.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#if 0
1414
#define VLAN_VID_MASK 0x0fff /* VLAN Identifier */
15-
struct vlans {
15+
struct collect_vlans {
1616
__u16 id[VLAN_MAX_DEPTH];
1717
};
1818
#endif
@@ -22,7 +22,7 @@ struct vlans {
2222
static __always_inline int __parse_ethhdr_vlan(struct hdr_cursor *nh,
2323
void *data_end,
2424
struct ethhdr **ethhdr,
25-
struct vlans *vlans)
25+
struct collect_vlans *vlans)
2626
{
2727
struct ethhdr *eth = nh->pos;
2828
int hdrsize = sizeof(*eth);
@@ -76,7 +76,7 @@ int xdp_vlan_02(struct xdp_md *ctx)
7676
int eth_type;
7777
nh.pos = data;
7878

79-
struct vlans vlans;
79+
struct collect_vlans vlans;
8080

8181
struct ethhdr *eth;
8282
eth_type = parse_ethhdr_vlan(&nh, data_end, &eth, &vlans);

0 commit comments

Comments
 (0)