From 581f35e577f3bda8ca2a55a1d27011b3e7e79513 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Thu, 14 Jan 2021 22:16:30 +0100 Subject: [PATCH] sys/net/gnrc/netif: adapt to new API For Ethernet, raw netifs, and IEEE 802.15.4 netifs only release outgoing frame with legacy drivers, as gnrc_netif does so with new non-blocking API. --- sys/net/gnrc/netif/ethernet/gnrc_netif_ethernet.c | 5 ++++- sys/net/gnrc/netif/gnrc_netif_raw.c | 6 ++++-- sys/net/gnrc/netif/ieee802154/gnrc_netif_ieee802154.c | 6 ++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sys/net/gnrc/netif/ethernet/gnrc_netif_ethernet.c b/sys/net/gnrc/netif/ethernet/gnrc_netif_ethernet.c index bc159a8549..5f78c086b8 100644 --- a/sys/net/gnrc/netif/ethernet/gnrc_netif_ethernet.c +++ b/sys/net/gnrc/netif/ethernet/gnrc_netif_ethernet.c @@ -162,7 +162,10 @@ static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) #endif res = dev->driver->send(dev, &iolist); - gnrc_pktbuf_release(pkt); + if (gnrc_netif_netdev_legacy_api(netif)) { + /* only for legacy drivers we need to release pkt here */ + gnrc_pktbuf_release(pkt); + } return res; } diff --git a/sys/net/gnrc/netif/gnrc_netif_raw.c b/sys/net/gnrc/netif/gnrc_netif_raw.c index bf6dbeaf02..0ba358fd17 100644 --- a/sys/net/gnrc/netif/gnrc_netif_raw.c +++ b/sys/net/gnrc/netif/gnrc_netif_raw.c @@ -120,8 +120,10 @@ static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) #endif res = dev->driver->send(dev, (iolist_t *)pkt); - /* release old data */ - gnrc_pktbuf_release(pkt); + if (gnrc_netif_netdev_legacy_api(netif)) { + /* only for legacy drivers we need to release pkt here */ + gnrc_pktbuf_release(pkt); + } return res; } diff --git a/sys/net/gnrc/netif/ieee802154/gnrc_netif_ieee802154.c b/sys/net/gnrc/netif/ieee802154/gnrc_netif_ieee802154.c index 8ac465145d..806f94fb6d 100644 --- a/sys/net/gnrc/netif/ieee802154/gnrc_netif_ieee802154.c +++ b/sys/net/gnrc/netif/ieee802154/gnrc_netif_ieee802154.c @@ -398,8 +398,10 @@ static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt) res = dev->driver->send(dev, &iolist_header); #endif - /* release old data */ - gnrc_pktbuf_release(pkt); + if (gnrc_netif_netdev_legacy_api(netif)) { + /* only for legacy drivers we need to release pkt here */ + gnrc_pktbuf_release(pkt); + } return res; } /** @} */