From owner-freebsd-net@FreeBSD.ORG Tue Sep 23 23:18:53 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F2DB24B1 for ; Tue, 23 Sep 2014 23:18:53 +0000 (UTC) Received: from mail-la0-x22b.google.com (mail-la0-x22b.google.com [IPv6:2a00:1450:4010:c03::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 805039B9 for ; Tue, 23 Sep 2014 23:18:53 +0000 (UTC) Received: by mail-la0-f43.google.com with SMTP id gb8so96175lab.30 for ; Tue, 23 Sep 2014 16:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=VwaKFYsWfPziBS5h/DHgqhTITr13GZuDZkNWUIGlBKQ=; b=ohhYAH1NLgTxAFv50rN4f62sAGFhRqi8tSBw9YN7KLMau5t5Qx4fGB0TMIuUBNUuUb DgbOePlH9vIYehpDZLZTs9xf6sfaZqeYBIGJ6BnVYgpp+cWtWTJJt2a0KVE+xYKbmWuF FDYJLLWYO0V8pUbSWSWw8rv4BopO5ptJRVczx/Gc+0Fes4sweTBVDLFza7o9e4YBUyqK pxIR/Gwp5zxx3uVbxYEAqqrsBdjcyMcgcaNCIMZ6DCGXQU+1yJizrvlPlSFV7/FBrMG5 9tBSUKUYmyOfEScQE0q5vLuCYZ2C8aZWYFZmhWqL4tzGLoNrhkIX5duNKC35q1BQeSvx 5tyw== MIME-Version: 1.0 X-Received: by 10.112.172.38 with SMTP id az6mr2365088lbc.53.1411514331318; Tue, 23 Sep 2014 16:18:51 -0700 (PDT) Received: by 10.25.21.166 with HTTP; Tue, 23 Sep 2014 16:18:51 -0700 (PDT) Date: Tue, 23 Sep 2014 19:18:51 -0400 Message-ID: Subject: [PATCH] Convert ixl(4) and ixlv(4) to ifcounters, and fix some counter bugs From: Ryan Stone To: freebsd-net Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Sep 2014 23:18:54 -0000 The patch below converts the ixl(4) and ixlv(4) drivers to use the new ifcounter interface. I've hidden the interface behind some macros to ensure that the driver continues to compile for FreeBSD 10 and earlier. The result of the macros is that the ifcounter implementation is somewhat clunkier than I would have liked, but I preferred to try and share as much code between the legacy counter implementation and the ifcounter implementation. I have tested the ixl driver with head. I have only compile-tested it for stable/10. This patch also fixes some counter bugs: - Ensure that tx discards are reported - There are actually two types of rx discard counters in the hardware. Currently the driver is only reporting discards from one of the two counters, so I fixed that - The ipackets and opackets counters were being unnecessarily incremented in the rx and tx paths. This was racy, unnecessary (the counters also get explicitly set based on the values in HW counters) and very bad for performance -- the cacheline contained the counters was constantly bouncing between CPUs. I saw this even with only one queue active, probably due to false sharing with some other field in the ifnet struct. https://people.freebsd.org/~rstone/patches/ixl/0005-Convert-ixl-and-ixlv-drivers-to-use-new-ifcounter-in.patch