Try to catch the original caller of setup_gptp_frame() function
in order to see who is allocating buffers.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This is useful info as otherwise we get no indication to user
if the packet is not created and not sent.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Increase the net_buf length in proper places. So when gPTP
header is added, increase the buf->len properly, and then
when gPTP packet type is added, increase it again properly.
This way the net_buf length is updated in more logical way.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
As the msg parameter for PRINT_INFO() is always a const string
that is not coming from stack, there is no need to use
log_strdup() here. This helps to avoid the
"<log_strdup alloc failed>" messages.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Remove network specific default and max log level setting
and start to use the zephyr logging values for those.
Remove LOG_MODULE_REGISTER() from net_core.h and place the
calls into .c files. This is done in order to avoid weird
compiler errors in some cases and to make the code look similar
as other subsystems.
Fixes#11343Fixes#11659
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Instead of redoing what Ethernet L2 already does, let just create the
gptp message without any Ethenet header. Which one will be done as
sending phase by Ethernet L2 relevantly.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
As the debugging print calls are async, all the strings that might
be overwritten must use log_strdup() which will create a copy
of the printable string.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Currently logging subsystem supports quite small number of function
parameters. So split some long functions into smaller pieces.
Hopefully this is just a temporary patch and we can support more
parameters to logging macros.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Instead of one global log level option and one on/off boolean
config option / module, this commit creates one log level option
for each module. This simplifies the logging as it is now possible
to enable different level of debugging output for each network
module individually.
The commit also converts the code to use the new logger
instead of the old sys_log.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The return of memset is never checked. This patch explicitly ignore
the return to avoid MISRA-C violations.
The only directory excluded directory was ext/* since it contains
only imported code.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
There is no point in sending Announces with GM chosen in BMCA if it is
expired and InfoIS is changed to MINE.
Check where does the GM info come from and fill the Announce packet
accordingly.
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
The problem is that net_if_call_timestamp_cb only checked if the
callback was registered for the PORT which invoked the whole action.
There is a possibility, that the callback will be registered, and packet
A will be passed to eth driver. Before the driver is finished with
packet A, network layer will start handling another packet (B) - so it
will unregister the callback for packet A and register it for B. After
that the network driver will finish processing packet A and invoke the
timestamp callback. The mechanism would then only check if a callback is
registered for the port of the driver and invoke the callback for the
packet that was registered earlier (so A instead of B).
This commit fixes that by storing info not only about the port but about
the packet too.
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
Previously the newer one got dropped.
The older ones will be dropped in a way that the follow up messages for
them will not be sent.
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
Do not clear pending PDELAY_REQ pointer when sending a new one.
Unref the state->tx_pdelay_req_ptr first and only then set the
new pointer value. This will prevent buffer leak if we miss the
response from the peer.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The problem with the previous approach was that the response timestamp
callback which calls net_pkt_unref could be skipped if the callback was
already registered for another packet. The net_pkt_ref function was
always called which led to memory leaks.
This commit simply disallows handling multiple pdelay requests at once.
If the timestamp callback is already registered, the received request
will not be handled.
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
Use priority 3 (critial app) for outgoing event messages (Sync,
Pdelay_Req and Pdelay_Resp). Use priority 6 (Internetwork Control)
for all other outgoing packets.
See IEEE 802.1Q chapter 8.4.4 for more details.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>