Message ID | 20200331120908.23215-2-przemyslaw.fierek@silvair.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Brian Gix |
Headers | show |
Series | Add net_idx to 'send_seg' function | expand |
Hi Przemysław, I applied the first 2 of this patchset, and modified and sent out a v3 of the 3rd *main* patch, for your approval. Please note that I have removed the net_idx argument from send_seg(), since the field is a member of the mesh_sar structure being passed. You are still listed as author of the patch. Please review and comment. On Tue, 2020-03-31 at 14:09 +0200, Przemysław Fierek wrote: > --- > mesh/friend.c | 16 ++++++++-------- > mesh/net.c | 14 +++++++------- > mesh/net.h | 2 +- > 3 files changed, 16 insertions(+), 16 deletions(-) > > diff --git a/mesh/friend.c b/mesh/friend.c > index 5f5f6f823..6d26de15b 100644 > --- a/mesh/friend.c > +++ b/mesh/friend.c > @@ -97,7 +97,7 @@ static void response_delay(struct l_timeout *timeout, void *user_data) > n += 2; > seq = mesh_net_next_seq_num(neg->net); > print_packet("Tx-NET_OP_FRND_OFFER", msg, n); > - mesh_net_transport_send(neg->net, key_id, true, > + mesh_net_transport_send(neg->net, key_id, > mesh_net_get_iv_index(neg->net), 0, > seq, 0, neg->lp_addr, > msg, n); > @@ -316,7 +316,7 @@ void friend_clear(struct mesh_net *net, uint16_t src, uint16_t lpn, > > l_put_be16(lpn, msg + 1); > l_put_be16(lpnCounter, msg + 3); > - mesh_net_transport_send(net, 0, false, > + mesh_net_transport_send(net, 0, > mesh_net_get_iv_index(net), DEFAULT_TTL, > 0, 0, src, > msg, sizeof(msg)); > @@ -332,7 +332,7 @@ static void clear_retry(struct l_timeout *timeout, void *user_data) > > l_put_be16(neg->lp_addr, msg + 1); > l_put_be16(neg->lp_cnt, msg + 3); > - mesh_net_transport_send(neg->net, 0, false, > + mesh_net_transport_send(neg->net, 0, > mesh_net_get_iv_index(neg->net), DEFAULT_TTL, > 0, 0, neg->old_friend, > msg, sizeof(msg)); > @@ -398,7 +398,7 @@ static void friend_delay_rsp(struct l_timeout *timeout, void *user_data) > pkt->u.one[0].data, pkt->last_len); > > pkt->u.one[0].sent = true; > - mesh_net_transport_send(net, frnd->net_key_cur, false, > + mesh_net_transport_send(net, frnd->net_key_cur, > pkt->iv_index, pkt->ttl, > pkt->u.one[0].seq, pkt->src, pkt->dst, > pkt->u.one[0].data, pkt->last_len); > @@ -439,7 +439,7 @@ update: > l_put_be32(iv_index, upd + 2); > upd[6] = false; /* Queue is Empty */ > print_packet("Update", upd, sizeof(upd)); > - mesh_net_transport_send(net, frnd->net_key_cur, false, > + mesh_net_transport_send(net, frnd->net_key_cur, > mesh_net_get_iv_index(net), 0, > net_seq, 0, frnd->lp_addr, > upd, sizeof(upd)); > @@ -487,7 +487,7 @@ void friend_poll(struct mesh_net *net, uint16_t src, bool seq, > neg->u.negotiate.clearing = true; > l_put_be16(neg->lp_addr, msg + 1); > l_put_be16(neg->lp_cnt, msg + 3); > - mesh_net_transport_send(net, 0, false, > + mesh_net_transport_send(net, 0, > mesh_net_get_iv_index(net), DEFAULT_TTL, > 0, 0, neg->old_friend, > msg, sizeof(msg)); > @@ -596,7 +596,7 @@ void friend_sub_add(struct mesh_net *net, struct mesh_friend *frnd, > > print_packet("Tx-NET_OP_PROXY_SUB_CONFIRM", msg, sizeof(msg)); > net_seq = mesh_net_get_seq_num(net); > - mesh_net_transport_send(net, frnd->net_key_cur, false, > + mesh_net_transport_send(net, frnd->net_key_cur, > mesh_net_get_iv_index(net), 0, > net_seq, 0, frnd->lp_addr, > msg, sizeof(msg)); > @@ -634,7 +634,7 @@ void friend_sub_del(struct mesh_net *net, struct mesh_friend *frnd, > > print_packet("Tx-NET_OP_PROXY_SUB_CONFIRM", msg, sizeof(msg)); > net_seq = mesh_net_get_seq_num(net); > - mesh_net_transport_send(net, frnd->net_key_cur, false, > + mesh_net_transport_send(net, frnd->net_key_cur, > mesh_net_get_iv_index(net), 0, > net_seq, 0, frnd->lp_addr, > msg, sizeof(msg)); > diff --git a/mesh/net.c b/mesh/net.c > index 0343c4c49..11a9d84a3 100644 > --- a/mesh/net.c > +++ b/mesh/net.c > @@ -1566,7 +1566,7 @@ static void send_frnd_ack(struct mesh_net *net, uint16_t src, uint16_t dst, > friend_ack_rxed(net, mesh_net_get_iv_index(net), > mesh_net_next_seq_num(net), 0, dst, msg); > } else { > - mesh_net_transport_send(net, 0, false, > + mesh_net_transport_send(net, 0, > mesh_net_get_iv_index(net), DEFAULT_TTL, > 0, 0, dst, msg, sizeof(msg)); > } > @@ -1601,7 +1601,7 @@ static void send_net_ack(struct mesh_net *net, struct mesh_sar *sar, > return; > } > > - mesh_net_transport_send(net, 0, false, > + mesh_net_transport_send(net, 0, > mesh_net_get_iv_index(net), DEFAULT_TTL, > 0, src, dst, msg, sizeof(msg)); > } > @@ -2208,7 +2208,7 @@ static bool ctl_received(struct mesh_net *net, uint16_t key_id, > } > > if (n) { > - mesh_net_transport_send(net, 0, false, > + mesh_net_transport_send(net, 0, > mesh_net_get_iv_index(net), rsp_ttl, > 0, dst & 0x8000 ? 0 : dst, src, > msg, n); > @@ -2988,7 +2988,7 @@ void mesh_net_sub_list_add(struct mesh_net *net, uint16_t addr) > l_put_be16(addr, msg + n); > n += 2; > > - mesh_net_transport_send(net, 0, false, > + mesh_net_transport_send(net, 0, > mesh_net_get_iv_index(net), 0, > 0, 0, 0, msg, n); > } > @@ -3001,7 +3001,7 @@ void mesh_net_sub_list_del(struct mesh_net *net, uint16_t addr) > l_put_be16(addr, msg + n); > n += 2; > > - mesh_net_transport_send(net, 0, false, > + mesh_net_transport_send(net, 0, > mesh_net_get_iv_index(net), 0, > 0, 0, 0, msg, n); > } > @@ -3350,7 +3350,7 @@ void mesh_net_ack_send(struct mesh_net *net, uint32_t key_id, > > /* TODO: add net key index */ > void mesh_net_transport_send(struct mesh_net *net, uint32_t key_id, > - bool fast, uint32_t iv_index, uint8_t ttl, > + uint32_t iv_index, uint8_t ttl, > uint32_t seq, uint16_t src, uint16_t dst, > const uint8_t *msg, uint16_t msg_len) > { > @@ -3583,7 +3583,7 @@ void mesh_net_heartbeat_send(struct mesh_net *net) > l_put_be16(hb->features, msg + n); > n += 2; > > - mesh_net_transport_send(net, 0, false, mesh_net_get_iv_index(net), > + mesh_net_transport_send(net, 0, mesh_net_get_iv_index(net), > hb->pub_ttl, 0, 0, hb->pub_dst, msg, n); > } > > diff --git a/mesh/net.h b/mesh/net.h > index cb90c1d92..57585ceff 100644 > --- a/mesh/net.h > +++ b/mesh/net.h > @@ -305,7 +305,7 @@ struct l_queue *mesh_net_get_app_keys(struct mesh_net *net); > > bool mesh_net_flush(struct mesh_net *net); > void mesh_net_transport_send(struct mesh_net *net, uint32_t key_id, > - bool fast, uint32_t iv_index, uint8_t ttl, > + uint32_t iv_index, uint8_t ttl, > uint32_t seq, uint16_t src, uint16_t dst, > const uint8_t *msg, uint16_t msg_len); >
diff --git a/mesh/friend.c b/mesh/friend.c index 5f5f6f823..6d26de15b 100644 --- a/mesh/friend.c +++ b/mesh/friend.c @@ -97,7 +97,7 @@ static void response_delay(struct l_timeout *timeout, void *user_data) n += 2; seq = mesh_net_next_seq_num(neg->net); print_packet("Tx-NET_OP_FRND_OFFER", msg, n); - mesh_net_transport_send(neg->net, key_id, true, + mesh_net_transport_send(neg->net, key_id, mesh_net_get_iv_index(neg->net), 0, seq, 0, neg->lp_addr, msg, n); @@ -316,7 +316,7 @@ void friend_clear(struct mesh_net *net, uint16_t src, uint16_t lpn, l_put_be16(lpn, msg + 1); l_put_be16(lpnCounter, msg + 3); - mesh_net_transport_send(net, 0, false, + mesh_net_transport_send(net, 0, mesh_net_get_iv_index(net), DEFAULT_TTL, 0, 0, src, msg, sizeof(msg)); @@ -332,7 +332,7 @@ static void clear_retry(struct l_timeout *timeout, void *user_data) l_put_be16(neg->lp_addr, msg + 1); l_put_be16(neg->lp_cnt, msg + 3); - mesh_net_transport_send(neg->net, 0, false, + mesh_net_transport_send(neg->net, 0, mesh_net_get_iv_index(neg->net), DEFAULT_TTL, 0, 0, neg->old_friend, msg, sizeof(msg)); @@ -398,7 +398,7 @@ static void friend_delay_rsp(struct l_timeout *timeout, void *user_data) pkt->u.one[0].data, pkt->last_len); pkt->u.one[0].sent = true; - mesh_net_transport_send(net, frnd->net_key_cur, false, + mesh_net_transport_send(net, frnd->net_key_cur, pkt->iv_index, pkt->ttl, pkt->u.one[0].seq, pkt->src, pkt->dst, pkt->u.one[0].data, pkt->last_len); @@ -439,7 +439,7 @@ update: l_put_be32(iv_index, upd + 2); upd[6] = false; /* Queue is Empty */ print_packet("Update", upd, sizeof(upd)); - mesh_net_transport_send(net, frnd->net_key_cur, false, + mesh_net_transport_send(net, frnd->net_key_cur, mesh_net_get_iv_index(net), 0, net_seq, 0, frnd->lp_addr, upd, sizeof(upd)); @@ -487,7 +487,7 @@ void friend_poll(struct mesh_net *net, uint16_t src, bool seq, neg->u.negotiate.clearing = true; l_put_be16(neg->lp_addr, msg + 1); l_put_be16(neg->lp_cnt, msg + 3); - mesh_net_transport_send(net, 0, false, + mesh_net_transport_send(net, 0, mesh_net_get_iv_index(net), DEFAULT_TTL, 0, 0, neg->old_friend, msg, sizeof(msg)); @@ -596,7 +596,7 @@ void friend_sub_add(struct mesh_net *net, struct mesh_friend *frnd, print_packet("Tx-NET_OP_PROXY_SUB_CONFIRM", msg, sizeof(msg)); net_seq = mesh_net_get_seq_num(net); - mesh_net_transport_send(net, frnd->net_key_cur, false, + mesh_net_transport_send(net, frnd->net_key_cur, mesh_net_get_iv_index(net), 0, net_seq, 0, frnd->lp_addr, msg, sizeof(msg)); @@ -634,7 +634,7 @@ void friend_sub_del(struct mesh_net *net, struct mesh_friend *frnd, print_packet("Tx-NET_OP_PROXY_SUB_CONFIRM", msg, sizeof(msg)); net_seq = mesh_net_get_seq_num(net); - mesh_net_transport_send(net, frnd->net_key_cur, false, + mesh_net_transport_send(net, frnd->net_key_cur, mesh_net_get_iv_index(net), 0, net_seq, 0, frnd->lp_addr, msg, sizeof(msg)); diff --git a/mesh/net.c b/mesh/net.c index 0343c4c49..11a9d84a3 100644 --- a/mesh/net.c +++ b/mesh/net.c @@ -1566,7 +1566,7 @@ static void send_frnd_ack(struct mesh_net *net, uint16_t src, uint16_t dst, friend_ack_rxed(net, mesh_net_get_iv_index(net), mesh_net_next_seq_num(net), 0, dst, msg); } else { - mesh_net_transport_send(net, 0, false, + mesh_net_transport_send(net, 0, mesh_net_get_iv_index(net), DEFAULT_TTL, 0, 0, dst, msg, sizeof(msg)); } @@ -1601,7 +1601,7 @@ static void send_net_ack(struct mesh_net *net, struct mesh_sar *sar, return; } - mesh_net_transport_send(net, 0, false, + mesh_net_transport_send(net, 0, mesh_net_get_iv_index(net), DEFAULT_TTL, 0, src, dst, msg, sizeof(msg)); } @@ -2208,7 +2208,7 @@ static bool ctl_received(struct mesh_net *net, uint16_t key_id, } if (n) { - mesh_net_transport_send(net, 0, false, + mesh_net_transport_send(net, 0, mesh_net_get_iv_index(net), rsp_ttl, 0, dst & 0x8000 ? 0 : dst, src, msg, n); @@ -2988,7 +2988,7 @@ void mesh_net_sub_list_add(struct mesh_net *net, uint16_t addr) l_put_be16(addr, msg + n); n += 2; - mesh_net_transport_send(net, 0, false, + mesh_net_transport_send(net, 0, mesh_net_get_iv_index(net), 0, 0, 0, 0, msg, n); } @@ -3001,7 +3001,7 @@ void mesh_net_sub_list_del(struct mesh_net *net, uint16_t addr) l_put_be16(addr, msg + n); n += 2; - mesh_net_transport_send(net, 0, false, + mesh_net_transport_send(net, 0, mesh_net_get_iv_index(net), 0, 0, 0, 0, msg, n); } @@ -3350,7 +3350,7 @@ void mesh_net_ack_send(struct mesh_net *net, uint32_t key_id, /* TODO: add net key index */ void mesh_net_transport_send(struct mesh_net *net, uint32_t key_id, - bool fast, uint32_t iv_index, uint8_t ttl, + uint32_t iv_index, uint8_t ttl, uint32_t seq, uint16_t src, uint16_t dst, const uint8_t *msg, uint16_t msg_len) { @@ -3583,7 +3583,7 @@ void mesh_net_heartbeat_send(struct mesh_net *net) l_put_be16(hb->features, msg + n); n += 2; - mesh_net_transport_send(net, 0, false, mesh_net_get_iv_index(net), + mesh_net_transport_send(net, 0, mesh_net_get_iv_index(net), hb->pub_ttl, 0, 0, hb->pub_dst, msg, n); } diff --git a/mesh/net.h b/mesh/net.h index cb90c1d92..57585ceff 100644 --- a/mesh/net.h +++ b/mesh/net.h @@ -305,7 +305,7 @@ struct l_queue *mesh_net_get_app_keys(struct mesh_net *net); bool mesh_net_flush(struct mesh_net *net); void mesh_net_transport_send(struct mesh_net *net, uint32_t key_id, - bool fast, uint32_t iv_index, uint8_t ttl, + uint32_t iv_index, uint8_t ttl, uint32_t seq, uint16_t src, uint16_t dst, const uint8_t *msg, uint16_t msg_len);