Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp3327726pxb; Tue, 12 Jan 2021 11:45:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxp+wl5S14vHiLSS1OuMn+oXDXsRpuhk7wOvy4cuFZLIrZ/yO32j2y1hWNtnKCi21i+//AF X-Received: by 2002:a17:907:a96:: with SMTP id by22mr278022ejc.171.1610480716364; Tue, 12 Jan 2021 11:45:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610480716; cv=none; d=google.com; s=arc-20160816; b=agMwmonFqb+Py/sXqgSBBcoPCGyMDTmtvmTWPqemCXWSVHmsIK+GnopCDA8c3OGK1w 8ZOblnZXRTgkKQDupsk2a0BRH2ZeB7r+F2BdI6NzmXlAr04THuRD9VI9jlKdd6qaN06o zIYe3/riJgo5XHOKQEvmxM1sDkZTZxhKxnyI7hdCxy6B4eC5Q8dTbkUk5YRoHBE2Jbtr X6UEohYvqCg5Q2yGdqTXtrjwxNqJbZfNsTDWWkxvU+Z3PjeYHpy4qzSmg2hysqPJaEDG 4MWNNhsMN+Mw4ATYHlBfWPoWW5986wTRMG5jJClRonp1Xpcyr2ePEdOmV2K9j2oBzqkd n4TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=9oioH7fTimHXbwiOIluI6SOkD883+857JncYScStEP4=; b=Oyz5OcCbMxybElDMypvD0vvmiORBm3PIQlkN6Fawzj9ldNYRqOfsF+ugxv8sBypt1W 5LJ0ct/dIEkgqE/r756dA8AxrkRiqBgnMx5OGXFyylnFW6r31cl595x+A+m0MNISxM7n xTdS0W7vaIQML5AKTBIUnurzW7lrMjk7P6HCRAzoflQBD6Z5/UAx9OTY/FR2cM3DoilM PCGLz0ssR04ZWsXFZZI87ESmgj6dKOhk6KDo+OwNxSQ7C4v944npiGumb2EQ2PfX3NUx VkPhUZiUeonEOIy+gGW+vtNAxv37Rxw5irnnw890SgLEDRek4higT7Bo/X2GhoB4l9V9 sauA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@daynix-com.20150623.gappssmtp.com header.s=20150623 header.b=JmO6IQKg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f9si1707330edw.224.2021.01.12.11.44.52; Tue, 12 Jan 2021 11:45:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@daynix-com.20150623.gappssmtp.com header.s=20150623 header.b=JmO6IQKg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406650AbhALTmh (ORCPT + 99 others); Tue, 12 Jan 2021 14:42:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406619AbhALTmg (ORCPT ); Tue, 12 Jan 2021 14:42:36 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 494D6C061795 for ; Tue, 12 Jan 2021 11:41:56 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id g10so1495192wmh.2 for ; Tue, 12 Jan 2021 11:41:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=9oioH7fTimHXbwiOIluI6SOkD883+857JncYScStEP4=; b=JmO6IQKgjQY+7ho4ih3Bdmj0eRPnup/UlujCGZhO4AJhanp3QH0J71/SQjiI8RlftE LxVkn1U86G3tkyTL1V1ekzv7AG4aQUuBC1r0RvRBoERwudQRkTXIem4aavnr56WrANo8 gOtBpR9pRxwKu1xDJhfk/82GSYbgzv2ibgNt5w0f4THTbGm6h2zSgqNsqz15NEjpA55j jhso19OBmu3jzIh6d8tb1TXJSzru4eS/fD3T3nWv1umUB8RNCOvvnnPdOKeCNLkCN3mh BIGrXTEThybGX1OaJSNIbNpsSW/dNQUVwxByoyviBmYkIkBVcUXJ03lrcjitMvDn4T// igkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9oioH7fTimHXbwiOIluI6SOkD883+857JncYScStEP4=; b=fO/GalhQIsaAz3SCKcB6yVISjYn2wdcQTfnVJjissdIBZRL8vAys0Rov0qjt556C2R ykyE4FbhHY/RZHYpgEDkdWKbKwiRhmYnABFK40M2g2kFCMv1zwH7BLudyy6F/L3INV9i Pj2KNIRr8rZw6d3da3k21SSTwJFAAV7wV/xlFo+Z0Dvx6b+yeP1x9rELuuVz4JjQ3cpd HdS77xK1zFNjNwsvcFInHkuyH3LRWIdIpTe5Gy4m0W9pkcTfvIcJPLwIseLSeK/U6gN9 a5D/cQkcbHfSWEyY64rT7tVEW3qHxRrfQ5o/1OfzdSsrCOpWg03Ao3A3AJFwxu/IpfGe XFrA== X-Gm-Message-State: AOAM532YUlAaZaN4KHHA598Ud8Qx2uLQ5A1TG8pGHbqZd+UKdxNalXbR dksqR4djja6AVAHicKwQutmk6Q== X-Received: by 2002:a1c:b742:: with SMTP id h63mr780567wmf.122.1610480514861; Tue, 12 Jan 2021 11:41:54 -0800 (PST) Received: from f2.redhat.com (bzq-79-183-72-147.red.bezeqint.net. [79.183.72.147]) by smtp.gmail.com with ESMTPSA id z63sm4885315wme.8.2021.01.12.11.41.51 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jan 2021 11:41:54 -0800 (PST) From: Yuri Benditovich To: davem@davemloft.net, kuba@kernel.org, mst@redhat.com, jasowang@redhat.com, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, rdunlap@infradead.org, willemb@google.com, gustavoars@kernel.org, herbert@gondor.apana.org.au, steffen.klassert@secunet.com, nogikh@google.com, pablo@netfilter.org, decui@microsoft.com, cai@lca.pw, jakub@cloudflare.com, elver@google.com, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, bpf@vger.kernel.org Cc: yan@daynix.com Subject: [RFC PATCH 0/7] Support for virtio-net hash reporting Date: Tue, 12 Jan 2021 21:41:36 +0200 Message-Id: <20210112194143.1494-1-yuri.benditovich@daynix.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Existing TUN module is able to use provided "steering eBPF" to calculate per-packet hash and derive the destination queue to place the packet to. The eBPF uses mapped configuration data containing a key for hash calculation and indirection table with array of queues' indices. This series of patches adds support for virtio-net hash reporting feature as defined in virtio specification. It extends the TUN module and the "steering eBPF" as follows: Extended steering eBPF calculates the hash value and hash type, keeps hash value in the skb->hash and returns index of destination virtqueue and the type of the hash. TUN module keeps returned hash type in (currently unused) field of the skb. skb->__unused renamed to 'hash_report_type'. When TUN module is called later to allocate and fill the virtio-net header and push it to destination virtqueue it populates the hash and the hash type into virtio-net header. VHOST driver is made aware of respective virtio-net feature that extends the virtio-net header to report the hash value and hash report type. Yuri Benditovich (7): skbuff: define field for hash report type vhost: support for hash report virtio-net feature tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type tun: free bpf_program by bpf_prog_put instead of bpf_prog_destroy tun: add ioctl code TUNSETHASHPOPULATION tun: populate hash in virtio-net header when needed tun: report new tun feature IFF_HASH drivers/net/tun.c | 43 +++++++++++++++++++++++++++++++------ drivers/vhost/net.c | 37 ++++++++++++++++++++++++------- include/linux/skbuff.h | 7 +++++- include/uapi/linux/if_tun.h | 2 ++ 4 files changed, 74 insertions(+), 15 deletions(-) -- 2.17.1