From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 505B445CF3; Tue, 12 Nov 2024 10:31:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2D03E402C3; Tue, 12 Nov 2024 10:31:32 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id A9A2140298 for ; Tue, 12 Nov 2024 10:31:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731403890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EwBYhV48CD8L4USAocNuvvXyB2awFomv12HZIwjbV7U=; b=SvF9jm3x7+M0Xh6lgI/MxFapUWVq3TyKRC/rp0jBo3TDj3fhHCvaSNLXwXTFct9HfPvQat DWg5ilup5rZ71pD44bD07JhmE+hAZyYzBdJYFYhoWa7Gu2KmFgdkK7oiJRN7znTHJ4iV9g KgxBb2FVRJ594ZdKRi8Bl+A5GS/OvL4= 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-686-4YRD8ST0PEe7flmYMzEJqA-1; Tue, 12 Nov 2024 04:31:28 -0500 X-MC-Unique: 4YRD8ST0PEe7flmYMzEJqA-1 X-Mimecast-MFC-AGG-ID: 4YRD8ST0PEe7flmYMzEJqA Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-431518ae047so33690775e9.0 for ; Tue, 12 Nov 2024 01:31:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731403887; x=1732008687; h=user-agent:to:from:subject:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=kBadndVMsJK9rwirYqedDUEIF7liVVq82CtoOyHNLu8=; b=TK2sKimPlc3bIwShGNy75pCZ1t5/bYAuJQWbt1UCNukYhlZB810iZ3542o78LO9kUX 88IffNF6uY51ajs5V/DNEvy9Ze8dLTQVbvGu7oUG4h5fONUZgnG1jl8aDoD3MZOReQhL s6RSoNWkicUPSXkJuWtYDwvC1RGXdZM+zSwA1SGAmpxdcNHN2G2pkcH6ecc+n01GHFcK CjNydvEF6OKGJoV1zkGT3RjsxBn0AI/oBwQR8DHYPxXa/M2spRIU3DA0paIB9zMPDOAh 2vFADAqy6qLLb15ZBZvZo/WMyN9cODKBYC+M30kc6mS/HeaYInL6rYE4kTP6CTCd3Ygq CY9g== X-Forwarded-Encrypted: i=1; AJvYcCWH2g7zrd7XwsjR7jHG9vKmqHbNLALAN8ODBRkMV7CVTbzGf5J12Ue0iD7cw/YUeJOJfaA=@dpdk.org X-Gm-Message-State: AOJu0YxuuQRat3+IEkUlgdf2MhVd4qM/5euxXwWxwDflj1LBvGbzkMLw PGSpvWQEMz8tDJ3fcgnEIyuH0/WDsYHcAm9gSktHvfdEW/qLX6ofyhl7j3YlXVDzDhAG9P7NQO6 7ow//Y/R6GiYIqOO8dDG/MWSTJO+pNba+q9oyUvMC/1KbmuEr X-Received: by 2002:a05:600c:1c1e:b0:42c:b826:a26c with SMTP id 5b1f17b1804b1-432b685c2a6mr129209505e9.8.1731403887482; Tue, 12 Nov 2024 01:31:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IES9vJhLu0tZJfpdhZlnMKTPc7lWend8YpMz5RuIFZtH+whW4SjIZ9N5pjWhUWtTlWKbArmrg== X-Received: by 2002:a05:600c:1c1e:b0:42c:b826:a26c with SMTP id 5b1f17b1804b1-432b685c2a6mr129209225e9.8.1731403887110; Tue, 12 Nov 2024 01:31:27 -0800 (PST) Received: from localhost (2a01cb00025433006239e1f47a0b2371.ipv6.abo.wanadoo.fr. [2a01:cb00:254:3300:6239:e1f4:7a0b:2371]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432aa6b2c32sm236485585e9.10.2024.11.12.01.31.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Nov 2024 01:31:26 -0800 (PST) Mime-Version: 1.0 Date: Tue, 12 Nov 2024 10:31:26 +0100 Message-Id: Subject: rte_fib network order bug From: "Robin Jarry" To: "Vladimir Medvedkin" , User-Agent: aerc/0.18.2-101-g95b6f544c5c4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Jxy_GAxTkqe6oyO81e-VXU6_BVT6QvcFBNiiitp563U_1731403888 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8; format=Flowed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi Vladimir, I started playing with the new RTE_FIB_F_NETWORK_ORDER flag and I found=20 that it does not work at all. rte_fib is based on rte_rib to perform all slow path lookups and=20 modifications. Unfortunately, rte_rib does not handle network order=20 addresses. This causes the added routes to be incorrectly masked and=20 thus inserted at the wrong place in the dir24 structure. Here is the config I am using: static struct rte_fib_conf fib_conf =3D { =09.type =3D RTE_FIB_DIR24_8, =09.default_nh =3D 0, =09.max_routes =3D 65536, =09.rib_ext_sz =3D 0, =09.dir24_8 =3D { =09=09.nh_sz =3D RTE_FIB_DIR24_8_8B, =09=09.num_tbl8 =3D 1 << 15, =09}, =09.flags =3D RTE_FIB_F_NETWORK_ORDER, }; And here is a short gdb session demonstrating the issue: rte_fib_add (fib=3D0x16ed79740, ip=3D67305985, depth=3D24 '\030', next_hop= =3D6438576192) at ../subprojects/dpdk/lib/fib/rte_fib.c:126 126 if ((fib =3D=3D NULL) || (fib->modify =3D=3D NULL) || (gdb)=20 129 return fib->modify(fib, ip, depth, next_hop, RTE_FIB_ADD); (gdb) p (char*)inet_ntoa(ip) $9 =3D 0x7ffff72a471c "1.2.3.4" (gdb) p depth $10 =3D 24 '\030' (gdb) p fib->flags=20 $11 =3D 1 ( (gdb) s dir24_8_modify (fib=3D0x16ed79740, ip=3D67305985, depth=3D24 '\030', next_h= op=3D6438576192, op=3D0) at ../subprojects/dpdk/lib/fib/dir24_8.c:452 452 struct rte_rib_node *tmp =3D NULL; (gdb) n 455 int ret =3D 0; (gdb)=20 458 if ((fib =3D=3D NULL) || (depth > RTE_FIB_MAXDEPTH)) (gdb)=20 461 dp =3D rte_fib_get_dp(fib); (gdb)=20 462 rib =3D rte_fib_get_rib(fib); (gdb)=20 465 if (next_hop > get_max_nh(dp->nh_sz)) (gdb)=20 468 ip &=3D rte_rib_depth_to_mask(depth); (gdb) p (char*)inet_ntoa(ip) $12 =3D 0x7ffff72a471c "1.2.3.4" (gdb) p depth $13 =3D 24 '\030' (gdb) n 470 node =3D rte_rib_lookup_exact(rib, ip, depth); (gdb) p (char*)inet_ntoa(ip) $14 =3D 0x7ffff72a471c "0.2.3.4" (gdb) p (char*)inet_ntoa(rte_rib_depth_to_mask(depth)) $15 =3D 0x7ffff72a471c "0.255.255.255" As you can see, the generated mask is invalid. It should have been=20 255.255.255.0. rte_rib would need to have similar network order support and should=20 inherit it from rte_fib. Let me know if you need more information.