Skip to content

Commit be896c9

Browse files
committed
drivers: wifi/airoc: update airoc_wifi_host_buffer_get
Update airoc_wifi_host_buffer_get function to set final buff size based on input “size” param. Update airoc_mgmt_send to use airoc_wifi_host_buffer_get instead net_buf_alloc_len. Signed-off-by: Nazar Palamar <[email protected]>
1 parent c8cd57f commit be896c9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/wifi/infineon/airoc_wifi.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,14 @@ static whd_result_t airoc_wifi_host_buffer_get(whd_buffer_t *buffer, whd_buffer_
220220
struct net_buf *buf;
221221

222222
buf = net_buf_alloc_len(&airoc_pool, size, K_NO_WAIT);
223-
if (buf == NULL) {
223+
if ((buf == NULL) || (buf->size < size)) {
224224
return WHD_BUFFER_ALLOC_FAIL;
225225
}
226226
*buffer = buf;
227+
228+
/* Set buffer size */
229+
(void) airoc_wifi_buffer_set_size(*buffer, size);
230+
227231
return WHD_SUCCESS;
228232
}
229233

@@ -288,8 +292,9 @@ static int airoc_mgmt_send(const struct device *dev, struct net_pkt *pkt)
288292
}
289293

290294
/* Allocate Network Buffer from pool with Packet Length + Data Header */
291-
buf = net_buf_alloc_len(&airoc_pool, pkt_len + sizeof(data_header_t), K_NO_WAIT);
292-
if (buf == NULL) {
295+
ret = airoc_wifi_host_buffer_get((whd_buffer_t *) &buf, WHD_NETWORK_TX,
296+
pkt_len + sizeof(data_header_t), 0);
297+
if ((ret != WHD_SUCCESS) || (buf == NULL)) {
293298
return -EIO;
294299
}
295300

0 commit comments

Comments
 (0)