Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1158719lqj; Mon, 3 Jun 2024 11:57:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXLPBtDe2Iw0aVpj2PgAHL2ndcfomkQ8DqJ3EqK9BJwy9X+Wn8nv2ylN3KTZaaBKpym0GexLAGQnSYAf4Tq6edVSxbRf1mut+4Yrd/Spw== X-Google-Smtp-Source: AGHT+IEBxLGNrzEHKn1FqjQZh/So6Jvtco3Vk3Km3iarSCqwstT8RObfGbwIKoGhZv48agIVjz81 X-Received: by 2002:ac8:5747:0:b0:43f:f018:6a6d with SMTP id d75a77b69052e-43ff52a085amr115689451cf.22.1717441055354; Mon, 03 Jun 2024 11:57:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717441055; cv=pass; d=google.com; s=arc-20160816; b=G9fFOQMw3IZdW/3C+GmeQl6hH7rLdASzpV6ualyKwfvPkGeWtnmNhPe+C7sSAakmBL MIA/nsXFDR048GPfmczO698c72jcD/BxvX6aEUFPpeNySrKRoFz9q8Jx5TbfS02J343g pdXVSVHugCXIKPJMFyxyuHocgmEFIB9xDUn7VImwnb2LQU9jrK2YTqIcE/Nyqe4nrbI6 F7ao+s0w6Cc4dcxKOARxUJSnCrbX+7yICo+hiljf9hO1p+dvtg77kPJU2P1ASgX/89n8 egJC+dVn2viu44Vj3GdUmRdcTj0cvSoxUiIZoVa5Ss52zmCtzt8hPG8nAsPxoatNDxwk B02w== 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; bh=6CzlCyA1y81ZtK6UbQuoaGFwW2RItiC/hGJ5T4RGkSU=; fh=Cy2nPaNk/BhIblK/kxG0OywEV7gNqr+p4+r9yBVTy1o=; b=HTJzDFY1eMXMZ3D4Cm2a9Czxt5ONegXEQpua2/k+W8L1hOx340iRkVzTP0Di7wvSbE jhlSGahgbhT5oejNmQ6iVa1coU8Kc9xaOXf0JgcB/bRmKInOLGr4TN0YBmaDGplO9+MY C31ffTu2WEdhphQ4nJ7dLVQW4ezIxxXXkboe3Dv7P8z+B6dvIenvK/24C+EqDILO6r/n /yMyjAKZFS29q1eljkAx+3HYhBPstHPcipAJUQz4dkLqgvHy76LL8SU/DZxk8t0UHV1N ussqVXICT2WxnKZQiMGBeI5TcjzbLXLEE22oXnB9ietaFcA7wbVLf6F8Gl0GAqRgf3tw EdlA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fy2w9xqe; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-199584-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199584-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43ff257f0f2si93914181cf.419.2024.06.03.11.57.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 11:57:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199584-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fy2w9xqe; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-199584-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199584-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 05C201C223CC for ; Mon, 3 Jun 2024 18:57:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B3F213A3E3; Mon, 3 Jun 2024 18:57:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fy2w9xqe" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 4223E139D04 for ; Mon, 3 Jun 2024 18:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717441043; cv=none; b=lQrcE0pKGo2HnWSB9rWcwHapW4ZagNh0kbPvTxp39a09VwHbO9dRkbi71b8YOAVd1XlJ9iQSC+tmjX2nHsdIXQ0erhYEWpRDWc30RGyGtwMUxVnMxD75GQ0nkq/0AC1j5QAn9ie82IxhPci79P7PSSNxFw/hzSmAP3H9vS1P1II= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717441043; c=relaxed/simple; bh=yM5qseCWt564Cmf039ulCGk2NlpYr8Eqlkdgkt1H3Tg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P8gWOQqkYvBRwkwIcdgnHxFR6NTu3TccuzvG3K3q4yU8a4kIL7z7cHioJz8zPvqVUYA/NUHVL3fiGKY8BkJfUSzook5252e53opWuujz32am3WiAU6PMjw71MIrjI5A3BTu2OB+ppb7GooXTDyZzewBPIku/c1E1mU6j6CUpg2o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fy2w9xqe; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717441041; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6CzlCyA1y81ZtK6UbQuoaGFwW2RItiC/hGJ5T4RGkSU=; b=fy2w9xqewHrGjwUYyo6DL3w6QV7lkpV/eIUlN4ywaPdMIODpnuydKnxglDBTkvcTmu9Qiu 4hcuO8hT6naDni7fOI+3sDNCvs++XyRd93GtmpbUgLPoazaLT5MtQGFY9Ox4fKYScDelcy tHZp8rS2M0R6DuSvnTqBs1ybPUqoKsc= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-662-IqIftfUPOlqDpI0MlbJ9sA-1; Mon, 03 Jun 2024 14:57:15 -0400 X-MC-Unique: IqIftfUPOlqDpI0MlbJ9sA-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BB1DC191DAE1; Mon, 3 Jun 2024 18:57:13 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.193.112]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C073418B916A; Mon, 3 Jun 2024 18:56:58 +0000 (UTC) From: Adrian Moreno To: netdev@vger.kernel.org Cc: aconole@redhat.com, echaudro@redhat.com, horms@kernel.org, i.maximets@ovn.org, dev@openvswitch.org, Adrian Moreno , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 2/9] net: sched: act_sample: add action cookie to sample Date: Mon, 3 Jun 2024 20:56:36 +0200 Message-ID: <20240603185647.2310748-3-amorenoz@redhat.com> In-Reply-To: <20240603185647.2310748-1-amorenoz@redhat.com> References: <20240603185647.2310748-1-amorenoz@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 If the action has a user_cookie, pass it along to the sample so it can be easily identified. Signed-off-by: Adrian Moreno --- net/sched/act_sample.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c index a69b53d54039..5c3f86ec964a 100644 --- a/net/sched/act_sample.c +++ b/net/sched/act_sample.c @@ -165,9 +165,11 @@ TC_INDIRECT_SCOPE int tcf_sample_act(struct sk_buff *skb, const struct tc_action *a, struct tcf_result *res) { + u8 cookie_data[TC_COOKIE_MAX_SIZE] = {}; struct tcf_sample *s = to_sample(a); struct psample_group *psample_group; struct psample_metadata md = {}; + struct tc_cookie *user_cookie; int retval; tcf_lastuse_update(&s->tcf_tm); @@ -189,6 +191,16 @@ TC_INDIRECT_SCOPE int tcf_sample_act(struct sk_buff *skb, if (skb_at_tc_ingress(skb) && tcf_sample_dev_ok_push(skb->dev)) skb_push(skb, skb->mac_len); + rcu_read_lock(); + user_cookie = rcu_dereference(a->user_cookie); + if (user_cookie) { + memcpy(cookie_data, user_cookie->data, + user_cookie->len); + md.user_cookie = cookie_data; + md.user_cookie_len = user_cookie->len; + } + rcu_read_unlock(); + md.trunc_size = s->truncate ? s->trunc_size : skb->len; psample_sample_packet(psample_group, skb, s->rate, &md); -- 2.45.1