-
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
Add raweth data length header field #294
Conversation
@@ -477,6 +477,8 @@ typedef struct { | |||
} _z_t_msg_fragment_t; | |||
void _z_t_msg_fragment_clear(_z_t_msg_fragment_t *msg); | |||
|
|||
#define _Z_FRAGMENT_HEADER_SIZE 12 |
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.
This is actually not true, the fragment header size may vary depending on the used protocol extension.
As a consequence, basing the code logic on this value may lead to some bugs.
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'd say we should fix this in another PR, I opened an issue on the overall issue: #295
@@ -44,6 +45,7 @@ typedef struct { | |||
uint16_t vlan_type; // Vlan ethtype | |||
uint16_t tag; // Vlan tag | |||
uint16_t ethtype; // Ethertype of frame |
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.
Do we need ethtype
then? As far as I understand it, data_legnth
replaces ethtype
.
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.
802.3 raw requires us to use a 802.2 LLC header which would be 3 bytes of useless information for us, so I figured an ethertype and a frame length was the most efficient choice.
@@ -116,7 +116,7 @@ int8_t _z_multicast_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_m | |||
} else { | |||
// The message does not fit in the current batch, let's fragment it | |||
// Create an expandable wbuf for fragmentation | |||
_z_wbuf_t fbf = _z_wbuf_make(ztm->_wbuf._capacity - 12, true); | |||
_z_wbuf_t fbf = _z_wbuf_make(ztm->_wbuf._capacity - _Z_FRAGMENT_HEADER_SIZE, true); |
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.
The fragmentation buffer should allocate a small amount of memory and it shouldn't be dependent on the fragment header size.
@@ -125,7 +125,7 @@ int8_t _z_unicast_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_msg | |||
} else { | |||
// The message does not fit in the current batch, let's fragment it | |||
// Create an expandable wbuf for fragmentation | |||
_z_wbuf_t fbf = _z_wbuf_make(ztu->_wbuf._capacity - 12, true); | |||
_z_wbuf_t fbf = _z_wbuf_make(ztu->_wbuf._capacity - _Z_FRAGMENT_HEADER_SIZE, true); |
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.
See my comment on the fragment header size above.
Because ethernet frame minimum size is 64 bytes, some device will pad frames. This forces us to add a field containing our actual payload length.