From patchwork Tue Oct 22 09:48:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 13845462 X-Patchwork-Delegate: kuba@kernel.org 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 D07081991C2 for ; Tue, 22 Oct 2024 09:48:06 +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=1729590488; cv=none; b=MfGkBPp7f0gIidFYU7hnpsNKtA1o0HXzCq+ORpISEzFNkC6xka/tqtNL7qE+t6FVqcSE/rVvJwQKfjstEf7VCjVUufKfN1CCZ8kSB8zG6W55jStDvKSWTbVIjtzfBBIMVoaHoIKq8olbTqYiTbXXI9nRE0fuIFAC80L9Sqs7BSw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729590488; c=relaxed/simple; bh=KIdaqy7A+65IXdgQaR5pZnmBq+Y7L8FUNjZYIuvlgUQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QGfULExVEnnnNVtUeR8hhjrRJ82OZBuQVFwqegi9j6jcH1oJ2BZrrgDpKMPCtwnSJi1UrXIwFeJsb0XoBzcnAn37Xn0P0Jkoac7B+ny68MwUqpxpfcbEppEc6pW5LFr0CPThfkZaHhrhKVRG+euVxGeBoefCNThPZJCdsp9KTNk= 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=IIOxCpRW; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IIOxCpRW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729590485; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NiSEn8UX8xukg46jYZnpsEwLTmkrKGxpQ5FVs2rq4vY=; b=IIOxCpRWxgPDNIzVyx5ygLdX/K3k7OnD8ebgay5xS+OED38DGZXwIXucChtaAZg2sedKpT ZgcAgeZ40cKu5KE017dPNFCkOQSX6E9B5XDbo/fIiLhQMXMZLnQUQ3ED3w+pgcOid266U/ SScIEk5uOgZtMn/5Fv8MJWlL8OyJEyo= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-86-hsvfLZrQNm-tgE9ABWWy1w-1; Tue, 22 Oct 2024 05:48:04 -0400 X-MC-Unique: hsvfLZrQNm-tgE9ABWWy1w-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-37d4922d8c7so2856819f8f.1 for ; Tue, 22 Oct 2024 02:48:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729590483; x=1730195283; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NiSEn8UX8xukg46jYZnpsEwLTmkrKGxpQ5FVs2rq4vY=; b=sJk+h0Y0EskgydEonbCko3sD4DQz99j7ENiuzpv5JZThuq/1P0FcO/efgDGQgqerVS lvTWUA0Rtn9Gh/HUE2XV0vH7GRNP2PycsJhkvwtLZP+KG+UMUifuN7jMydqXueAct1I8 MWU21sPn+hgnR3ecjIOpU90OWJU16qnoHXuQgaDXOWalQvbyXzy+JdhdAWO2FMGlmyip +hFC8biFYi+faNQhexhG8egBH4f+ja6ww4tFiZlolnezfGa0ka7ylbxTb+zaStxcsHCt joPP1xQDWrIuP0+U4ozxc3FVI7W0jiGyg+BgjIns9ZONaxYqZmFIWb1lkZ772NxE2tjy K7+g== X-Gm-Message-State: AOJu0YxOhhnE6hh/ulOr0lCGLJff0np78Dpa08vGv75OcFBf1maTvljl u2WQEKO+N/+osdGPaboSNhJ3AC495WARPhkPzukGgplI0CHml3/o53CbBu+n1zsW9UL9KpO2Kpk faB/HzqLoXRjYyS94J09oS9kJSTasU4gi5oljDSrR/K+uMRxjzvhlsQ== X-Received: by 2002:a05:6000:5:b0:37d:3985:8871 with SMTP id ffacd0b85a97d-37eab4ed358mr9903937f8f.39.1729590483254; Tue, 22 Oct 2024 02:48:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHn0RENmZXzBsysNBFuMBEMMi7RPw1Ub+yXzC6Ni0Eu9BLea3/Cm0XL4ffehfy3IVT+UVoKxw== X-Received: by 2002:a05:6000:5:b0:37d:3985:8871 with SMTP id ffacd0b85a97d-37eab4ed358mr9903921f8f.39.1729590482886; Tue, 22 Oct 2024 02:48:02 -0700 (PDT) Received: from debian (2a01cb058918ce00b54b8c7a11d7112d.ipv6.abo.wanadoo.fr. [2a01:cb05:8918:ce00:b54b:8c7a:11d7:112d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37ee0b94346sm6257931f8f.86.2024.10.22.02.48.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2024 02:48:02 -0700 (PDT) Date: Tue, 22 Oct 2024 11:48:00 +0200 From: Guillaume Nault To: David Miller , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: netdev@vger.kernel.org, David Ahern , Ido Schimmel Subject: [PATCH net-next 1/4] ipv4: Prepare fib_compute_spec_dst() to future .flowi4_tos conversion. Message-ID: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Patchwork-Delegate: kuba@kernel.org Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the dscp_t value to __u8 with inet_dscp_to_dsfield(). Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop the inet_dscp_to_dsfield() call. Signed-off-by: Guillaume Nault Reviewed-by: Ido Schimmel --- net/ipv4/fib_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 53bd26315df5..0c9ce934b490 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -293,7 +293,7 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb) .flowi4_iif = LOOPBACK_IFINDEX, .flowi4_l3mdev = l3mdev_master_ifindex_rcu(dev), .daddr = ip_hdr(skb)->saddr, - .flowi4_tos = ip_hdr(skb)->tos & INET_DSCP_MASK, + .flowi4_tos = inet_dscp_to_dsfield(ip4h_dscp(ip_hdr(skb))), .flowi4_scope = scope, .flowi4_mark = vmark ? skb->mark : 0, }; From patchwork Tue Oct 22 09:48:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 13845463 X-Patchwork-Delegate: kuba@kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 30E40194125 for ; Tue, 22 Oct 2024 09:48:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729590497; cv=none; b=V56lynBtE694JqSZ82UU6dcv08V/bhrJF7sF9z2840uLIiPM56q6+j08pkkMKsNCgmMTIftQBTihqP3hWPxED6I+rxATCvYlMEwaMQlnD2iezU7ait8yweKsDAHeZ12kEF6JSk91vdje2aZPfihR2q4v5mH+fL7oK9z7uocD9bc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729590497; c=relaxed/simple; bh=XaUkaBK+hpUOhDIkRzlJiXdM8vvSHQhFMVP4rVVVKxE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hhyQYHeSeQAWKNxxpNKiATeQ6vulHnRhvsb2Bb2AV+hKN5Y4cU4KQGvjLZZF7RuvXwPaNy5tbUJgbKG7IJtH5HLCLVIuheNJC5sGlClTiPqc4jx8jChOPhFB89vuHW0l9JQkjytKPntc81xnBxelFHWjgaM/4OyLY5oZ8VihF/w= 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=iZlNoM27; arc=none smtp.client-ip=170.10.129.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iZlNoM27" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729590495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5RRFmx311mMt/tUUxO+VS5JQIohMmBJqc2TBlvbHmV0=; b=iZlNoM27KMj78kVfoI0ZvoogOzngZ+taq0gTx+14q6sNoAfLC/4xzlgSDHVrYvDmw6A68X fiv1dFpW5hUIOgpBUqmF67SG1TpsTEL2BEDGQYd8vG9z3I9inux0aEYA76TwqQWnJtD0if GPybt3c/Nszut0vwPQz6S74HADCkn+I= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-15-QLMKZ41AMymZIpG06cZKIw-1; Tue, 22 Oct 2024 05:48:12 -0400 X-MC-Unique: QLMKZ41AMymZIpG06cZKIw-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4315a0f25afso40505105e9.3 for ; Tue, 22 Oct 2024 02:48:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729590491; x=1730195291; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=5RRFmx311mMt/tUUxO+VS5JQIohMmBJqc2TBlvbHmV0=; b=bxQxL/7aSElSu1yhoGjYQRC8MQnmjq9+ziqtZGGAy75erGZcTmn4QqY0k7Y1iRo30B R0eK7EIfBbbesFWwU7Z4oxRjlq3GQ5IjgMB+59yQ0XLT54R1IAB/rDns0jy6fBanhyiJ cYVdvid2MymKYKtwYJoLcYOo21b500jqU4VZEI5V0M7+EwhUMHHnCMF1MzoiLxaB281C ihcDO8nAdZwoz8TyPwZFbqmsHOVafCAhmI0cdCVnFHBHYMTSJDmJvSau22XVUDg7ExgD ABkTVkbLfQ95URxPO/1vdl0oF1sH1+TagwYtVfI8TREXqHe60Vc8s8TzRSg+pgtGL8yk kJLg== X-Gm-Message-State: AOJu0Yz1xSPtdFC6hRna6vNa3KF3/AXsEZQFUfysSppKYRm/lLoDKQMq 07CGvpNqpCCVCQ23/M68F/PEiY0H2V4z5DmeF03iBOJdN4FffqpE+hMiODOZChS2mjkhFoE/BsK zgg0jALGuG0GcKQPQ2PggSALLB81j06i9KnWnX9kJX653k0hg94O3eA== X-Received: by 2002:a05:600c:3511:b0:42c:ba1f:5482 with SMTP id 5b1f17b1804b1-43161691c49mr89435555e9.35.1729590490891; Tue, 22 Oct 2024 02:48:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF3HFc2Ycx3O98VJk7U1x4wnReHs1+f18GY8AglBDnWfBFY/0L61+Uw/Chfj+L3qrRMcF4N9A== X-Received: by 2002:a05:600c:3511:b0:42c:ba1f:5482 with SMTP id 5b1f17b1804b1-43161691c49mr89435315e9.35.1729590490426; Tue, 22 Oct 2024 02:48:10 -0700 (PDT) Received: from debian (2a01cb058918ce00b54b8c7a11d7112d.ipv6.abo.wanadoo.fr. [2a01:cb05:8918:ce00:b54b:8c7a:11d7:112d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37ee0b9bb15sm6238565f8f.99.2024.10.22.02.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2024 02:48:10 -0700 (PDT) Date: Tue, 22 Oct 2024 11:48:08 +0200 From: Guillaume Nault To: David Miller , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: netdev@vger.kernel.org, David Ahern , Ido Schimmel Subject: [PATCH net-next 2/4] ipv4: Prepare icmp_reply() to future .flowi4_tos conversion. Message-ID: <61b7563563f8b0a562b5b62032fe5260034d0aac.1729530028.git.gnault@redhat.com> References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Patchwork-Delegate: kuba@kernel.org Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the dscp_t value to __u8 with inet_dscp_to_dsfield(). Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop the inet_dscp_to_dsfield() call. Signed-off-by: Guillaume Nault Reviewed-by: Ido Schimmel --- net/ipv4/icmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 23664434922e..33eec844a5a0 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -445,7 +445,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) fl4.saddr = saddr; fl4.flowi4_mark = mark; fl4.flowi4_uid = sock_net_uid(net, NULL); - fl4.flowi4_tos = ip_hdr(skb)->tos & INET_DSCP_MASK; + fl4.flowi4_tos = inet_dscp_to_dsfield(ip4h_dscp(ip_hdr(skb))); fl4.flowi4_proto = IPPROTO_ICMP; fl4.flowi4_oif = l3mdev_master_ifindex(skb->dev); security_skb_classify_flow(skb, flowi4_to_flowi_common(&fl4)); From patchwork Tue Oct 22 09:48:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 13845464 X-Patchwork-Delegate: kuba@kernel.org 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 5A2ED155330 for ; Tue, 22 Oct 2024 09:48: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=1729590503; cv=none; b=N6Ja5P4wnjvk6fi9n/q7h24wM3JcP87YkaTpM4swV4DatVZHygzNd6shNACVbqyQmVr0PUH+4BClquJ+eaEnHuX4usabip0TqJ6Ilmk8QPF5Vm5FWRFNw/joCMxPhuKVD0KZU537VHQBnjtaqtcw5cvmk9pW5GUyeDHiDYbA8ns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729590503; c=relaxed/simple; bh=ZRqmtFtpN6pL6xPgI7LsATitWXUIUBemhFkGzlCmPt4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=R0x38shtLeQXniZ/aKPaaIiArusUwaGy0VEfCrRaAsRQYTSe9WmxNoslGAza9Qs76aYw8PSAbOH9vPhuGRE18UzNPNreq57S/8nRHUisuQ4fEkEAHLNJ9viw0RMbpjwVd196PrcwotdnrvXhBa7L4vEynb867QpJt3zpFOaUOYc= 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=dRvqEIv6; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dRvqEIv6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729590501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XD9BsKkXKs/DyY017aAgEepYSP6HuYEsFB0I6eYqQg4=; b=dRvqEIv6V7osPJaUA4VDGU6iqrLh/9+wGHc907vmGv/2cvf88+IW7S8YGKQ1WPLMrHDQzG Y7L/rM955jBRy2O5FmZ7D9behoyZeDQXGgS1DcmuCLTxp70J4MVaA6zmobwzIcT75inrEr fw6q7hDaLzHwPTkeTjBZwC2pBuqAKWI= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-14-No4CSRKOMRqUirXgIbOfPg-1; Tue, 22 Oct 2024 05:48:19 -0400 X-MC-Unique: No4CSRKOMRqUirXgIbOfPg-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42ac185e26cso44226185e9.3 for ; Tue, 22 Oct 2024 02:48:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729590498; x=1730195298; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XD9BsKkXKs/DyY017aAgEepYSP6HuYEsFB0I6eYqQg4=; b=suCr4G08tSLR719POOMdmyoaLyg+IM+EZ86f4Af8Ir/PDlBukuAcyZezASaVAubw0e +1OV7YMppoct8qDKCb1Hogt82eAC20buB6ovcI09noRQW6SGglnxn0T9ARNI67f+C/9d 2TyDgF7t7qNS73dF+XI8beEqDZqmjm/pHTtL2oI81BmL6vsP3Xh6e5Bp9xzDYorZvnPk 9HTwEEksvC9rw1WiQhfAJQ1ebGGVT+EV7McqD381AM3Iu9s0dBzx0+6kCzyVjEmaqMQu rRljhpPNbywlpMhXoSGEQjpevhkJZ/PJypFPbG3XNqAKqkL4fvl5iAzr0qa91/FYFH8z 540A== X-Gm-Message-State: AOJu0Yw9WZ+Z76Oi9L3S40NLnz4DpqcLpurRc5Nhm/Xg3xZKVb91BqUG rRAtublU7wX0JWN23rT2v8+QqZn/VTWTLCD+f8my8ZSTc0w8PUoJyD3yBcx237kVwYLFkgD4F6W PvNcXit73WbtNXyesmmvvS3oxRvpf26fVaxJrzn9lz79PO72Se37x+g== X-Received: by 2002:a05:600c:3d9b:b0:431:40ca:ce6e with SMTP id 5b1f17b1804b1-431616a0986mr106060125e9.31.1729590498341; Tue, 22 Oct 2024 02:48:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFMoXUcyBDBlvdUThYTiFcEuZ6XXmu6oF2dUWjDb8EvuYSPFlf1hesnX3+QkgfA3OyhEj8n4A== X-Received: by 2002:a05:600c:3d9b:b0:431:40ca:ce6e with SMTP id 5b1f17b1804b1-431616a0986mr106059865e9.31.1729590497959; Tue, 22 Oct 2024 02:48:17 -0700 (PDT) Received: from debian (2a01cb058918ce00b54b8c7a11d7112d.ipv6.abo.wanadoo.fr. [2a01:cb05:8918:ce00:b54b:8c7a:11d7:112d]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4317d03ea4asm9268305e9.0.2024.10.22.02.48.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2024 02:48:17 -0700 (PDT) Date: Tue, 22 Oct 2024 11:48:15 +0200 From: Guillaume Nault To: David Miller , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: netdev@vger.kernel.org, David Ahern , Ido Schimmel Subject: [PATCH net-next 3/4] ipv4: Prepare ipmr_rt_fib_lookup() to future .flowi4_tos conversion. Message-ID: <462402a097260357a7aba80228612305f230b6a9.1729530028.git.gnault@redhat.com> References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Patchwork-Delegate: kuba@kernel.org Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the dscp_t value to __u8 with inet_dscp_to_dsfield(). Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop the inet_dscp_to_dsfield() call. Signed-off-by: Guillaume Nault Reviewed-by: Ido Schimmel --- net/ipv4/ipmr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index b4fc443481ce..99e7cd0531d9 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -2081,7 +2081,7 @@ static struct mr_table *ipmr_rt_fib_lookup(struct net *net, struct sk_buff *skb) struct flowi4 fl4 = { .daddr = iph->daddr, .saddr = iph->saddr, - .flowi4_tos = iph->tos & INET_DSCP_MASK, + .flowi4_tos = inet_dscp_to_dsfield(ip4h_dscp(iph)), .flowi4_oif = (rt_is_output_route(rt) ? skb->dev->ifindex : 0), .flowi4_iif = (rt_is_output_route(rt) ? From patchwork Tue Oct 22 09:48:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 13845465 X-Patchwork-Delegate: kuba@kernel.org 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 D4E1E146A97 for ; Tue, 22 Oct 2024 09:48:29 +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=1729590511; cv=none; b=h2WzXGE/mHd8JK8Fui/ngFl3FLJQbEblpcDelKvyl1KrfZcPaDlrS+qgniVzOhYyiHosloBLTUaBYoEnnqMrahASgQvkVEio0P10lJtbZbtNlCC7fnw6ESJU1c2PyBNlV2QyygHjNXpEyjTeSlADkz92fmX4CXI5iWybMIJnuC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729590511; c=relaxed/simple; bh=h5QExSH5FpwIjk76tbd1hfebqN6WOzSNNNcaIGbi5vI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rnzA+yPV/qGxEwXqyT9kjZIeil7+G2mQ9Rb6Tm29vQbgvoBsQxthvYHLGC6UTqLXZ0nYQry1lJFP+fM3z70cXR0z1AFMaXz4uSmyGYrD/TCBRZ/ahqG4743v5KTe55Kzz7k+PmHaiFhek+w5MD5HYW14Fr1+HO316KYult3Pnqo= 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=O/cZGMN7; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="O/cZGMN7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729590508; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iEbIPgPvL601C6KZ3E2D4Xn3tKsNlbZfCIuRhDAjfM4=; b=O/cZGMN74zEy0pxj2ntcfYnlF4Xhd0LhXCwd6xm+sQIu1gs+aEjxAjhjULCPRiF7S4ubyv jxtTKo50AYRd96XN8sjWbZ+AoNKCvrDSE+9G5umTfK6s7HQzsNcSVkDsYkUSg236MGpOg2 hlGUaLf87M8I0SLA/gu5/RY7CKySTMw= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-466-tNvOWcLiPSG7qbTQqltFlw-1; Tue, 22 Oct 2024 05:48:27 -0400 X-MC-Unique: tNvOWcLiPSG7qbTQqltFlw-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-43159c07193so48594375e9.0 for ; Tue, 22 Oct 2024 02:48:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729590506; x=1730195306; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=iEbIPgPvL601C6KZ3E2D4Xn3tKsNlbZfCIuRhDAjfM4=; b=CMYZ9bs2sdto/VLkjwWnNlR0NzW/KhXTaok02oCtkt30XlE3Twdw+3YCwxJyKv9QCy KFil+1zphqaYvPwYBirmKksGLwxej1z2/ssDY10uR2TXLgJrCg/vbupeoWDG8JvbawXs t3pd3stT9wRwZAtwPRV147JwUKvmMF6g21bUy3oNCo7FWbXBPrYP3Tj7UfOYns9RPxxd QWii4eylUujDlKYuWwjnjLORJOdxIsKF/BoNnQVlKAMEYSyumV1fQYGJF6M4f0yIjphH CL+lWFtY+xlVAgXK4iOboIMVqlLB7GGUAHSu7jR1uvMqClrcb7xzMhcwCAw5toWmfis8 EJLw== X-Gm-Message-State: AOJu0Yz2KO1H3LMdLM7FfFeg/aLRTCAA3p2kbwt789Yc6LljfE/3CTaF o6jgbb/3ESiexEzjWjDmg26BvSujYTxu8VmWq6aMauX9X8uUqFo4CL4XMntTyvzg+Vnk3RT3Rww DL1zRJnJ2ckZWXy8fcBHMooxt/qM+GyPQ6LKppJPNWUtw/5mCTDkK7w== X-Received: by 2002:a7b:c2aa:0:b0:42f:75e0:780e with SMTP id 5b1f17b1804b1-43161627e30mr150600865e9.10.1729590506211; Tue, 22 Oct 2024 02:48:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF96qU/9Z2K/IWAZJG7JO8BsrvfzdxLosKUDO/83RpxxK4h/YDUCY/dZB3+2Uk15dpNnbayFg== X-Received: by 2002:a7b:c2aa:0:b0:42f:75e0:780e with SMTP id 5b1f17b1804b1-43161627e30mr150600445e9.10.1729590505738; Tue, 22 Oct 2024 02:48:25 -0700 (PDT) Received: from debian (2a01cb058918ce00b54b8c7a11d7112d.ipv6.abo.wanadoo.fr. [2a01:cb05:8918:ce00:b54b:8c7a:11d7:112d]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4316f58adffsm83215485e9.22.2024.10.22.02.48.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2024 02:48:25 -0700 (PDT) Date: Tue, 22 Oct 2024 11:48:23 +0200 From: Guillaume Nault To: David Miller , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: netdev@vger.kernel.org, David Ahern , Ido Schimmel Subject: [PATCH net-next 4/4] ipv4: Prepare ip_rt_get_source() to future .flowi4_tos conversion. Message-ID: <0a13a200f31809841975e38633914af1061e0c04.1729530028.git.gnault@redhat.com> References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Patchwork-Delegate: kuba@kernel.org Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the dscp_t value to __u8 with inet_dscp_to_dsfield(). Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop the inet_dscp_to_dsfield() call. Signed-off-by: Guillaume Nault Reviewed-by: Ido Schimmel --- net/ipv4/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 18a08b4f4a5a..763398e08b7d 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1263,7 +1263,7 @@ void ip_rt_get_source(u8 *addr, struct sk_buff *skb, struct rtable *rt) struct flowi4 fl4 = { .daddr = iph->daddr, .saddr = iph->saddr, - .flowi4_tos = iph->tos & INET_DSCP_MASK, + .flowi4_tos = inet_dscp_to_dsfield(ip4h_dscp(iph)), .flowi4_oif = rt->dst.dev->ifindex, .flowi4_iif = skb->dev->ifindex, .flowi4_mark = skb->mark,