Date: Fri, 21 Jun 2013 23:49:26 +0200 From: Monthadar Al Jaberi <monthadar@gmail.com> To: freebsd-hackers@freebsd.org Subject: Replace Linux skb_put with mbuf m_append Message-ID: <CA%2BsBSoKk3EpQdmLyf7k77iM4vomD1y_71qHkPvUXJgzFTSt%2BSQ@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BsBSoKk3EpQdmLyf7k77iM4vomD1y_71qHkPvUXJgzFTSt%2BSQ>