From nobody Sun Dec 22 08:58:00 2024 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F41F813A88A for ; Sat, 21 Dec 2024 00:51:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734742302; cv=none; b=mf3MM2BBiIFmSf8eGcqAl+DdNq6UhSr+43opEyTNAJ20hoeWvcMTlGQeFpOgJiCSeepwmphe2pcjfWXL93v8nnfVdDoc0aPm5daXBT0gy/ofRFPxj1Nv0rL+B51IiFqowxG4448zvx96a6HvTTJVJFLdpodQ9hv7PFxJ2esaaNQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734742302; c=relaxed/simple; bh=QHTemyqKq7eQ6aluLDUFi/rI+VpPUt8hVCo9T/ySwTk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=El84SLCVyqE5TAWKdX/jzcEC3r1yX80rAeVgJ4B2ByQYegJNNgDuAei5zjK7bPEhvzAomRq5PVFyx490/vU1mKoBcG2PDNGUcAONGsZ6fSq7CY3GtkWP0PtikteeC/R+73jz57+FNn1s4xvAGbCspdVqO2ylX2f6QWpVwXxdNuM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--almasrymina.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=EMmmx2vv; arc=none smtp.client-ip=209.85.216.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--almasrymina.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="EMmmx2vv" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-2efa74481fdso2207775a91.1 for ; Fri, 20 Dec 2024 16:51:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1734742300; x=1735347100; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=lJ6NozhFSUXmkJr/9AfmzkA62BmshCZz/WJgAAj7Dl0=; b=EMmmx2vvjYQvDwSF0cF57JoZ34xf0ZL5Hew7JTRb8YSyMb076VTSWNiEClF45stpZR S1naaK5n7CaOmTF/h9rw9trRHV2kRb+sIK6ae7PL5ibQpXOpUijNB+IilmP9nLz5tvZw QcUpqptZ/Bl5osdIZCff1txm7DDc3hVzZr7Wzq6lGqhCebxrA2BCnqMAxPKVZxw+RpTC 7nNVnpXhF/yMx6pWVE/tvZCGsBdkkCTsGdItXs4hWky+jmgKKNa7emHugbTPt4XDYC0P XmdciYwgeoM5NonzTeVZxiTNqC+ueg7vYwgR1RZDzLzcm9tmkX2eDd4LINq2YJw+NYeA Nmtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734742300; x=1735347100; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lJ6NozhFSUXmkJr/9AfmzkA62BmshCZz/WJgAAj7Dl0=; b=vNLB4KcTFNsILUHBrFX3L6AuR+TvB/cdv1YOJAzJkxIwnwl1N4dXU9yjUOsCMSoOF8 +zC6msl2IsvjTZq0tL1J0X/dEudDz8laUJWyRImOQk26pAyFbDPDYZoaykO89cBjTYH4 Lb19W9l7cW7FYN5+CVX/MXrFeUZMP/9/Bbj9w/+05yIhh0ZtOuM7OKJwpaXPc4IKWBcV mRTVWCR4xcc8nTzmZIPP6nZPW9bHQxLTcMcw2rHhSPmMH5YQYTNoTblHyvB7T0aXm67O ntt9tg7+BOJtkjiPOUacH/3nl3ObqghfljbNCP3kgUnvqulmpIdxUjQYfPsYVX0JnsdQ Agpw== X-Forwarded-Encrypted: i=1; AJvYcCX/wW436n6QWj5376GBJh/p0p+RacyaUHhTes4TZ/sgKGpeVdel2uRqkMxSrjTghhO+QYPVS6pGOG/proI=@vger.kernel.org X-Gm-Message-State: AOJu0YzSY51tKqNj/fQ9LYytETGtSHhSjydZrp9J2J6h7sjZm719ddH/ CHoyG94I0iN9GF5Xhmq14baYprHwlnTchzx83FTOChphhV9ZQOq/FdLLAgfYtdBDuJ3TR05JFPO WkqljYu85Pa2NTZ/98tVEHw== X-Google-Smtp-Source: AGHT+IECenOfrqMdD4y/BkZI8Rt/o8P2W8JHtAIr7xge1JhM22ZDFK4i9b8sLtz0qSwXRtkNrZAnVUepMo8t46ZczQ== X-Received: from pjbsm15.prod.google.com ([2002:a17:90b:2e4f:b0:2ea:9d23:79a0]) (user=almasrymina job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:54cb:b0:2ee:96a5:721e with SMTP id 98e67ed59e1d1-2f452e1cacamr9375996a91.12.1734742300328; Fri, 20 Dec 2024 16:51:40 -0800 (PST) Date: Sat, 21 Dec 2024 00:42:35 +0000 In-Reply-To: <20241221004236.2629280-1-almasrymina@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241221004236.2629280-1-almasrymina@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Message-ID: <20241221004236.2629280-5-almasrymina@google.com> Subject: [PATCH RFC net-next v1 4/5] net: devmem TCP tx netlink api From: Mina Almasry To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, virtualization@lists.linux.dev, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: Mina Almasry , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Donald Hunter , Jonathan Corbet , Andrew Lunn , David Ahern , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , "=?UTF-8?q?Eugenio=20P=C3=A9rez?=" , Stefan Hajnoczi , Stefano Garzarella , Shuah Khan , Kaiyuan Zhang , Pavel Begunkov , Willem de Bruijn , Samiullah Khawaja , Stanislav Fomichev , Joe Damato , dw@davidwei.uk Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Stanislav Fomichev Add bind-tx netlink call to attach dmabuf for TX; queue is not required, only ifindex and dmabuf fd for attachment. Signed-off-by: Stanislav Fomichev Signed-off-by: Mina Almasry --- Documentation/netlink/specs/netdev.yaml | 12 ++++++++++++ include/uapi/linux/netdev.h | 1 + net/core/netdev-genl-gen.c | 13 +++++++++++++ net/core/netdev-genl-gen.h | 1 + net/core/netdev-genl.c | 6 ++++++ tools/include/uapi/linux/netdev.h | 1 + 6 files changed, 34 insertions(+) diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlin= k/specs/netdev.yaml index cbb544bd6c84..93f4333e7bc6 100644 --- a/Documentation/netlink/specs/netdev.yaml +++ b/Documentation/netlink/specs/netdev.yaml @@ -711,6 +711,18 @@ operations: - defer-hard-irqs - gro-flush-timeout - irq-suspend-timeout + - + name: bind-tx + doc: Bind dmabuf to netdev for TX + attribute-set: dmabuf + do: + request: + attributes: + - ifindex + - fd + reply: + attributes: + - id =20 kernel-family: headers: [ "linux/list.h"] diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h index e4be227d3ad6..04364ef5edbe 100644 --- a/include/uapi/linux/netdev.h +++ b/include/uapi/linux/netdev.h @@ -203,6 +203,7 @@ enum { NETDEV_CMD_QSTATS_GET, NETDEV_CMD_BIND_RX, NETDEV_CMD_NAPI_SET, + NETDEV_CMD_BIND_TX, =20 __NETDEV_CMD_MAX, NETDEV_CMD_MAX =3D (__NETDEV_CMD_MAX - 1) diff --git a/net/core/netdev-genl-gen.c b/net/core/netdev-genl-gen.c index a89cbd8d87c3..581b6b9935a5 100644 --- a/net/core/netdev-genl-gen.c +++ b/net/core/netdev-genl-gen.c @@ -99,6 +99,12 @@ static const struct nla_policy netdev_napi_set_nl_policy= [NETDEV_A_NAPI_IRQ_SUSPE [NETDEV_A_NAPI_IRQ_SUSPEND_TIMEOUT] =3D { .type =3D NLA_UINT, }, }; =20 +/* NETDEV_CMD_BIND_TX - do */ +static const struct nla_policy netdev_bind_tx_nl_policy[NETDEV_A_DMABUF_FD= + 1] =3D { + [NETDEV_A_DMABUF_IFINDEX] =3D NLA_POLICY_MIN(NLA_U32, 1), + [NETDEV_A_DMABUF_FD] =3D { .type =3D NLA_U32, }, +}; + /* Ops table for netdev */ static const struct genl_split_ops netdev_nl_ops[] =3D { { @@ -190,6 +196,13 @@ static const struct genl_split_ops netdev_nl_ops[] =3D= { .maxattr =3D NETDEV_A_NAPI_IRQ_SUSPEND_TIMEOUT, .flags =3D GENL_ADMIN_PERM | GENL_CMD_CAP_DO, }, + { + .cmd =3D NETDEV_CMD_BIND_TX, + .doit =3D netdev_nl_bind_tx_doit, + .policy =3D netdev_bind_tx_nl_policy, + .maxattr =3D NETDEV_A_DMABUF_FD, + .flags =3D GENL_CMD_CAP_DO, + }, }; =20 static const struct genl_multicast_group netdev_nl_mcgrps[] =3D { diff --git a/net/core/netdev-genl-gen.h b/net/core/netdev-genl-gen.h index e09dd7539ff2..c1fed66e92b9 100644 --- a/net/core/netdev-genl-gen.h +++ b/net/core/netdev-genl-gen.h @@ -34,6 +34,7 @@ int netdev_nl_qstats_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb); int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info); int netdev_nl_napi_set_doit(struct sk_buff *skb, struct genl_info *info); +int netdev_nl_bind_tx_doit(struct sk_buff *skb, struct genl_info *info); =20 enum { NETDEV_NLGRP_MGMT, diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index 2d3ae0cd3ad2..00d3d5851487 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -907,6 +907,12 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct= genl_info *info) return err; } =20 +/* stub */ +int netdev_nl_bind_tx_doit(struct sk_buff *skb, struct genl_info *info) +{ + return 0; +} + void netdev_nl_sock_priv_init(struct list_head *priv) { INIT_LIST_HEAD(priv); diff --git a/tools/include/uapi/linux/netdev.h b/tools/include/uapi/linux/n= etdev.h index e4be227d3ad6..04364ef5edbe 100644 --- a/tools/include/uapi/linux/netdev.h +++ b/tools/include/uapi/linux/netdev.h @@ -203,6 +203,7 @@ enum { NETDEV_CMD_QSTATS_GET, NETDEV_CMD_BIND_RX, NETDEV_CMD_NAPI_SET, + NETDEV_CMD_BIND_TX, =20 __NETDEV_CMD_MAX, NETDEV_CMD_MAX =3D (__NETDEV_CMD_MAX - 1) --=20 2.47.1.613.gc27f4b7a9f-goog