Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NUC472/M487: Limit EMAC receive frame length as 1518 #12057

Merged
merged 3 commits into from Dec 11, 2019

Conversation

cyliangtw
Copy link
Contributor

Summary of changes

Limit the max receive frame length of EMAC to (1514 + 4) bytes.
According to the EMAC H/W design, this setting could avoid the risk of SRAM overwrite as while come-in some long packet over 1518 bytes.

Documentation

None

Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@@ -262,6 +262,8 @@ void numaker_eth_init(uint8_t *mac_addr)
EMAC_CAMCTL_ABP_Msk;
EMAC->CAMEN = 1; // Enable CAM entry 0

/* Limit the max receive frame length to 1514 + 4 */
EMAC->MRFL = 1518;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be expressed based on NU_ETH_MAX_FLEN or PACKET_BUFFER_SIZE?

It might be that those are not quite defined right - I would expect the NU_ETH_MAX_FLEN to be 1518, not 1520, and then maybe PACKET_BUFFER_SIZE should be that rounded up to 1520 (multiple of 4).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kjbracey-arm, thanks of your advisement, I correct the definition & relative code in this commit 42103f0.

@ciarmcom ciarmcom requested review from a team December 9, 2019 14:00
@ciarmcom
Copy link
Member

ciarmcom commented Dec 9, 2019

@cyliangtw, thank you for your changes.
@ARMmbed/mbed-os-ipcore @ARMmbed/mbed-os-maintainers please review.

@0xc0170 0xc0170 added needs: CI release-version: 6.0.0-alpha-1 First pre-release version of 6.0.0 and removed needs: review labels Dec 10, 2019
@mbed-ci
Copy link

mbed-ci commented Dec 10, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@0xc0170 0xc0170 removed the needs: CI label Dec 11, 2019
@0xc0170 0xc0170 merged commit a996ea2 into ARMmbed:master Dec 11, 2019
@cyliangtw cyliangtw deleted the nuvoton_emac_max_recv branch May 19, 2020 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-version: 6.0.0-alpha-1 First pre-release version of 6.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants