-
Notifications
You must be signed in to change notification settings - Fork 82
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
base: master
Are you sure you want to change the base?
Conversation
…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.
There was a problem hiding this 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; |
There was a problem hiding this comment.
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;
This PR is tracked internally by FSPRA-3840. |
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!