Replace Linux skb_put with mbuf m_append
Monthadar Al Jaberi
monthadar at gmail.com
Fri Jun 21 21:49:27 UTC 2013
Hi everyone,
I am porting linux skb buffers to mbufs and stumbelded on this code
from artheros 6kl driver.
struct htc_conn_service_msg *conn_msg;
...
/* assemble connect service message */
conn_msg = (struct htc_conn_service_msg *) skb_put(skb, length);
if (conn_msg == NULL) {
goto free_packet;
}
memset(conn_msg, 0, sizeof(struct htc_conn_service_msg));
....
what skb_put does is get a pointer to the end of the buffer with
engouh space to write data there.
I have thought of chaning it to:
struct htc_conn_service_msg conn_msg;
...
memset(&conn_msg, 0, sizeof(struct htc_conn_service_msg));
....
if (m_append(m, length, (uint8_t *) &conn_msg)) {
goto free_packet;
}
I append to the mbuf in the end.
I would like to hear your opinion on this. Is there a better faster way?
br,
--
Monthadar Al Jaberi
More information about the freebsd-hackers
mailing list