From patchwork Mon Feb 26 13:14:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Iurman X-Patchwork-Id: 206621 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2066222dyb; Mon, 26 Feb 2024 05:15:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVkPXPsf+S5Ahwu+RnygLMmYAf9Wb/pt2y/Q16ERj5LXq8U45HhFdjx8DqEilcXqHlkokFUXa94cLQ7HH2Ee3BIwobOjw== X-Google-Smtp-Source: AGHT+IFK2oJc53OtjXElIMTfuE9bZSb9KI+ZkDulSLnnmDwZWbJCszXPOJ3IC4lZJLuXPJIpkrDT X-Received: by 2002:a17:906:c9d3:b0:a3e:69ff:141f with SMTP id hk19-20020a170906c9d300b00a3e69ff141fmr5622863ejb.33.1708953323382; Mon, 26 Feb 2024 05:15:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708953323; cv=pass; d=google.com; s=arc-20160816; b=geciJ2Jan2IaXB2/YStSx+Fg2mL0sIgnuHP10Y9P2KUkDc8xuPvLdOJ5eC898N+a7O UxDxnRSdsNwh9OHPbAho+obGc4UKeDicYnGt7rj2qhLJ3zZKBzcEmKhxoQjY0qygk/R7 6hKg3lAewOZLhQBp17GCPL0NdSktySew4zmidIKirG8HLqqxB84XoWO0lmtY31PcCDM1 n4cQzRpb8sBsZ9alBbRv/KMFEbsm5VHMbpl9yBSJx8VWfNjoREbG00RkEvb8xCvSd3xB mnaLh2KzxPsU0/FFmTEpG+nXKM7/3UGEq/+3ePpPEvOmLppXmzUAaQZQ1VG2R6TJ0rEp sgQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=YND8YDjnCKUnnw5aps81Jl33wEbPNlCkIx5CZfyc34w=; fh=1UEXF8WEdTRZGz3zsBPr9blJ8rxkIELeUsA6ymhnv1o=; b=YUPOPKpDjDXOUchxQ010749q3Q3zfh3BZcYSAAAEROH8a3EqpBf2ugWTxAJ/ucyAFE mSyDuCSZiCg52wyEaq+5hfXCTXijr4I1Sj8sren0/GIN49Z2UD/rmdrpxDjEUafHRYjW zQJ0CAMAEZ0VyLAp4br/wX2AN2eyCJI7PuUyr7bH9KhKlmcJSOCTuQWa0QvtMdHnKhHR kh0BBpMjK4zLxaXBokLXXcN/1a/BmqaCH/KOcIIJBQLkeVmS40fQ5gYLbRJtbaJ2sg5g K4f/1iZXnA0qGkUo2qS0nRrvtrOibhKs2oRsM8sW78qKv4iIqrdPrDf2hCo8PtNJ9zAZ X9vw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@uliege.be header.s=ulg20190529 header.b=MzVOEbQx; arc=pass (i=1 spf=pass spfdomain=uliege.be dkim=pass dkdomain=uliege.be dmarc=pass fromdomain=uliege.be); spf=pass (google.com: domain of linux-kernel+bounces-81458-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81458-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=uliege.be Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id dv17-20020a170906b81100b00a4131b85b5esi2121777ejb.73.2024.02.26.05.15.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 05:15:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81458-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@uliege.be header.s=ulg20190529 header.b=MzVOEbQx; arc=pass (i=1 spf=pass spfdomain=uliege.be dkim=pass dkdomain=uliege.be dmarc=pass fromdomain=uliege.be); spf=pass (google.com: domain of linux-kernel+bounces-81458-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81458-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=uliege.be Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 04DEF1F27B63 for ; Mon, 26 Feb 2024 13:15:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9C231292E6; Mon, 26 Feb 2024 13:14:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b="MzVOEbQx" Received: from serv108.segi.ulg.ac.be (serv108.segi.ulg.ac.be [139.165.32.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E78E8529F; Mon, 26 Feb 2024 13:14:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=139.165.32.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708953277; cv=none; b=mVzcyULBoo6VaSlLttA/i2fajdjypoNDEOAQh3RPNADYnD1W0c0FYA2QU03ltyJupbT2/dnltbiT+I2OaDnsN+dC31/g08lppcjyjUqoRHiM7CiymyqLqRDOkC43/8JY2U7FbX8oC/aHr0eO5nOQB1gNgvfuT7SzhehpMMXU8Jw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708953277; c=relaxed/simple; bh=y1rHoM1PmsWaO0MLcbhFFvY5L+UAqwxsnigGbmSxneQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eaWudIkWCeabpf+zp/2XApRPyMRQxv2p09y8dn0f+EtgB0UFVFy/5GCcNOKSXtCAarDVGtkjzzBgXQwmf2zAxN4f0Aiz+ltqu5gU2Z3YFXtwVW+YasCixTxSCTvt7ZUqEHKeVs29QSs08sBfyk7G1KWTRmnEMcH677xFbgxnVG8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be; spf=pass smtp.mailfrom=uliege.be; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b=MzVOEbQx; arc=none smtp.client-ip=139.165.32.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uliege.be Received: from localhost.localdomain (125.179-65-87.adsl-dyn.isp.belgacom.be [87.65.179.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 6B899200F809; Mon, 26 Feb 2024 14:14:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 6B899200F809 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be; s=ulg20190529; t=1708953273; bh=YND8YDjnCKUnnw5aps81Jl33wEbPNlCkIx5CZfyc34w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MzVOEbQxv4GAtYgk3T1NDIpY0BGvSoionFEZ+xB6j2cWF58/eB8jccXawu4EmuvfS JCRZoer1UUej5tbHGRxtdbx/+zGNvsnW6oBXXkV3alfEEvGENXK0frKn+2NjL89JkM BO/FvMO8arE+hT7hYYk36wdnybQbGLtEM21Lg2OFm4mj12SN5iPRBETPK9MiCCRHqt WZ6gXEf0noI0+6fWeD7MJjvmkyFB3h8aPWSUfPmyMacL44hi4YdeI8gV1RPmto8uhj PW7pWL6mg2Zuxhy9apxPZ4yTZAliIX+uFCNzblJNT55AmLwz9B3wj2aCvKoZH6uVpQ uHfjri6u4IGiQ== From: Justin Iurman To: netdev@vger.kernel.org Cc: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, justin.iurman@uliege.be Subject: [PATCH net-next v5 1/3] uapi: ioam6: API for netlink multicast events Date: Mon, 26 Feb 2024 14:14:10 +0100 Message-Id: <20240226131412.10214-2-justin.iurman@uliege.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226131412.10214-1-justin.iurman@uliege.be> References: <20240226131412.10214-1-justin.iurman@uliege.be> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791967439790269369 X-GMAIL-MSGID: 1791967439790269369 Add new api to support ioam6 events for generic netlink multicast. A first "trace" event is added to the list of ioam6 events, which will represent an IOAM Pre-allocated Trace Option-Type. It provides another solution to share IOAM data with user space. Reviewed-by: David Ahern Signed-off-by: Justin Iurman --- include/uapi/linux/ioam6_genl.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/uapi/linux/ioam6_genl.h b/include/uapi/linux/ioam6_genl.h index ca4b22833754..1733fbc51fb5 100644 --- a/include/uapi/linux/ioam6_genl.h +++ b/include/uapi/linux/ioam6_genl.h @@ -49,4 +49,24 @@ enum { #define IOAM6_CMD_MAX (__IOAM6_CMD_MAX - 1) +#define IOAM6_GENL_EV_GRP_NAME "ioam6_events" + +enum ioam6_event_type { + IOAM6_EVENT_UNSPEC, + IOAM6_EVENT_TRACE, +}; + +enum ioam6_event_attr { + IOAM6_EVENT_ATTR_UNSPEC, + + IOAM6_EVENT_ATTR_TRACE_NAMESPACE, /* u16 */ + IOAM6_EVENT_ATTR_TRACE_NODELEN, /* u8 */ + IOAM6_EVENT_ATTR_TRACE_TYPE, /* u32 */ + IOAM6_EVENT_ATTR_TRACE_DATA, /* Binary */ + + __IOAM6_EVENT_ATTR_MAX +}; + +#define IOAM6_EVENT_ATTR_MAX (__IOAM6_EVENT_ATTR_MAX - 1) + #endif /* _UAPI_LINUX_IOAM6_GENL_H */ From patchwork Mon Feb 26 13:14:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Iurman X-Patchwork-Id: 206623 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2066336dyb; Mon, 26 Feb 2024 05:15:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUdGCJNAoijqXp+KW6HmE6djL/rLjQxPKL43DslQ4XxEEr4s+7a84dUJOr04PE6wOza0O4jwvH7HdPoWL6nDOK88yPeOg== X-Google-Smtp-Source: AGHT+IERhJzi83hEJq19romnlL43qaLKQNbCP5s/fy5BzTMEahx1mgJHC7QqOnMMX/Wx3zcT1c4+ X-Received: by 2002:a17:906:c357:b0:a43:8330:6919 with SMTP id ci23-20020a170906c35700b00a4383306919mr624602ejb.15.1708953332841; Mon, 26 Feb 2024 05:15:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708953332; cv=pass; d=google.com; s=arc-20160816; b=HgivFJ5634NGW2XE/JN3P6RDwO9yAPFIykP+gR9KqB6R/v7hW48qVeGDl54T26j1qv ffTvRc+J/PEtk2glIc1vp95OUjYiCc5LCZqDYFK5jV168nD8Cp0L5RC63kEo0jK3t1kc V7BEIAUutvv0FAHo4c9KBIPCMr+Hvc7tF4nAGfixFV+q2xaAgcxTVGK7HQSAlqg6YoI1 Dt+5jV4e1ETI1aH1bKhIVt/AqZlFxAzQSB/0jsr1mtfaRaQSM/3zYOM2VAbfEivUuTMp z1wmAA0y05owZ966dtLAfCDhal+6ZYHTgDm1gaaFwmyhFHaS/2MmSyyncZNP0aU214t5 5lfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=3/eIRR/YRQWKLO4e4AFIeer07wTr9HjoWBKq7QicGlw=; fh=1UEXF8WEdTRZGz3zsBPr9blJ8rxkIELeUsA6ymhnv1o=; b=dUU/II3mKjGgk6KxlUJ8sKackLW9W/mPzaAIhjeJOUW+a4KhHA3NHEKN2JMadWu/Vf 2ENfjqDh3QNHP3a2T6wAqeS4qK55ughHvUNzL573LS70oiM5xOykJW94zNIVqypSR4C/ 8ni2eqAO75/iXjjJhpB7+591NNEyaEwRUGlZfdulCQnK67cRdcbUY5IGpIfK/ze055ig zSyQu/v3rKNniGq1hPaDTpukoH5ardgFyL50tDf/U7rcfG+XiKWA+f2oPJLBLUU75k7/ 4vHx1QyJY5sCXuLF+O1BKSdzuhoyhHdOCNw64rEongn5GJ1vjvwwgx6qH69vAzNRJ2pF SE4A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@uliege.be header.s=ulg20190529 header.b=ePhGF8GQ; arc=pass (i=1 spf=pass spfdomain=uliege.be dkim=pass dkdomain=uliege.be dmarc=pass fromdomain=uliege.be); spf=pass (google.com: domain of linux-kernel+bounces-81459-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81459-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=uliege.be Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ck22-20020a170906c45600b00a4335ba4b32si1157833ejb.51.2024.02.26.05.15.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 05:15:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81459-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@uliege.be header.s=ulg20190529 header.b=ePhGF8GQ; arc=pass (i=1 spf=pass spfdomain=uliege.be dkim=pass dkdomain=uliege.be dmarc=pass fromdomain=uliege.be); spf=pass (google.com: domain of linux-kernel+bounces-81459-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81459-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=uliege.be Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 766681F27E9F for ; Mon, 26 Feb 2024 13:15:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F77D129A63; Mon, 26 Feb 2024 13:14:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b="ePhGF8GQ" Received: from serv108.segi.ulg.ac.be (serv108.segi.ulg.ac.be [139.165.32.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C7CE85621; Mon, 26 Feb 2024 13:14:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=139.165.32.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708953277; cv=none; b=sVWeuGpnAt6efVZTOwvlk43vy6G8ubwGK+wq8T4lMys62Sq+Z4tSfD+9fS5I/ovUg+vT3Dnok9+voQxRzoM9O+0PQAUBmTrtes3GFfSdsuNid8KA0vBKOne/hj01/BotfokDf1FAXrkSdCeoCGFV5bKWx0Zwu0y2j0QRlvCR5c8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708953277; c=relaxed/simple; bh=K+olVTHMTKjoBiBlrG5gMJF8sdqlFxFosGfEqGAHmI4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QkxUl5teEKh2f9gLO9ShGY8DOMdHAP+lRRJP0TPb5rRuQSTr7kHVESfwFYDQR4NUcQ1WAekf793eqHiiI1BqqBIB3kOKk2+3shxCk8KWAoQHZCMJV+7tKc7h12cE//wTRZR1Gj9Y3IiLhPxF6hpws8XslemgedvyTpf5Z0CO70o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be; spf=pass smtp.mailfrom=uliege.be; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b=ePhGF8GQ; arc=none smtp.client-ip=139.165.32.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uliege.be Received: from localhost.localdomain (125.179-65-87.adsl-dyn.isp.belgacom.be [87.65.179.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id A17A7200F80A; Mon, 26 Feb 2024 14:14:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be A17A7200F80A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be; s=ulg20190529; t=1708953273; bh=3/eIRR/YRQWKLO4e4AFIeer07wTr9HjoWBKq7QicGlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ePhGF8GQb8HJmocSvOD3OsXBrpqkJ7yw8pql5hJtFAEUJbNbXt1TQqSuchUxGXGM5 kEcAp23iZm6/2Gs68561cW6/71H1WThvn6pHPzPvXoto1ojc03xa/SMRoCcjfcDcDS khVJSq9tnkPP7dj7dGzxyYjUw0DWQMZkX/4W33do3dOVRS7anzRcNkXbyX9NOKlA1G bHn5jalr+SdXxYeksKp+vnWhj6YGWPQBeUjkfNEdt4qugzAjeG6OYhFhGrZ5ylwQ9M eFq45TfG6r8IDKnbQs3XVyytS/vUmNLaBsjHUZ8ZNrFiNGvb2ashJtjA/58Cm5TtU3 XL4QghR8qpMtg== From: Justin Iurman To: netdev@vger.kernel.org Cc: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, justin.iurman@uliege.be Subject: [PATCH net-next v5 2/3] net: ioam6: multicast event Date: Mon, 26 Feb 2024 14:14:11 +0100 Message-Id: <20240226131412.10214-3-justin.iurman@uliege.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226131412.10214-1-justin.iurman@uliege.be> References: <20240226131412.10214-1-justin.iurman@uliege.be> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791967450184453984 X-GMAIL-MSGID: 1791967450184453984 Add a multicast group to the ioam6 generic netlink family and provide ioam6_event() to send an ioam6 event to the multicast group. Reviewed-by: David Ahern Signed-off-by: Justin Iurman --- include/net/ioam6.h | 4 +++ net/ipv6/ioam6.c | 64 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/include/net/ioam6.h b/include/net/ioam6.h index 781d2d8b2f29..2cbbee6e806a 100644 --- a/include/net/ioam6.h +++ b/include/net/ioam6.h @@ -12,6 +12,7 @@ #include #include #include +#include #include struct ioam6_namespace { @@ -65,4 +66,7 @@ void ioam6_exit(void); int ioam6_iptunnel_init(void); void ioam6_iptunnel_exit(void); +void ioam6_event(enum ioam6_event_type type, struct net *net, gfp_t gfp, + void *opt, unsigned int opt_len); + #endif /* _NET_IOAM6_H */ diff --git a/net/ipv6/ioam6.c b/net/ipv6/ioam6.c index 571f0e4d9cf3..5fa923f06632 100644 --- a/net/ipv6/ioam6.c +++ b/net/ipv6/ioam6.c @@ -612,6 +612,68 @@ static const struct genl_ops ioam6_genl_ops[] = { }, }; +#define IOAM6_GENL_EV_GRP_OFFSET 0 + +static const struct genl_multicast_group ioam6_mcgrps[] = { + [IOAM6_GENL_EV_GRP_OFFSET] = { .name = IOAM6_GENL_EV_GRP_NAME, + .flags = GENL_MCAST_CAP_NET_ADMIN }, +}; + +static int ioam6_event_put_trace(struct sk_buff *skb, + struct ioam6_trace_hdr *trace, + unsigned int len) +{ + if (nla_put_u16(skb, IOAM6_EVENT_ATTR_TRACE_NAMESPACE, + be16_to_cpu(trace->namespace_id)) || + nla_put_u8(skb, IOAM6_EVENT_ATTR_TRACE_NODELEN, trace->nodelen) || + nla_put_u32(skb, IOAM6_EVENT_ATTR_TRACE_TYPE, + be32_to_cpu(trace->type_be32)) || + nla_put(skb, IOAM6_EVENT_ATTR_TRACE_DATA, + len - sizeof(struct ioam6_trace_hdr) - trace->remlen * 4, + trace->data + trace->remlen * 4)) + return 1; + + return 0; +} + +void ioam6_event(enum ioam6_event_type type, struct net *net, gfp_t gfp, + void *opt, unsigned int opt_len) +{ + struct nlmsghdr *nlh; + struct sk_buff *skb; + + if (!genl_has_listeners(&ioam6_genl_family, net, + IOAM6_GENL_EV_GRP_OFFSET)) + return; + + skb = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); + if (!skb) + return; + + nlh = genlmsg_put(skb, 0, 0, &ioam6_genl_family, 0, type); + if (!nlh) + goto nla_put_failure; + + switch (type) { + case IOAM6_EVENT_UNSPEC: + WARN_ON_ONCE(1); + break; + case IOAM6_EVENT_TRACE: + if (ioam6_event_put_trace(skb, (struct ioam6_trace_hdr *)opt, + opt_len)) + goto nla_put_failure; + break; + } + + genlmsg_end(skb, nlh); + genlmsg_multicast_netns(&ioam6_genl_family, net, skb, 0, + IOAM6_GENL_EV_GRP_OFFSET, gfp); + return; + +nla_put_failure: + nlmsg_free(skb); +} + static struct genl_family ioam6_genl_family __ro_after_init = { .name = IOAM6_GENL_NAME, .version = IOAM6_GENL_VERSION, @@ -620,6 +682,8 @@ static struct genl_family ioam6_genl_family __ro_after_init = { .ops = ioam6_genl_ops, .n_ops = ARRAY_SIZE(ioam6_genl_ops), .resv_start_op = IOAM6_CMD_NS_SET_SCHEMA + 1, + .mcgrps = ioam6_mcgrps, + .n_mcgrps = ARRAY_SIZE(ioam6_mcgrps), .module = THIS_MODULE, }; From patchwork Mon Feb 26 13:14:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Iurman X-Patchwork-Id: 206622 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2066326dyb; Mon, 26 Feb 2024 05:15:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWR7XzwRWBU4TjR8Z6Bwy5f/OuJ0kHEvzGDKOJJLdQuPUeMB6Ey7prZO1NsENc883jGeY0X+RyUiqyUJOpHVcHydLCbJg== X-Google-Smtp-Source: AGHT+IFEeHkMcqxXaQjBYTtJGbXSlkdggB18pbLrf96SSXTj/zFCUabIaKiW6bo7TmVP5GEaMIY0 X-Received: by 2002:a17:906:d04c:b0:a3f:adcf:7f58 with SMTP id bo12-20020a170906d04c00b00a3fadcf7f58mr4359134ejb.21.1708953332033; Mon, 26 Feb 2024 05:15:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708953332; cv=pass; d=google.com; s=arc-20160816; b=RmKqGlDKp+f+Z1Mzkyfpv49gcDh7R/9YDK6NWAtWOokZECpCJL+ck2iTJAwnuCBWZ6 l3CrWLKQGu5RbzVnnq+j6rdIYhjkSx6ZL/qSiT3ftG/yK699EVRa3iKO9dcG2xo1FqVm nsClEGdARjvTrgoOl65KysLnKke/7pum+i1Jj/n88xcz+FYhWjJYlqNFuc37z/55A4C+ 6LMD70Q1C/r57635gvj7AqzheBmeTn2hTdinQt/eyZX/x/Gr66AX9UTouqrbJkkhIwPW mI6kXrHhCwrHqFnbMjgS/9pfS91H9RCc9ervUkhxa/eYJ80Irexvvw8kOQTOPslDWY2g LGvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=xQqygCkowYJ0wbpEt85TCJ7aXSvzWcfLImX4V5j/zn4=; fh=1UEXF8WEdTRZGz3zsBPr9blJ8rxkIELeUsA6ymhnv1o=; b=UmCG22TEzjxVeeZWlNu10gbE9TwqXD6+shcEuG1C3O2gcrMviNvu6UQGNqaXjKGU/2 wYXH2F6cRxkZS86MXxu7X6att+pq/zreOVszkWnl5qDC5IBRMb+0RnqRURrh4KKNR1SW g0bgVb5FF/KepoM/LgqpuFnfUuOOPDWCriAnqN4P2ZgKpaNGRXPKIpcEX1B+crrL5ckp y8DDYBEA5SrgeKUHBhVrqVInM4Ddh/tFLPinW1CFP1nPhQb6GXY7hMyRmQ+hMpJF0Ip8 uFIJVjaMI7nmZNFWbl3xZdSPQaPoiqIV6k30MvKPmQ7prpB/iEnEVCQXvldAQxjoAk// SZMg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@uliege.be header.s=ulg20190529 header.b=227SmRAF; arc=pass (i=1 spf=pass spfdomain=uliege.be dkim=pass dkdomain=uliege.be dmarc=pass fromdomain=uliege.be); spf=pass (google.com: domain of linux-kernel+bounces-81460-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81460-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=uliege.be Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id dx3-20020a170906a84300b00a3e46758d03si2038060ejb.429.2024.02.26.05.15.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 05:15:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81460-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@uliege.be header.s=ulg20190529 header.b=227SmRAF; arc=pass (i=1 spf=pass spfdomain=uliege.be dkim=pass dkdomain=uliege.be dmarc=pass fromdomain=uliege.be); spf=pass (google.com: domain of linux-kernel+bounces-81460-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81460-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=uliege.be Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 91F8E1F27E85 for ; Mon, 26 Feb 2024 13:15:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7FA5C129A62; Mon, 26 Feb 2024 13:14:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b="227SmRAF" Received: from serv108.segi.ulg.ac.be (serv108.segi.ulg.ac.be [139.165.32.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE9D68562F; Mon, 26 Feb 2024 13:14:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=139.165.32.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708953277; cv=none; b=YdGfQnZq8WAOyobuC6hWMZ3TWJZimsPx6JEEXCYJOOUqUyEs9wKTWCCbyX2Gob5hn+9yDrIBeZiVuMnTPeoB5cASZ4T4a99dmTq54FEMk1PUUE+k9VLK2ZOn0VAfklKdXn+9onmLS5S/8aEMoRmwHSeVtq+P0N26kVRBmu+lZg0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708953277; c=relaxed/simple; bh=4NXsgau3XXoMd95i2zOqL+DzcwfteHD/zed72UuBEEM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eZoS+qiqKsMdsbu4xF0GdhzpZRT6dFOueE/vACND6C/M62RzTgCLifOBOhULuvr1eK60v6PDdrweswM7CDmTJxVYs488t7nvGWf1PKON0SNCt65GWuLXWvo6GKgfPOQTzhB6/GzsUvldO0bt8U8eBx87FdSrHKeSQwe+iEDompU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be; spf=pass smtp.mailfrom=uliege.be; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b=227SmRAF; arc=none smtp.client-ip=139.165.32.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uliege.be Received: from localhost.localdomain (125.179-65-87.adsl-dyn.isp.belgacom.be [87.65.179.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id D5765200F80B; Mon, 26 Feb 2024 14:14:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be D5765200F80B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be; s=ulg20190529; t=1708953274; bh=xQqygCkowYJ0wbpEt85TCJ7aXSvzWcfLImX4V5j/zn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=227SmRAF4jHqwHwxtSJS94Gs7S22S4mmG7HJ5Hod42N5LnNWtznnqE7AXWDrCLtUJ i/bXjZ91HN/oPzABcL8QJQiQR8Rj0N1tghKAwxbgeLU0k4DODr6XYVshzhXK5ezqgm /zyFhDxRoiefcJ7TXVjvS+hJ6uz4bIFKpoe7twKfL6sYcZFtMZ5O0PedE/lLmuKtyN lBnBgWo+aiZNRjnOaBdZ5BehKzyxSv3ewBfXReTZMlSJiZLZ9ZfArN8VISONeMniZJ 5Ght9LyV9D5f8knLOk4FUWZTiSjERw+IyVxb3KTk6U6WiJ6HY4o8fD2LolYCCkm9aR 8Jgorqo2I/HcA== From: Justin Iurman To: netdev@vger.kernel.org Cc: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, justin.iurman@uliege.be Subject: [PATCH net-next v5 3/3] net: exthdrs: ioam6: send trace event Date: Mon, 26 Feb 2024 14:14:12 +0100 Message-Id: <20240226131412.10214-4-justin.iurman@uliege.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226131412.10214-1-justin.iurman@uliege.be> References: <20240226131412.10214-1-justin.iurman@uliege.be> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791967448920842887 X-GMAIL-MSGID: 1791967448920842887 If we're processing an IOAM Pre-allocated Trace Option-Type (the only one supported currently), then send the trace as an ioam6 event to the netlink multicast group. This way, user space apps will be able to collect IOAM data. Reviewed-by: David Ahern Signed-off-by: Justin Iurman --- net/ipv6/exthdrs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index 02e9ffb63af1..727792907d6c 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c @@ -50,6 +50,7 @@ #endif #include #include +#include #include #include @@ -954,6 +955,9 @@ static bool ipv6_hop_ioam(struct sk_buff *skb, int optoff) + optoff + sizeof(*hdr)); ioam6_fill_trace_data(skb, ns, trace, true); + + ioam6_event(IOAM6_EVENT_TRACE, dev_net(skb->dev), + GFP_ATOMIC, (void *)trace, hdr->opt_len - 2); break; default: break;