Skip to content

Commit 018fc1a

Browse files
icmp6: remove dependency on control_output_mbuf_data
IP6 header was stored in control_output_mbuf_data. To have a similar code as icmp, extends the ip6_local_mbuf_data to store the timestamp. Signed-off-by: Christophe Fontaine <[email protected]>
1 parent 49a7e81 commit 018fc1a

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

modules/ip6/control/icmp6.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,10 @@ static struct api_out icmp6_send(const void *request, void ** /* response */) {
8989

9090
static struct api_out icmp6_recv(const void *request, void **response) {
9191
const struct gr_ip6_icmp_recv_req *recvreq = request;
92+
struct icmp6_echo_reply *icmp6_echo;
9293
struct gr_ip6_icmp_recv_resp *resp;
93-
struct control_output_mbuf_data *d_ctl;
94-
struct ip6_local_mbuf_data *d_ip6;
94+
struct icmp6_mbuf_data *d_ip6;
9595
struct icmp6 *icmp6;
96-
struct icmp6_echo_reply *icmp6_echo;
9796
clock_t *timestamp;
9897
struct rte_mbuf *m;
9998
int ret = 0;
@@ -102,8 +101,7 @@ static struct api_out icmp6_recv(const void *request, void **response) {
102101
if (m == NULL)
103102
return api_out(0, 0);
104103

105-
d_ctl = control_output_mbuf_data(m);
106-
d_ip6 = (struct ip6_local_mbuf_data *)d_ctl->cb_data;
104+
d_ip6 = icmp6_mbuf_data(m);
107105
icmp6_echo = PAYLOAD(icmp6);
108106
timestamp = PAYLOAD(icmp6_echo);
109107

@@ -113,7 +111,7 @@ static struct api_out icmp6_recv(const void *request, void **response) {
113111
resp->ttl = d_ip6->hop_limit;
114112
resp->ident = rte_be_to_cpu_16(icmp6_echo->ident);
115113
resp->seq_num = rte_be_to_cpu_16(icmp6_echo->seqnum);
116-
resp->response_time = d_ctl->timestamp - *timestamp;
114+
resp->response_time = d_ip6->timestamp - *timestamp;
117115
icmp6 = rte_pktmbuf_mtod(m, struct icmp6 *);
118116
resp->type = icmp6->type;
119117
resp->code = icmp6->code;

modules/ip6/datapath/gr_ip6_datapath.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ GR_MBUF_PRIV_DATA_TYPE(ndp_na_output_mbuf_data, {
3232
const struct nexthop *remote;
3333
});
3434

35-
GR_MBUF_PRIV_DATA_TYPE(icmp6_mbuf_data, { clock_t timestamp; });
35+
GR_MBUF_PRIV_DATA_EXTENDS(icmp6_mbuf_data, ip6_local_mbuf_data, { clock_t timestamp; });
3636

3737
void ip6_input_local_add_proto(uint8_t proto, const char *next_node);
3838
void ip6_input_register_nexthop_type(gr_nh_type_t type, const char *next_node);

0 commit comments

Comments
 (0)