Skip to content

Commit

Permalink
drivers: nxp_enet: Add get_config for ipv6 chksum
Browse files Browse the repository at this point in the history
Previously, ipv6 being disabled was a dependency of the hw acceleration
of the checksums for the nxp enet driver, because this ethernet has an
errata causing icmpv6 checksum to not be supported. Now, there is a new
config type in ethernet api for checksum types, so we can re-enable
hardware acceleration for ipv6 by implementing this type in the
get_config api in this driver.

Signed-off-by: Declan Snyder <[email protected]>
  • Loading branch information
decsny authored and nashif committed Nov 20, 2024
1 parent 91749df commit 9863dc9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
1 change: 0 additions & 1 deletion drivers/ethernet/nxp_enet/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ config ETH_NXP_ENET_USE_DTCM_FOR_DMA_BUFFER
config ETH_NXP_ENET_HW_ACCELERATION
bool "Hardware acceleration"
default y
depends on !NET_IPV6
help
Enable hardware acceleration for the following:
- IPv4, UDP and TCP checksum (both Rx and Tx)
Expand Down
21 changes: 21 additions & 0 deletions drivers/ethernet/nxp_enet/eth_nxp_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,26 @@ static int eth_nxp_enet_set_config(const struct device *dev,
return -ENOTSUP;
}

static int eth_nxp_enet_get_config(const struct device *dev,
enum ethernet_config_type type,
struct ethernet_config *cfg)
{
switch (type) {
case ETHERNET_CONFIG_TYPE_RX_CHECKSUM_SUPPORT:
case ETHERNET_CONFIG_TYPE_TX_CHECKSUM_SUPPORT:
cfg->chksum_support = ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER |
ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP |
ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER |
ETHERNET_CHECKSUM_SUPPORT_TCP |
ETHERNET_CHECKSUM_SUPPORT_UDP;
return 0;
default:
break;
}

return -ENOTSUP;
}

static int eth_nxp_enet_rx(const struct device *dev)
{
#if defined(CONFIG_PTP_CLOCK_NXP_ENET)
Expand Down Expand Up @@ -845,6 +865,7 @@ static const struct ethernet_api api_funcs = {
.get_capabilities = eth_nxp_enet_get_capabilities,
.get_phy = eth_nxp_enet_get_phy,
.set_config = eth_nxp_enet_set_config,
.get_config = eth_nxp_enet_get_config,
.send = NXP_ENET_SEND_FUNC,
#if defined(CONFIG_PTP_CLOCK)
.get_ptp_clock = eth_nxp_enet_get_ptp_clock,
Expand Down

0 comments on commit 9863dc9

Please sign in to comment.