From 189ec2b6adefbf4d4ea43bf54e7e40cd4f1edf99 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 24 Feb 2017 14:10:08 +0200 Subject: [PATCH] net: Remove link layer reserve param from IP packet creator The ll_reserve parameter is useless in net_ipv{4|6}_create_raw() function as the reserve information is already stored in buf. Change-Id: I7815a78c001e3da532478c04b3dac9b37bbc723c Signed-off-by: Jukka Rissanen --- subsys/net/ip/icmpv6.c | 3 +-- subsys/net/ip/ipv4.c | 2 -- subsys/net/ip/ipv4.h | 2 -- subsys/net/ip/ipv6.c | 2 -- subsys/net/ip/ipv6.h | 2 -- subsys/net/ip/rpl.c | 12 ++++-------- tests/net/route/src/main.c | 3 +-- 7 files changed, 6 insertions(+), 20 deletions(-) diff --git a/subsys/net/ip/icmpv6.c b/subsys/net/ip/icmpv6.c index e1a107b4fec..9b029cd6202 100644 --- a/subsys/net/ip/icmpv6.c +++ b/subsys/net/ip/icmpv6.c @@ -299,8 +299,7 @@ int net_icmpv6_send_echo_request(struct net_if *iface, reserve = net_if_get_ll_reserve(iface, dst); net_nbuf_set_ll_reserve(buf, reserve); - buf = net_ipv6_create_raw(buf, reserve, src, dst, iface, - IPPROTO_ICMPV6); + buf = net_ipv6_create_raw(buf, src, dst, iface, IPPROTO_ICMPV6); net_nbuf_set_family(buf, AF_INET6); net_nbuf_set_iface(buf, iface); diff --git a/subsys/net/ip/ipv4.c b/subsys/net/ip/ipv4.c index b9a4a2c7baa..e94a5b717b9 100644 --- a/subsys/net/ip/ipv4.c +++ b/subsys/net/ip/ipv4.c @@ -22,7 +22,6 @@ #include "ipv4.h" struct net_buf *net_ipv4_create_raw(struct net_buf *buf, - uint16_t reserve, const struct in_addr *src, const struct in_addr *dst, struct net_if *iface, @@ -72,7 +71,6 @@ struct net_buf *net_ipv4_create(struct net_context *context, } return net_ipv4_create_raw(buf, - net_nbuf_ll_reserve(buf), src, dst, net_context_get_iface(context), diff --git a/subsys/net/ip/ipv4.h b/subsys/net/ip/ipv4.h index 99523303910..f04cfb3e5df 100644 --- a/subsys/net/ip/ipv4.h +++ b/subsys/net/ip/ipv4.h @@ -26,7 +26,6 @@ * @brief Create IPv4 packet in provided net_buf. * * @param buf Network buffer - * @param reserve Link layer reserve * @param src Source IPv4 address * @param dst Destination IPv4 address * @param iface Network interface @@ -35,7 +34,6 @@ * @return Return network buffer that contains the IPv4 packet. */ struct net_buf *net_ipv4_create_raw(struct net_buf *buf, - uint16_t reserve, const struct in_addr *src, const struct in_addr *dst, struct net_if *iface, diff --git a/subsys/net/ip/ipv6.c b/subsys/net/ip/ipv6.c index 6c727c3038d..8d7a5403caa 100644 --- a/subsys/net/ip/ipv6.c +++ b/subsys/net/ip/ipv6.c @@ -314,7 +314,6 @@ const struct in6_addr *net_ipv6_unspecified_address(void) } struct net_buf *net_ipv6_create_raw(struct net_buf *buf, - uint16_t reserve, const struct in6_addr *src, const struct in6_addr *dst, struct net_if *iface, @@ -364,7 +363,6 @@ struct net_buf *net_ipv6_create(struct net_context *context, } return net_ipv6_create_raw(buf, - net_nbuf_ll_reserve(buf), src, dst, net_context_get_iface(context), diff --git a/subsys/net/ip/ipv6.h b/subsys/net/ip/ipv6.h index 90a036c0a4b..c477e615f5a 100644 --- a/subsys/net/ip/ipv6.h +++ b/subsys/net/ip/ipv6.h @@ -124,7 +124,6 @@ int net_ipv6_send_na(struct net_if *iface, struct in6_addr *src, * @brief Create IPv6 packet in provided net_buf. * * @param buf Network buffer - * @param reserve Link layer reserve * @param src Source IPv6 address * @param dst Destination IPv6 address * @param iface Network interface @@ -133,7 +132,6 @@ int net_ipv6_send_na(struct net_if *iface, struct in6_addr *src, * @return Return network buffer that contains the IPv6 packet. */ struct net_buf *net_ipv6_create_raw(struct net_buf *buf, - uint16_t reserve, const struct in6_addr *src, const struct in6_addr *dst, struct net_if *iface, diff --git a/subsys/net/ip/rpl.c b/subsys/net/ip/rpl.c index a6ee5ba3885..96e3e58964f 100644 --- a/subsys/net/ip/rpl.c +++ b/subsys/net/ip/rpl.c @@ -459,8 +459,7 @@ int net_rpl_dio_send(struct net_if *iface, net_nbuf_set_ll_reserve(buf, net_if_get_ll_reserve(iface, dst)); - buf = net_ipv6_create_raw(buf, net_nbuf_ll_reserve(buf), - src, dst_addr, iface, IPPROTO_ICMPV6); + buf = net_ipv6_create_raw(buf, src, dst_addr, iface, IPPROTO_ICMPV6); net_nbuf_set_iface(buf, iface); @@ -738,8 +737,7 @@ int net_rpl_dis_send(struct in6_addr *dst, struct net_if *iface) net_nbuf_set_ll_reserve(buf, net_if_get_ll_reserve(iface, dst_addr)); - buf = net_ipv6_create_raw(buf, net_nbuf_ll_reserve(buf), - src, dst_addr, iface, IPPROTO_ICMPV6); + buf = net_ipv6_create_raw(buf, src, dst_addr, iface, IPPROTO_ICMPV6); net_nbuf_set_iface(buf, iface); @@ -2975,8 +2973,7 @@ int net_rpl_dao_send(struct net_if *iface, net_nbuf_set_ll_reserve(buf, net_if_get_ll_reserve(iface, dst)); - buf = net_ipv6_create_raw(buf, net_nbuf_ll_reserve(buf), - src, dst, iface, IPPROTO_ICMPV6); + buf = net_ipv6_create_raw(buf, src, dst, iface, IPPROTO_ICMPV6); net_nbuf_set_iface(buf, iface); @@ -3102,8 +3099,7 @@ static int dao_ack_send(struct net_buf *orig, net_nbuf_set_ll_reserve(buf, net_if_get_ll_reserve(iface, dst)); - buf = net_ipv6_create_raw(buf, net_nbuf_ll_reserve(buf), - src, dst, iface, IPPROTO_ICMPV6); + buf = net_ipv6_create_raw(buf, src, dst, iface, IPPROTO_ICMPV6); net_nbuf_set_iface(buf, iface); diff --git a/tests/net/route/src/main.c b/tests/net/route/src/main.c index 8793cfec0cf..aec42b1ebeb 100644 --- a/tests/net/route/src/main.c +++ b/tests/net/route/src/main.c @@ -364,8 +364,7 @@ static bool net_test_send_na(struct net_if *iface, net_nbuf_set_ll_reserve(buf, net_if_get_ll_reserve(iface, dst)); - buf = net_ipv6_create_raw(buf, net_nbuf_ll_reserve(buf), - addr, dst, iface, IPPROTO_ICMPV6); + buf = net_ipv6_create_raw(buf, addr, dst, iface, IPPROTO_ICMPV6); frag = net_nbuf_get_frag(buf, K_FOREVER);