From: "Gix, Brian" <brian.gix@intel.com>
To: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Cc: "Stotland, Inga" <inga.stotland@intel.com>
Subject: Re: [PATCH BlueZ v2] mesh: Enable local loopback
Date: Mon, 11 Mar 2019 22:19:24 +0000 [thread overview]
Message-ID: <1552342761.29289.0.camel@intel.com> (raw)
In-Reply-To: <20190308224016.9857-1-brian.gix@intel.com>
Applied
On Fri, 2019-03-08 at 14:40 -0800, Brian Gix wrote:
> Implements mechanism to allow direct messaging between local
> nodes without requiring an external relay node.
> ---
> mesh/net.c | 51 ++++++++++++++++++++++++++++++++-------------------
> 1 file changed, 32 insertions(+), 19 deletions(-)
>
> diff --git a/mesh/net.c b/mesh/net.c
> index 2adae70c3..b173e1c09 100644
> --- a/mesh/net.c
> +++ b/mesh/net.c
> @@ -254,10 +254,24 @@ struct net_decode {
> bool proxy;
> };
>
> +struct net_queue_data {
> + struct mesh_io_recv_info *info;
> + struct mesh_net *net;
> + const uint8_t *data;
> + uint8_t *out;
> + size_t out_size;
> + enum _relay_advice relay_advice;
> + uint32_t key_id;
> + uint32_t iv_index;
> + uint16_t len;
> +};
> +
> #define FAST_CACHE_SIZE 8
> static struct l_queue *fast_cache;
> static struct l_queue *nets;
>
> +static void net_rx(void *net_ptr, void *user_data);
> +
> static inline struct mesh_subnet *get_primary_subnet(struct mesh_net *net)
> {
> return l_queue_peek_head(net->subnets);
> @@ -2267,16 +2281,27 @@ static void send_relay_pkt(struct mesh_net *net, uint8_t *data, uint8_t size)
> static void send_msg_pkt(struct mesh_net *net, uint8_t *packet, uint8_t size)
> {
> struct mesh_io *io = net->io;
> - struct mesh_io_send_info info = {
> - .type = MESH_IO_TIMING_TYPE_GENERAL,
> - .u.gen.interval = net->tx_interval,
> - .u.gen.cnt = net->tx_cnt,
> - .u.gen.min_delay = DEFAULT_MIN_DELAY,
> - /* No extra randomization when sending regular mesh messages */
> - .u.gen.max_delay = DEFAULT_MIN_DELAY
> + struct mesh_io_send_info info;
> + struct net_queue_data net_data = {
> + .info = NULL,
> + .data = packet + 1,
> + .len = size - 1,
> + .relay_advice = RELAY_NONE,
> };
>
> + /* Send to local nodes first */
> + l_queue_foreach(nets, net_rx, &net_data);
> +
> + if (net_data.relay_advice == RELAY_DISALLOWED)
> + return;
> +
> packet[0] = MESH_AD_TYPE_NETWORK;
> + info.type = MESH_IO_TIMING_TYPE_GENERAL;
> + info.u.gen.interval = net->tx_interval;
> + info.u.gen.cnt = net->tx_cnt;
> + info.u.gen.min_delay = DEFAULT_MIN_DELAY;
> + /* No extra randomization when sending regular mesh messages */
> + info.u.gen.max_delay = DEFAULT_MIN_DELAY;
>
> mesh_io_send(io, &info, packet, size);
> }
> @@ -2461,18 +2486,6 @@ static enum _relay_advice packet_received(void *user_data,
> return RELAY_NONE;
> }
>
> -struct net_queue_data {
> - struct mesh_io_recv_info *info;
> - struct mesh_net *net;
> - const uint8_t *data;
> - uint8_t *out;
> - size_t out_size;
> - enum _relay_advice relay_advice;
> - uint32_t key_id;
> - uint32_t iv_index;
> - uint16_t len;
> -};
> -
> static void net_rx(void *net_ptr, void *user_data)
> {
> struct net_queue_data *data = user_data;
prev parent reply other threads:[~2019-03-11 22:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-08 22:40 [PATCH BlueZ v2] mesh: Enable local loopback Brian Gix
2019-03-11 22:19 ` Gix, Brian [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1552342761.29289.0.camel@intel.com \
--to=brian.gix@intel.com \
--cc=inga.stotland@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).