According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:
sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Fix#42800
Both pss->rate_ratio and port_ds->neighbor_rate_ratio are double type
but sync_receipt_time is uint64_t. If pss->rate_ratio is less than 1
or sync_receipt_time * port_ds->neighbor_rate_ratio is less than 1,
sync_receipt_time becomes 0 due to double to uint64_t cast.
Assign port_ds->neighbor_prop_delay to sync_receipt_time first to fix
this issue.
Signed-off-by: Lu Ding <lucasdinglu@gmail.com>
correction field in sync follow up message must be converted from host
endianness to network endianness.
Signed-off-by: Lu Ding <lucasdinglu@gmail.com>
The comment before this change was misleading, as those functions
(and other ones used from the level of user space application) require
DSA interface (like lan{012}), not the master one (like eth0).
Signed-off-by: Lukasz Majewski <lukma@denx.de>
The address of DSA API functions' structure available for usage from
the level of user's application (like for example in
samples/net/dsa/src) is stored in dsa context, not per DSA interface
device.
The struct dsa_context is defined once for all DSA (i.e. not master)
interfaces.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Replace unpacked in6_addr structures with raw buffers in net_ipv6_hdr
struct, to prevent compiler warnings about unaligned access.
Remove __packed parameter from `struct net_6lo_context` since the
structure isn't really serialized.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Replace unpacked in_addr structures with raw buffers in net_ipv4_hdr
struct, to prevent compiler warnings about unaligned access.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Replace unpacked in_addr/in6_addr structures with raw buffers in
net_arp_hdr struct, to prevent compiler warnings about unaligned
access.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
`net_eth_vlan_enable()` allowed to use illegal vlan tag values, fix this
by disallowing any tag value higher or equal to 0xfff (which is a limit
for the tag and a reserved value).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The print specifier for `atomic_t` should be updated
to `%ld`, `%lu`, or `%lx` to account for the type
change of `atomic_t` to `long`.
Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
There was a problem with source address selection for ARP
retransmissions, when an ARP entry was already pending. In such case,
the `entry` value passed to `arp_prepare()` is NULL, which in result
caused the `current_ip` variable being used as the source value. The
problem with this approach is, that the `current_ip` is only set in
IPv4 autoconf, the Ethernet L2 does not set this variable. In result,
every retransmission of an ARP packet was sent with unspecified source
address, preventing the response from being handled.
Fix this by partially restoring the behaviour of the ARP source address
assignment from before IPv4 autoconf was introduced. If the ARP is sent
by the IPv4 autoconf, use the `current_ip` value provided. If entry is
not set, use the source IPv4 address set in the actual data packet.
Otherwise, search for a source address on the interface corresponding to
the `entry`.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
With the introduction of `EXPERIMENTAL` and `WARN_EXPERIMENTAL` in
Zephyr all subsys/net and drivers/ethernet/Kconfig.e1000 settings
having `[EXPERIMENTAL]` in their prompt has has been updated to include
`select EXPERIMENTAL` so that developers can enable warnings when
experimental features are enabled.
The following settings has EXPERIMENTAL removed as they are considered
mature:
- NET_OFFLOAD
- NET_PROMISCUOUS_MODE
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes#38994, ARP messages were being sent to IPvXmcast MAC addresses
rather than the expected source MAC address or the broadcast address.
Signed-off-by: Robert Melchers <rmelch@hotmail.com>
As per #38352, we would like to start building out PTP (IEEE 1588)
support for superset of gPTP functionality in Zephyr. This is the first
step to abstract away some key interfaces from NET_GPTP umbrella to
NET_L2_PTP.
Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
Refactor IPv4 multicast address to MAC multicast address conversion
into its own function, so it can be reused by drivers as it is already
possible for IPv6 multicast addresses.
Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.
Note that the include to subsys has been moved from
under the drivers into subsys, as it is actually
the subsystem's job to make sure the include
directories are correct.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This migrates all the current iterable section usages to the external
API, dropping the "Z_" prefix:
Z_ITERABLE_SECTION_ROM
Z_ITERABLE_SECTION_ROM_GC_ALLOWED
Z_ITERABLE_SECTION_RAM
Z_ITERABLE_SECTION_RAM_GC_ALLOWED
Z_STRUCT_SECTION_ITERABLE
Z_STRUCT_SECTION_ITERABLE_ALTERNATE
Z_STRUCT_SECTION_FOREACH
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Change DSA API to use `net_if` directly to make API calls instead of
indirectly via `dsa_context` and `switch_id`.
Remove unused `switch_id`, `switch_enable_port`, and `dsa_get_context`.
Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
This provides a command line interface to query and modify
bridge instances, similar to Linux's brctl utility.
It can be used to inspect an application's bridge usage,
or manage a bridge of its own in a generic way.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This adds the ability to create Ethernet bridges for connecting
separate Ethernet segments together to appear as a single
Ethernet network.
This mimics the Linux functionality of the same name.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Allow caller to either set or receive various Ethernet Qbu
configuration options defined in IEEE Std 802.1Qbu-2016
specification.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Allow caller to either set or receive various Ethernet Qbv
configuration options defined in IEEE Std 802.1Qbv-2015
specification.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Replace all existing deprecated API with the recommended alternative.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Create net_l2_send() function which will be called by each L2
sending function so that we can catch all the network packets
that are being sent. Some L2 layers send things a bit differently,
so in those cases call the net_capture_send() directly by the L2
layer.
Add network packet capture call in receive side after the pkt has
been received by the RX queue handler. This avoids calling the
net_capture_send() from ISR context.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add infrastructure to allow user to configure the system so that
all the network packets, that are sent to or received from a specific
network interface, are sent to remote system for analysis.
The captured network packets are placed as a payload in UDP packet,
which is then sent inside a tunnel to a remote host. The host can
then receive the packets and for example show them in wireshark.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Move ptp_clock.h out of the top level include/ dir into
include/drivers/ptp_clock.h and deprecated the old location.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
net_eth_carrier_on() and net_eth_carrier_off() call k_work_init() on
work item that can be pending or still be processed in another thread.
This results in undefined behavior.
Initialize work item once and use an atomic flag to switch between
up/down carrier state. Submit work to workqueue whenever up/down carrier
state changes, so that last state is always properly propagated to
network interface layer.
While at it, save network interface pointer during ethernet context
initialization, so that is becomes static (and thread-safe) during whole
ethernet context lifetime.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
subpress warnings from llvm:
warning: absolute value function 'abs' given an argument of type
'int64_t' (aka 'long long') but has parameter of type 'int' which may
cause truncation of value [-Wabsolute-value]
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Instead of directly checking the multicast IPv4 address, use
the net_ipv4_is_addr_mcast() utility function.
Fixes#26584
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Check that Ethernet header is in the first net_buf fragment.
This is very unlikely to happen as device driver is expected
to only deliver proper Ethernet frames to upper stack.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Instead of hardcoding the priority1 and priority2 values used
in BMCA, let the user tweak the values via Kconfig.
Fixes#28151
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.
A coccinelle rule is used for this:
@r_const_dev_1
disable optional_qualifier
@
@@
-struct device *
+const struct device *
@r_const_dev_2
disable optional_qualifier
@
@@
-struct device * const
+const struct device *
Fixes#27399
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Allow user to create SOCK_DGRAM type AF_PACKET socket. This
allows user to send raw IP packets without specifying
L2 (like Ethernet) headers.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The steps_removed field must be placed right after root_system_id
so that priority vector comparision can be done in one memcmp()
call. This fixes the best master clock selection algorithm (BMCA).
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
-Wimplicit-fallthrough=2 requires a fallthrough comment or a compiler
to tells gcc that this happens intentionally.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Save some memory and separate common string snippets from larger
strings. In this case "does not match" sub-string is printed by
several warning prints so separate the sub-string from the bigger
string.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Unit tests were failing to build because random header was included by
kernel_includes.h. The problem is that rand32.h includes a generated
file that is either not generated or not included when building unit
tests. Also, it is better to limit the scope of this file to where it is
used.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
The sync receive timeout was using invalid value (nanoseconds
instead of milliseconds). This caused unnecessary state switches
from SLAVE to MASTER and back.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add debug prints when the port announce information state
machine state changes. This is useful in debugging.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The port number is stored starting from 0 in Ethernet context.
But in gPTP, it is an index which starts from 1. So increase
the value by 1 for a value returned from Ethernet context.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Avoid null pointer access by checking that Ethernet device has
PTP clock before trying to get the actual PTP clock device.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>