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

rm_netxduo_ether receive path fixes regarding netx interface index and pointer #374

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

elrafoon
Copy link

Without this fixes, rm_netxduo_ether is only usable if it is the primary interface of given netxduo NX_IP stack.

But that's not always the case!

…interface access

When rm_netxduo_ether is not first interface registered with netxduo
stack, indexing using p_cfg->channel won't work.
If it is kept uninitialized (NULL), netxduo stack initializes it to
&nx_ip_interface[0], which is correct only if rm_netxduo_ether is
registered as first interface of given IP stack.
Copy link

@jritchey-renesas jritchey-renesas left a comment

Choose a reason for hiding this comment

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

I agree, this is a bug in the existing driver.

Could you also apply this change to lines 788, and 833? The correct interface index needs to be provided to _nx_ip_driver_link_status_event.

            /* Notify NetX that the link is up. */
            p_netxduo_ether_instance->p_ctrl->p_interface->nx_interface_link_up = NX_TRUE;
            _nx_ip_driver_link_status_event(p_netxduo_ether_instance->p_ctrl->p_ip,
                                            p_netxduo_ether_instance->p_ctrl->p_interface->nx_interface_index);
            /* Notify NetX that the link is down. */
            p_netxduo_ether_instance->p_ctrl->p_interface->nx_interface_link_up = NX_FALSE;
            _nx_ip_driver_link_status_event(p_netxduo_ether_instance->p_ctrl->p_ip,
                                            p_netxduo_ether_instance->p_ctrl->p_interface->nx_interface_index);

@@ -332,7 +332,7 @@ void rm_netxduo_ether (NX_IP_DRIVER * driver_req_ptr, rm_netxduo_ether_instance_
{
/* Return the link status in the supplied return pointer. */
*(driver_req_ptr->nx_ip_driver_return_ptr) =
driver_req_ptr->nx_ip_driver_ptr->nx_ip_interface[p_ether_instance->p_cfg->channel].nx_interface_link_up;
driver_req_ptr->nx_ip_driver_ptr->nx_ip_interface[interface_ptr->nx_interface_index].nx_interface_link_up;
Copy link

@jritchey-renesas jritchey-renesas Oct 8, 2024

Choose a reason for hiding this comment

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

We can access interface_ptr directly here.

*(driver_req_ptr->nx_ip_driver_return_ptr) = interface_ptr->nx_interface_link_up;

@renesas-abigail
Copy link
Collaborator

This PR is tracked internally by FSPRA-3840.

@jritchey-renesas jritchey-renesas added this to the v5.6.0 milestone Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants