drivers/wifi: Switch eswifi driver to new net_pkt API

Brings tiny simplifications.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2019-02-20 21:13:44 +01:00 committed by Anas Nashif
commit 6fabbb7d14

View file

@ -86,13 +86,14 @@ static void eswifi_off_read_work(struct k_work *work)
LOG_ERR("payload sz = %d", len);
pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
pkt = net_pkt_rx_alloc_with_buffer(eswifi->iface, len,
AF_UNSPEC, 0, K_NO_WAIT);
if (!pkt) {
LOG_ERR("Cannot allocate rx packet");
goto done;
}
if (!net_pkt_append_all(pkt, len, data, K_NO_WAIT)) {
if (!net_pkt_write_new(pkt, data, len)) {
LOG_WRN("Incomplete buffer copy");
}
@ -310,7 +311,6 @@ static int __eswifi_off_send_pkt(struct eswifi_dev *eswifi,
struct eswifi_off_socket *socket)
{
struct net_pkt *pkt = socket->tx_pkt;
struct net_buf *frag;
unsigned int bytes;
int err, offset;
@ -329,11 +329,12 @@ static int __eswifi_off_send_pkt(struct eswifi_dev *eswifi,
offset = strlen(eswifi->buf);
/* copy payload */
for (frag = pkt->frags; frag; frag = frag->frags) {
memcpy(&eswifi->buf[offset], frag->data, frag->len);
offset += frag->len;
if (net_pkt_read_new(pkt, &eswifi->buf[offset], bytes)) {
return -ENOBUFS;
}
offset += bytes;
err = eswifi_request(eswifi, eswifi->buf, offset + 1,
eswifi->buf, sizeof(eswifi->buf));
if (err < 0) {