Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/811174/?format=api
{ "id": 811174, "url": "http://patchwork.ozlabs.org/api/patches/811174/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/93AF473E2DA327428DE3D46B72B1E9FD41121A14@CHN-SV-EXMX02.mchp-main.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<93AF473E2DA327428DE3D46B72B1E9FD41121A14@CHN-SV-EXMX02.mchp-main.com>", "list_archive_url": null, "date": "2017-09-07T21:09:17", "name": "[RFC,4/6] The common header ksz_priv.h does not contain chip specific data", "commit_ref": null, "pull_url": null, "state": "rfc", "archived": true, "hash": "3bc7d2560c79548d404ab0683bcba28981bf6c30", "submitter": { "id": 72262, "url": "http://patchwork.ozlabs.org/api/people/72262/?format=api", "name": "", "email": "Tristram.Ha@microchip.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/93AF473E2DA327428DE3D46B72B1E9FD41121A14@CHN-SV-EXMX02.mchp-main.com/mbox/", "series": [ { "id": 2062, "url": "http://patchwork.ozlabs.org/api/series/2062/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=2062", "date": "2017-09-07T21:09:04", "name": "[RFC,1/6] The file ksz_common.c will be used by other KSZ switch drivers.", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/2062/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/811174/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/811174/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xpCmF3krlz9rxj\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 8 Sep 2017 07:10:53 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S932547AbdIGVKC convert rfc822-to-8bit (ORCPT\n\t<rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 7 Sep 2017 17:10:02 -0400", "from esa5.microchip.iphmx.com ([216.71.150.166]:59251 \"EHLO\n\tesa5.microchip.iphmx.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S932464AbdIGVKA (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 7 Sep 2017 17:10:00 -0400", "from exsmtp01.microchip.com (HELO email.microchip.com)\n\t([198.175.253.37])\n\tby esa5.microchip.iphmx.com with ESMTP/TLS/AES128-SHA;\n\t07 Sep 2017 14:09:18 -0700", "from CHN-SV-EXMX02.mchp-main.com ([fe80::7dfe:3761:863e:3963]) by\n\tCHN-SV-EXCH01.mchp-main.com ([fe80::9840:ffdf:ec5:1335%29]) with\n\tmapi id 14.03.0352.000; Thu, 7 Sep 2017 14:09:18 -0700" ], "X-IronPort-AV": "E=Sophos;i=\"5.42,360,1500966000\"; d=\"scan'208\";a=\"4516429\"", "From": "<Tristram.Ha@microchip.com>", "To": "<andrew@lunn.ch>, <muvarov@gmail.com>, <pavel@ucw.cz>,\n\t<nathan.leigh.conrad@gmail.com>,\n\t<vivien.didelot@savoirfairelinux.com>, <f.fainelli@gmail.com>,\n\t<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,\n\t<Woojung.Huh@microchip.com>", "Subject": "[PATCH RFC 4/6] The common header ksz_priv.h does not contain chip\n\tspecific data", "Thread-Topic": "[PATCH RFC 4/6] The common header ksz_priv.h does not contain\n\tchip specific data", "Thread-Index": "AdMoGiWCGcGR11sBTmeSdOs32/7jZQAArVTg", "Date": "Thu, 7 Sep 2017 21:09:17 +0000", "Message-ID": "<93AF473E2DA327428DE3D46B72B1E9FD41121A14@CHN-SV-EXMX02.mchp-main.com>", "References": "<93AF473E2DA327428DE3D46B72B1E9FD411218E7@CHN-SV-EXMX02.mchp-main.com>", "In-Reply-To": "<93AF473E2DA327428DE3D46B72B1E9FD411218E7@CHN-SV-EXMX02.mchp-main.com>", "Accept-Language": "en-US", "Content-Language": "en-US", "X-MS-Has-Attach": "", "X-MS-TNEF-Correlator": "", "x-originating-ip": "[10.10.76.4]", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "8BIT", "MIME-Version": "1.0", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "From: Tristram Ha <Tristram.Ha@microchip.com>\n\nThe header ksz_priv.h is used by all KSZ switch drivers so chip specific data are removed and commonly used variables are added.\n\nSigned-off-by: Tristram Ha <Tristram.Ha@microchip.com>\n---\n-\tksz_read8(dev, PORT_CTRL_ADDR(port, offset), data);\n+\tksz_read8(dev, dev->dev_ops->get_port_addr(port, offset), data);\n }\n \n static inline void ksz_pread16(struct ksz_device *dev, int port, int offset,\n \t\t\t u16 *data)\n {\n-\tksz_read16(dev, PORT_CTRL_ADDR(port, offset), data);\n+\tksz_read16(dev, dev->dev_ops->get_port_addr(port, offset), data);\n }\n \n static inline void ksz_pread32(struct ksz_device *dev, int port, int offset,\n \t\t\t u32 *data)\n {\n-\tksz_read32(dev, PORT_CTRL_ADDR(port, offset), data);\n+\tksz_read32(dev, dev->dev_ops->get_port_addr(port, offset), data);\n }\n \n static inline void ksz_pwrite8(struct ksz_device *dev, int port, int offset,\n \t\t\t u8 data)\n {\n-\tksz_write8(dev, PORT_CTRL_ADDR(port, offset), data);\n+\tksz_write8(dev, dev->dev_ops->get_port_addr(port, offset), data);\n }\n \n static inline void ksz_pwrite16(struct ksz_device *dev, int port, int offset,\n \t\t\t\tu16 data)\n {\n-\tksz_write16(dev, PORT_CTRL_ADDR(port, offset), data);\n+\tksz_write16(dev, dev->dev_ops->get_port_addr(port, offset), data);\n }\n \n static inline void ksz_pwrite32(struct ksz_device *dev, int port, int offset,\n \t\t\t\tu32 data)\n {\n-\tksz_write32(dev, PORT_CTRL_ADDR(port, offset), data);\n+\tksz_write32(dev, dev->dev_ops->get_port_addr(port, offset), data);\n }\n \n #endif", "diff": "diff --git a/drivers/net/dsa/microchip/ksz_priv.h b/drivers/net/dsa/microchip/ksz_priv.h\nindex 2a98dbd..343b509 100644\n--- a/drivers/net/dsa/microchip/ksz_priv.h\n+++ b/drivers/net/dsa/microchip/ksz_priv.h\n@@ -25,14 +25,56 @@\n #include <linux/etherdevice.h>\n #include <net/dsa.h>\n \n-#include \"ksz_9477_reg.h\"\n-\n struct ksz_io_ops;\n \n struct vlan_table {\n \tu32 table[3];\n };\n \n+enum {\n+\tPHY_NO_FLOW_CTRL,\n+\tPHY_FLOW_CTRL,\n+\tPHY_TX_ONLY,\n+\tPHY_RX_ONLY\n+};\n+\n+struct ksz_port_mib {\n+\tu8 cnt_ptr;\n+\tu8 ctrl;\n+\tunsigned long time;\n+\n+\tstruct ksz_port_mib_info {\n+\t\tu64 counter;\n+\t\tu8 read_cnt;\n+\t\tu8 read_max;\n+\t} *info;\n+};\n+\n+struct ksz_port {\n+\tu16 member;\n+\tu16 vid_member;\n+\tint stp_state;\n+\tu16 speed;\n+\tu8 duplex;\n+\tu8 advertised;\n+\tu8 flow_ctrl;\n+\tu8 link;\n+\tu8 partner;\n+\n+\tu32 on:1;\t\t\t/* port is not disabled by hardware */\n+\tu32 fiber:1;\t\t\t/* port is fiber */\n+\tu32 sgmii:1;\t\t\t/* port is SGMII */\n+\tu32 force:1;\n+\tu32 link_down:1;\t\t/* link just goes down */\n+\tu32 link_up:1;\t\t\t/* link is up */\n+\n+\tstruct ksz_port_mib mib;\n+};\n+\n+#define USE_FEWER_PORTS\t\t\tBIT(18)\n+\n+#define PTP_TAG\t\t\t\tBIT(29)\n+\n struct ksz_device {\n \tstruct dsa_switch *ds;\n \tstruct ksz_platform_data *pdata;\n@@ -43,6 +85,7 @@ struct ksz_device {\n \tstruct mutex alu_mutex;\t\t/* ALU access */\n \tstruct mutex vlan_mutex;\t/* vlan access */\n \tconst struct ksz_io_ops *ops;\n+\tconst struct ksz_dev_ops *dev_ops;\n \n \tstruct device *dev;\n \n@@ -56,10 +99,32 @@ struct ksz_device {\n \tint cpu_port;\t\t\t/* port connected to CPU */\n \tint cpu_ports;\t\t\t/* port bitmap can be cpu port */\n \tint port_cnt;\n+\tint mib_cnt;\n+\tint mib_port_cnt;\n+\tint last_port;\t\t\t/* ports after that not used */\n+\tint interface;\n \n \tstruct vlan_table *vlan_cache;\n \n-\tu64 mib_value[TOTAL_SWITCH_COUNTER_NUM];\n+\tu8 *txbuf;\n+\n+\tstruct ksz_port *ports;\n+\tstruct timer_list mib_read_timer;\n+\tstruct work_struct mib_read;\n+\tspinlock_t mib_read_lock;\t/* use to update read_cnt */\n+\tunsigned long MIB_READ_INTERVAL;\n+\tu32 features;\n+\tu32 overrides;\n+\tu16 br_member;\n+\tu16 member;\n+\tu16 live_ports;\n+\tu16 on_ports;\t\t\t/* ports enabled by DSA */\n+\tu16 rx_ports;\n+\tu16 tx_ports;\n+\tu16 mirror_rx;\n+\tu16 mirror_tx;\n+\tu16 HOST_MASK;\n+\tu16 PORT_MASK;\n };\n \n struct ksz_io_ops {\n@@ -75,12 +140,30 @@ struct ksz_io_ops {\n \t\t\t u16 *value);\n \tint (*phy_write16)(struct ksz_device *dev, int addr, int reg,\n \t\t\t u16 value);\n+\tunsigned int (*get)(struct ksz_device *dev, u32 reg, void *data,\n+\t\t\t unsigned int len);\n+\tunsigned int (*set)(struct ksz_device *dev, u32 reg, void *data,\n+\t\t\t unsigned int len);\n+};\n+\n+struct ksz_dev_ops {\n+\tu32 (*get_port_addr)(int port, int offset);\n+\tint (*reset)(struct ksz_device *dev);\n+\tint (*get_rx_len)(struct ksz_device *dev);\n+\tint (*get_tx_len)(struct ksz_device *dev);\n+\tvoid (*add_tail_tag)(struct ksz_device *dev, struct sk_buff *skb,\n+\t\t\t int port);\n+\tint (*get_tail_tag)(struct ksz_device *dev, struct sk_buff *skb,\n+\t\t\t int *port);\n+\tint (*detect)(struct ksz_device *dev);\n+\tint (*init)(struct ksz_device *dev);\n+\tvoid (*exit)(struct ksz_device *dev);\n };\n \n struct ksz_device *ksz_switch_alloc(struct device *base,\n \t\t\t\t const struct ksz_io_ops *ops, void *priv); -int ksz_switch_detect(struct ksz_device *dev); -int ksz_switch_register(struct ksz_device *dev);\n+int ksz_switch_register(struct ksz_device *dev,\n+\t\t\tconst struct ksz_dev_ops *ops);\n void ksz_switch_remove(struct ksz_device *dev);\n \n static inline int ksz_read8(struct ksz_device *dev, u32 reg, u8 *val) @@ -174,37 +257,37 @@ static inline int ksz_write32(struct ksz_device *dev, u32 reg, u32 value) static inline void ksz_pread8(struct ksz_device *dev, int port, int offset,\n \t\t\t u8 *data)\n {\n", "prefixes": [ "RFC", "4/6" ] }