From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B413EC43381 for ; Sat, 23 Feb 2019 00:36:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7F92A2075C for ; Sat, 23 Feb 2019 00:36:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726847AbfBWAgw (ORCPT ); Fri, 22 Feb 2019 19:36:52 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:1086 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725811AbfBWAgw (ORCPT ); Fri, 22 Feb 2019 19:36:52 -0500 X-IronPort-AV: E=Sophos;i="5.58,401,1544511600"; d="scan'208";a="26767594" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Feb 2019 17:36:51 -0700 Received: from localhost.localdomain (10.10.76.4) by chn-sv-exch07.mchp-main.com (10.10.76.108) with Microsoft SMTP Server id 14.3.352.0; Fri, 22 Feb 2019 17:36:51 -0700 From: To: Sergio Paracuellos , Andrew Lunn , Florian Fainelli , Pavel Machek CC: Tristram Ha , , Subject: [PATCH v4 net-next 0/4] net: dsa: microchip: add MIB counters support Date: Fri, 22 Feb 2019 16:36:46 -0800 Message-ID: <1550882211-10381-1-git-send-email-Tristram.Ha@microchip.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Tristram Ha This series of patches is to modify the KSZ9477 DSA driver to read MIB counters periodically to avoid overflow. The MIB counters should be read only when there is link. Otherwise it is a waste of time as hardware never increases the counters. Functions are added to check the port link status so that MIB counters read call is used efficiently. v4 - Use readx_poll_timeout - Fix using mutex in a timer callback function problem - use dp->slave directly instead of checking whether it is valid - Add port_cleanup function in a separate patch - Add a mutex so that changing device variables is safe v3 - Use netif_carrier_ok instead of checking the phy device pointer v2 - Create macro similar to readx_poll_timeout to use with switch - Create ksz_port_cleanup function so that variables like on_ports and live_ports can be updated inside it v1 - Use readx_poll_timeout - Do not clear MIB counters when port is enabled - Do not advertise 1000 half-duplex mode when port is enabled - Do not use freeze function as MIB counters may miss counts Tristram Ha (5): net: dsa: microchip: prepare PHY for proper advertisement net: dsa: microchip: add MIB counter reading support net: dsa: microchip: get port link status net: dsa: microchip: remove unnecessary include headers net: dsa: microchip: add port_cleanup function drivers/net/dsa/microchip/ksz9477.c | 147 ++++++++++++++++++++++----------- drivers/net/dsa/microchip/ksz_common.c | 142 ++++++++++++++++++++++++++++++- drivers/net/dsa/microchip/ksz_common.h | 21 ++++- drivers/net/dsa/microchip/ksz_priv.h | 15 ++-- 4 files changed, 270 insertions(+), 55 deletions(-) -- 1.9.1