1c0c77d8fSBjörn Töpel // SPDX-License-Identifier: GPL-2.0 2c0c77d8fSBjörn Töpel /* XDP user-space packet buffer 3c0c77d8fSBjörn Töpel * Copyright(c) 2018 Intel Corporation. 4c0c77d8fSBjörn Töpel */ 5c0c77d8fSBjörn Töpel 6c0c77d8fSBjörn Töpel #include <linux/init.h> 7c0c77d8fSBjörn Töpel #include <linux/sched/mm.h> 8c0c77d8fSBjörn Töpel #include <linux/sched/signal.h> 9c0c77d8fSBjörn Töpel #include <linux/sched/task.h> 10c0c77d8fSBjörn Töpel #include <linux/uaccess.h> 11c0c77d8fSBjörn Töpel #include <linux/slab.h> 12c0c77d8fSBjörn Töpel #include <linux/bpf.h> 13c0c77d8fSBjörn Töpel #include <linux/mm.h> 1484c6b868SJakub Kicinski #include <linux/netdevice.h> 1584c6b868SJakub Kicinski #include <linux/rtnetlink.h> 16c0c77d8fSBjörn Töpel 17c0c77d8fSBjörn Töpel #include "xdp_umem.h" 18e61e62b9SBjörn Töpel #include "xsk_queue.h" 19c0c77d8fSBjörn Töpel 20bbff2f32SBjörn Töpel #define XDP_UMEM_MIN_CHUNK_SIZE 2048 21c0c77d8fSBjörn Töpel 22ac98d8aaSMagnus Karlsson void xdp_add_sk_umem(struct xdp_umem *umem, struct xdp_sock *xs) 23ac98d8aaSMagnus Karlsson { 24ac98d8aaSMagnus Karlsson unsigned long flags; 25ac98d8aaSMagnus Karlsson 26ac98d8aaSMagnus Karlsson spin_lock_irqsave(&umem->xsk_list_lock, flags); 27ac98d8aaSMagnus Karlsson list_add_rcu(&xs->list, &umem->xsk_list); 28ac98d8aaSMagnus Karlsson spin_unlock_irqrestore(&umem->xsk_list_lock, flags); 29ac98d8aaSMagnus Karlsson } 30ac98d8aaSMagnus Karlsson 31ac98d8aaSMagnus Karlsson void xdp_del_sk_umem(struct xdp_umem *umem, struct xdp_sock *xs) 32ac98d8aaSMagnus Karlsson { 33ac98d8aaSMagnus Karlsson unsigned long flags; 34ac98d8aaSMagnus Karlsson 35ac98d8aaSMagnus Karlsson if (xs->dev) { 36ac98d8aaSMagnus Karlsson spin_lock_irqsave(&umem->xsk_list_lock, flags); 37ac98d8aaSMagnus Karlsson list_del_rcu(&xs->list); 38ac98d8aaSMagnus Karlsson spin_unlock_irqrestore(&umem->xsk_list_lock, flags); 39ac98d8aaSMagnus Karlsson 40ac98d8aaSMagnus Karlsson if (umem->zc) 41ac98d8aaSMagnus Karlsson synchronize_net(); 42ac98d8aaSMagnus Karlsson } 43ac98d8aaSMagnus Karlsson } 44ac98d8aaSMagnus Karlsson 4584c6b868SJakub Kicinski int xdp_umem_query(struct net_device *dev, u16 queue_id) 4684c6b868SJakub Kicinski { 4784c6b868SJakub Kicinski struct netdev_bpf bpf; 4884c6b868SJakub Kicinski 4984c6b868SJakub Kicinski ASSERT_RTNL(); 5084c6b868SJakub Kicinski 5184c6b868SJakub Kicinski memset(&bpf, 0, sizeof(bpf)); 5284c6b868SJakub Kicinski bpf.command = XDP_QUERY_XSK_UMEM; 5384c6b868SJakub Kicinski bpf.xsk.queue_id = queue_id; 5484c6b868SJakub Kicinski 5584c6b868SJakub Kicinski if (!dev->netdev_ops->ndo_bpf) 5684c6b868SJakub Kicinski return 0; 5784c6b868SJakub Kicinski return dev->netdev_ops->ndo_bpf(dev, &bpf) ?: !!bpf.xsk.umem; 5884c6b868SJakub Kicinski } 5984c6b868SJakub Kicinski 60173d3adbSBjörn Töpel int xdp_umem_assign_dev(struct xdp_umem *umem, struct net_device *dev, 61173d3adbSBjörn Töpel u32 queue_id, u16 flags) 62173d3adbSBjörn Töpel { 63173d3adbSBjörn Töpel bool force_zc, force_copy; 64173d3adbSBjörn Töpel struct netdev_bpf bpf; 65173d3adbSBjörn Töpel int err; 66173d3adbSBjörn Töpel 67173d3adbSBjörn Töpel force_zc = flags & XDP_ZEROCOPY; 68173d3adbSBjörn Töpel force_copy = flags & XDP_COPY; 69173d3adbSBjörn Töpel 70173d3adbSBjörn Töpel if (force_zc && force_copy) 71173d3adbSBjörn Töpel return -EINVAL; 72173d3adbSBjörn Töpel 73173d3adbSBjörn Töpel if (force_copy) 74173d3adbSBjörn Töpel return 0; 75173d3adbSBjörn Töpel 76f734607eSJakub Kicinski if (!dev->netdev_ops->ndo_bpf || !dev->netdev_ops->ndo_xsk_async_xmit) 7796c26e04SPrashant Bhole return force_zc ? -EOPNOTSUPP : 0; /* fail or fallback */ 78173d3adbSBjörn Töpel 79173d3adbSBjörn Töpel rtnl_lock(); 8084c6b868SJakub Kicinski err = xdp_umem_query(dev, queue_id); 8184c6b868SJakub Kicinski if (err) { 8296c26e04SPrashant Bhole err = err < 0 ? -EOPNOTSUPP : -EBUSY; 8384c6b868SJakub Kicinski goto err_rtnl_unlock; 8484c6b868SJakub Kicinski } 85173d3adbSBjörn Töpel 86173d3adbSBjörn Töpel bpf.command = XDP_SETUP_XSK_UMEM; 87173d3adbSBjörn Töpel bpf.xsk.umem = umem; 88173d3adbSBjörn Töpel bpf.xsk.queue_id = queue_id; 89173d3adbSBjörn Töpel 90173d3adbSBjörn Töpel err = dev->netdev_ops->ndo_bpf(dev, &bpf); 91f734607eSJakub Kicinski if (err) 9284c6b868SJakub Kicinski goto err_rtnl_unlock; 9384c6b868SJakub Kicinski rtnl_unlock(); 94173d3adbSBjörn Töpel 95f734607eSJakub Kicinski dev_hold(dev); 96173d3adbSBjörn Töpel umem->dev = dev; 97173d3adbSBjörn Töpel umem->queue_id = queue_id; 98173d3adbSBjörn Töpel umem->zc = true; 99173d3adbSBjörn Töpel return 0; 10084c6b868SJakub Kicinski 10184c6b868SJakub Kicinski err_rtnl_unlock: 10284c6b868SJakub Kicinski rtnl_unlock(); 10384c6b868SJakub Kicinski return force_zc ? err : 0; /* fail or fallback */ 104173d3adbSBjörn Töpel } 105173d3adbSBjörn Töpel 106ac98d8aaSMagnus Karlsson static void xdp_umem_clear_dev(struct xdp_umem *umem) 107173d3adbSBjörn Töpel { 108173d3adbSBjörn Töpel struct netdev_bpf bpf; 109173d3adbSBjörn Töpel int err; 110173d3adbSBjörn Töpel 111173d3adbSBjörn Töpel if (umem->dev) { 112173d3adbSBjörn Töpel bpf.command = XDP_SETUP_XSK_UMEM; 113173d3adbSBjörn Töpel bpf.xsk.umem = NULL; 114173d3adbSBjörn Töpel bpf.xsk.queue_id = umem->queue_id; 115173d3adbSBjörn Töpel 116173d3adbSBjörn Töpel rtnl_lock(); 117173d3adbSBjörn Töpel err = umem->dev->netdev_ops->ndo_bpf(umem->dev, &bpf); 118173d3adbSBjörn Töpel rtnl_unlock(); 119173d3adbSBjörn Töpel 120173d3adbSBjörn Töpel if (err) 121173d3adbSBjörn Töpel WARN(1, "failed to disable umem!\n"); 122173d3adbSBjörn Töpel 123173d3adbSBjörn Töpel dev_put(umem->dev); 124173d3adbSBjörn Töpel umem->dev = NULL; 125173d3adbSBjörn Töpel } 126173d3adbSBjörn Töpel } 127173d3adbSBjörn Töpel 128c0c77d8fSBjörn Töpel static void xdp_umem_unpin_pages(struct xdp_umem *umem) 129c0c77d8fSBjörn Töpel { 130c0c77d8fSBjörn Töpel unsigned int i; 131c0c77d8fSBjörn Töpel 132c0c77d8fSBjörn Töpel for (i = 0; i < umem->npgs; i++) { 133c0c77d8fSBjörn Töpel struct page *page = umem->pgs[i]; 134c0c77d8fSBjörn Töpel 135c0c77d8fSBjörn Töpel set_page_dirty_lock(page); 136c0c77d8fSBjörn Töpel put_page(page); 137c0c77d8fSBjörn Töpel } 138c0c77d8fSBjörn Töpel 139c0c77d8fSBjörn Töpel kfree(umem->pgs); 140c0c77d8fSBjörn Töpel umem->pgs = NULL; 141c0c77d8fSBjörn Töpel } 142c0c77d8fSBjörn Töpel 143c0c77d8fSBjörn Töpel static void xdp_umem_unaccount_pages(struct xdp_umem *umem) 144c0c77d8fSBjörn Töpel { 145c09290c5SDaniel Borkmann if (umem->user) { 146c0c77d8fSBjörn Töpel atomic_long_sub(umem->npgs, &umem->user->locked_vm); 147c0c77d8fSBjörn Töpel free_uid(umem->user); 148c0c77d8fSBjörn Töpel } 149c09290c5SDaniel Borkmann } 150c0c77d8fSBjörn Töpel 151c0c77d8fSBjörn Töpel static void xdp_umem_release(struct xdp_umem *umem) 152c0c77d8fSBjörn Töpel { 153c0c77d8fSBjörn Töpel struct task_struct *task; 154c0c77d8fSBjörn Töpel struct mm_struct *mm; 155c0c77d8fSBjörn Töpel 156173d3adbSBjörn Töpel xdp_umem_clear_dev(umem); 157173d3adbSBjörn Töpel 158423f3832SMagnus Karlsson if (umem->fq) { 159423f3832SMagnus Karlsson xskq_destroy(umem->fq); 160423f3832SMagnus Karlsson umem->fq = NULL; 161423f3832SMagnus Karlsson } 162423f3832SMagnus Karlsson 163fe230832SMagnus Karlsson if (umem->cq) { 164fe230832SMagnus Karlsson xskq_destroy(umem->cq); 165fe230832SMagnus Karlsson umem->cq = NULL; 166fe230832SMagnus Karlsson } 167fe230832SMagnus Karlsson 168*f5bd9138SJakub Kicinski xsk_reuseq_destroy(umem); 169*f5bd9138SJakub Kicinski 170c0c77d8fSBjörn Töpel xdp_umem_unpin_pages(umem); 171c0c77d8fSBjörn Töpel 172c0c77d8fSBjörn Töpel task = get_pid_task(umem->pid, PIDTYPE_PID); 173c0c77d8fSBjörn Töpel put_pid(umem->pid); 174c0c77d8fSBjörn Töpel if (!task) 175c0c77d8fSBjörn Töpel goto out; 176c0c77d8fSBjörn Töpel mm = get_task_mm(task); 177c0c77d8fSBjörn Töpel put_task_struct(task); 178c0c77d8fSBjörn Töpel if (!mm) 179c0c77d8fSBjörn Töpel goto out; 180c0c77d8fSBjörn Töpel 181c0c77d8fSBjörn Töpel mmput(mm); 1828aef7340SBjörn Töpel kfree(umem->pages); 1838aef7340SBjörn Töpel umem->pages = NULL; 1848aef7340SBjörn Töpel 185c0c77d8fSBjörn Töpel xdp_umem_unaccount_pages(umem); 186c0c77d8fSBjörn Töpel out: 187c0c77d8fSBjörn Töpel kfree(umem); 188c0c77d8fSBjörn Töpel } 189c0c77d8fSBjörn Töpel 190c0c77d8fSBjörn Töpel static void xdp_umem_release_deferred(struct work_struct *work) 191c0c77d8fSBjörn Töpel { 192c0c77d8fSBjörn Töpel struct xdp_umem *umem = container_of(work, struct xdp_umem, work); 193c0c77d8fSBjörn Töpel 194c0c77d8fSBjörn Töpel xdp_umem_release(umem); 195c0c77d8fSBjörn Töpel } 196c0c77d8fSBjörn Töpel 197c0c77d8fSBjörn Töpel void xdp_get_umem(struct xdp_umem *umem) 198c0c77d8fSBjörn Töpel { 199d3b42f14SBjörn Töpel refcount_inc(&umem->users); 200c0c77d8fSBjörn Töpel } 201c0c77d8fSBjörn Töpel 202c0c77d8fSBjörn Töpel void xdp_put_umem(struct xdp_umem *umem) 203c0c77d8fSBjörn Töpel { 204c0c77d8fSBjörn Töpel if (!umem) 205c0c77d8fSBjörn Töpel return; 206c0c77d8fSBjörn Töpel 207d3b42f14SBjörn Töpel if (refcount_dec_and_test(&umem->users)) { 208c0c77d8fSBjörn Töpel INIT_WORK(&umem->work, xdp_umem_release_deferred); 209c0c77d8fSBjörn Töpel schedule_work(&umem->work); 210c0c77d8fSBjörn Töpel } 211c0c77d8fSBjörn Töpel } 212c0c77d8fSBjörn Töpel 213c0c77d8fSBjörn Töpel static int xdp_umem_pin_pages(struct xdp_umem *umem) 214c0c77d8fSBjörn Töpel { 215c0c77d8fSBjörn Töpel unsigned int gup_flags = FOLL_WRITE; 216c0c77d8fSBjörn Töpel long npgs; 217c0c77d8fSBjörn Töpel int err; 218c0c77d8fSBjörn Töpel 219a343993cSBjörn Töpel umem->pgs = kcalloc(umem->npgs, sizeof(*umem->pgs), 220a343993cSBjörn Töpel GFP_KERNEL | __GFP_NOWARN); 221c0c77d8fSBjörn Töpel if (!umem->pgs) 222c0c77d8fSBjörn Töpel return -ENOMEM; 223c0c77d8fSBjörn Töpel 224c0c77d8fSBjörn Töpel down_write(¤t->mm->mmap_sem); 225c0c77d8fSBjörn Töpel npgs = get_user_pages(umem->address, umem->npgs, 226c0c77d8fSBjörn Töpel gup_flags, &umem->pgs[0], NULL); 227c0c77d8fSBjörn Töpel up_write(¤t->mm->mmap_sem); 228c0c77d8fSBjörn Töpel 229c0c77d8fSBjörn Töpel if (npgs != umem->npgs) { 230c0c77d8fSBjörn Töpel if (npgs >= 0) { 231c0c77d8fSBjörn Töpel umem->npgs = npgs; 232c0c77d8fSBjörn Töpel err = -ENOMEM; 233c0c77d8fSBjörn Töpel goto out_pin; 234c0c77d8fSBjörn Töpel } 235c0c77d8fSBjörn Töpel err = npgs; 236c0c77d8fSBjörn Töpel goto out_pgs; 237c0c77d8fSBjörn Töpel } 238c0c77d8fSBjörn Töpel return 0; 239c0c77d8fSBjörn Töpel 240c0c77d8fSBjörn Töpel out_pin: 241c0c77d8fSBjörn Töpel xdp_umem_unpin_pages(umem); 242c0c77d8fSBjörn Töpel out_pgs: 243c0c77d8fSBjörn Töpel kfree(umem->pgs); 244c0c77d8fSBjörn Töpel umem->pgs = NULL; 245c0c77d8fSBjörn Töpel return err; 246c0c77d8fSBjörn Töpel } 247c0c77d8fSBjörn Töpel 248c0c77d8fSBjörn Töpel static int xdp_umem_account_pages(struct xdp_umem *umem) 249c0c77d8fSBjörn Töpel { 250c0c77d8fSBjörn Töpel unsigned long lock_limit, new_npgs, old_npgs; 251c0c77d8fSBjörn Töpel 252c0c77d8fSBjörn Töpel if (capable(CAP_IPC_LOCK)) 253c0c77d8fSBjörn Töpel return 0; 254c0c77d8fSBjörn Töpel 255c0c77d8fSBjörn Töpel lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT; 256c0c77d8fSBjörn Töpel umem->user = get_uid(current_user()); 257c0c77d8fSBjörn Töpel 258c0c77d8fSBjörn Töpel do { 259c0c77d8fSBjörn Töpel old_npgs = atomic_long_read(&umem->user->locked_vm); 260c0c77d8fSBjörn Töpel new_npgs = old_npgs + umem->npgs; 261c0c77d8fSBjörn Töpel if (new_npgs > lock_limit) { 262c0c77d8fSBjörn Töpel free_uid(umem->user); 263c0c77d8fSBjörn Töpel umem->user = NULL; 264c0c77d8fSBjörn Töpel return -ENOBUFS; 265c0c77d8fSBjörn Töpel } 266c0c77d8fSBjörn Töpel } while (atomic_long_cmpxchg(&umem->user->locked_vm, old_npgs, 267c0c77d8fSBjörn Töpel new_npgs) != old_npgs); 268c0c77d8fSBjörn Töpel return 0; 269c0c77d8fSBjörn Töpel } 270c0c77d8fSBjörn Töpel 271a49049eaSBjörn Töpel static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) 272c0c77d8fSBjörn Töpel { 273bbff2f32SBjörn Töpel u32 chunk_size = mr->chunk_size, headroom = mr->headroom; 274bbff2f32SBjörn Töpel unsigned int chunks, chunks_per_page; 275c0c77d8fSBjörn Töpel u64 addr = mr->addr, size = mr->len; 2768aef7340SBjörn Töpel int size_chk, err, i; 277c0c77d8fSBjörn Töpel 278bbff2f32SBjörn Töpel if (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) { 279c0c77d8fSBjörn Töpel /* Strictly speaking we could support this, if: 280c0c77d8fSBjörn Töpel * - huge pages, or* 281c0c77d8fSBjörn Töpel * - using an IOMMU, or 282c0c77d8fSBjörn Töpel * - making sure the memory area is consecutive 283c0c77d8fSBjörn Töpel * but for now, we simply say "computer says no". 284c0c77d8fSBjörn Töpel */ 285c0c77d8fSBjörn Töpel return -EINVAL; 286c0c77d8fSBjörn Töpel } 287c0c77d8fSBjörn Töpel 288bbff2f32SBjörn Töpel if (!is_power_of_2(chunk_size)) 289c0c77d8fSBjörn Töpel return -EINVAL; 290c0c77d8fSBjörn Töpel 291c0c77d8fSBjörn Töpel if (!PAGE_ALIGNED(addr)) { 292c0c77d8fSBjörn Töpel /* Memory area has to be page size aligned. For 293c0c77d8fSBjörn Töpel * simplicity, this might change. 294c0c77d8fSBjörn Töpel */ 295c0c77d8fSBjörn Töpel return -EINVAL; 296c0c77d8fSBjörn Töpel } 297c0c77d8fSBjörn Töpel 298c0c77d8fSBjörn Töpel if ((addr + size) < addr) 299c0c77d8fSBjörn Töpel return -EINVAL; 300c0c77d8fSBjörn Töpel 301bbff2f32SBjörn Töpel chunks = (unsigned int)div_u64(size, chunk_size); 302bbff2f32SBjörn Töpel if (chunks == 0) 303c0c77d8fSBjörn Töpel return -EINVAL; 304c0c77d8fSBjörn Töpel 305bbff2f32SBjörn Töpel chunks_per_page = PAGE_SIZE / chunk_size; 306bbff2f32SBjörn Töpel if (chunks < chunks_per_page || chunks % chunks_per_page) 307c0c77d8fSBjörn Töpel return -EINVAL; 308c0c77d8fSBjörn Töpel 309bbff2f32SBjörn Töpel headroom = ALIGN(headroom, 64); 310c0c77d8fSBjörn Töpel 311bbff2f32SBjörn Töpel size_chk = chunk_size - headroom - XDP_PACKET_HEADROOM; 312c0c77d8fSBjörn Töpel if (size_chk < 0) 313c0c77d8fSBjörn Töpel return -EINVAL; 314c0c77d8fSBjörn Töpel 315c0c77d8fSBjörn Töpel umem->pid = get_task_pid(current, PIDTYPE_PID); 316c0c77d8fSBjörn Töpel umem->address = (unsigned long)addr; 31793ee30f3SMagnus Karlsson umem->chunk_mask = ~((u64)chunk_size - 1); 31893ee30f3SMagnus Karlsson umem->size = size; 319bbff2f32SBjörn Töpel umem->headroom = headroom; 320bbff2f32SBjörn Töpel umem->chunk_size_nohr = chunk_size - headroom; 321c0c77d8fSBjörn Töpel umem->npgs = size / PAGE_SIZE; 322c0c77d8fSBjörn Töpel umem->pgs = NULL; 323c0c77d8fSBjörn Töpel umem->user = NULL; 324ac98d8aaSMagnus Karlsson INIT_LIST_HEAD(&umem->xsk_list); 325ac98d8aaSMagnus Karlsson spin_lock_init(&umem->xsk_list_lock); 326c0c77d8fSBjörn Töpel 327d3b42f14SBjörn Töpel refcount_set(&umem->users, 1); 328c0c77d8fSBjörn Töpel 329c0c77d8fSBjörn Töpel err = xdp_umem_account_pages(umem); 330c0c77d8fSBjörn Töpel if (err) 331c0c77d8fSBjörn Töpel goto out; 332c0c77d8fSBjörn Töpel 333c0c77d8fSBjörn Töpel err = xdp_umem_pin_pages(umem); 334c0c77d8fSBjörn Töpel if (err) 335c0c77d8fSBjörn Töpel goto out_account; 3368aef7340SBjörn Töpel 3378aef7340SBjörn Töpel umem->pages = kcalloc(umem->npgs, sizeof(*umem->pages), GFP_KERNEL); 3388aef7340SBjörn Töpel if (!umem->pages) { 3398aef7340SBjörn Töpel err = -ENOMEM; 3408aef7340SBjörn Töpel goto out_account; 3418aef7340SBjörn Töpel } 3428aef7340SBjörn Töpel 3438aef7340SBjörn Töpel for (i = 0; i < umem->npgs; i++) 3448aef7340SBjörn Töpel umem->pages[i].addr = page_address(umem->pgs[i]); 3458aef7340SBjörn Töpel 346c0c77d8fSBjörn Töpel return 0; 347c0c77d8fSBjörn Töpel 348c0c77d8fSBjörn Töpel out_account: 349c0c77d8fSBjörn Töpel xdp_umem_unaccount_pages(umem); 350c0c77d8fSBjörn Töpel out: 351c0c77d8fSBjörn Töpel put_pid(umem->pid); 352c0c77d8fSBjörn Töpel return err; 353c0c77d8fSBjörn Töpel } 354965a9909SMagnus Karlsson 355a49049eaSBjörn Töpel struct xdp_umem *xdp_umem_create(struct xdp_umem_reg *mr) 356a49049eaSBjörn Töpel { 357a49049eaSBjörn Töpel struct xdp_umem *umem; 358a49049eaSBjörn Töpel int err; 359a49049eaSBjörn Töpel 360a49049eaSBjörn Töpel umem = kzalloc(sizeof(*umem), GFP_KERNEL); 361a49049eaSBjörn Töpel if (!umem) 362a49049eaSBjörn Töpel return ERR_PTR(-ENOMEM); 363a49049eaSBjörn Töpel 364a49049eaSBjörn Töpel err = xdp_umem_reg(umem, mr); 365a49049eaSBjörn Töpel if (err) { 366a49049eaSBjörn Töpel kfree(umem); 367a49049eaSBjörn Töpel return ERR_PTR(err); 368a49049eaSBjörn Töpel } 369a49049eaSBjörn Töpel 370a49049eaSBjörn Töpel return umem; 371a49049eaSBjörn Töpel } 372a49049eaSBjörn Töpel 373965a9909SMagnus Karlsson bool xdp_umem_validate_queues(struct xdp_umem *umem) 374965a9909SMagnus Karlsson { 375da60cf00SBjörn Töpel return umem->fq && umem->cq; 376965a9909SMagnus Karlsson } 377