Skip to content

Commit 9863dc9

Browse files
decsnynashif
authored andcommitted
drivers: nxp_enet: Add get_config for ipv6 chksum
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]>
1 parent 91749df commit 9863dc9

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

drivers/ethernet/nxp_enet/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ config ETH_NXP_ENET_USE_DTCM_FOR_DMA_BUFFER
5757
config ETH_NXP_ENET_HW_ACCELERATION
5858
bool "Hardware acceleration"
5959
default y
60-
depends on !NET_IPV6
6160
help
6261
Enable hardware acceleration for the following:
6362
- IPv4, UDP and TCP checksum (both Rx and Tx)

drivers/ethernet/nxp_enet/eth_nxp_enet.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,26 @@ static int eth_nxp_enet_set_config(const struct device *dev,
315315
return -ENOTSUP;
316316
}
317317

318+
static int eth_nxp_enet_get_config(const struct device *dev,
319+
enum ethernet_config_type type,
320+
struct ethernet_config *cfg)
321+
{
322+
switch (type) {
323+
case ETHERNET_CONFIG_TYPE_RX_CHECKSUM_SUPPORT:
324+
case ETHERNET_CONFIG_TYPE_TX_CHECKSUM_SUPPORT:
325+
cfg->chksum_support = ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER |
326+
ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP |
327+
ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER |
328+
ETHERNET_CHECKSUM_SUPPORT_TCP |
329+
ETHERNET_CHECKSUM_SUPPORT_UDP;
330+
return 0;
331+
default:
332+
break;
333+
}
334+
335+
return -ENOTSUP;
336+
}
337+
318338
static int eth_nxp_enet_rx(const struct device *dev)
319339
{
320340
#if defined(CONFIG_PTP_CLOCK_NXP_ENET)
@@ -845,6 +865,7 @@ static const struct ethernet_api api_funcs = {
845865
.get_capabilities = eth_nxp_enet_get_capabilities,
846866
.get_phy = eth_nxp_enet_get_phy,
847867
.set_config = eth_nxp_enet_set_config,
868+
.get_config = eth_nxp_enet_get_config,
848869
.send = NXP_ENET_SEND_FUNC,
849870
#if defined(CONFIG_PTP_CLOCK)
850871
.get_ptp_clock = eth_nxp_enet_get_ptp_clock,

0 commit comments

Comments
 (0)