lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d4b80dc5-22d3-2609-0c1a-24a70c96e07c@gmail.com>
Date:   Thu, 21 Dec 2017 21:50:17 +0100
From:   Heiner Kallweit <hkallweit1@...il.com>
To:     Andrew Lunn <andrew@...n.ch>,
        Realtek linux nic maintainers <nic_swsd@...ltek.com>,
        Chun-Hao Lin <hau@...ltek.com>
Cc:     David Miller <davem@...emloft.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: [PATCH RFC 05/18] r8168: remove unneeded callbacks from struct
 rtl8169_private

All supported chips provide a MII interface, therefore some callbacks
can be removed from struct rtl8169_private.

Signed-off-by: Heiner Kallweit <hkallweit1@...il.com>
---
 drivers/net/ethernet/realtek/r8168.c | 46 +++++++++++++-----------------------
 1 file changed, 16 insertions(+), 30 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8168.c b/drivers/net/ethernet/realtek/r8168.c
index 48b7edff8..0ce789814 100644
--- a/drivers/net/ethernet/realtek/r8168.c
+++ b/drivers/net/ethernet/realtek/r8168.c
@@ -806,14 +806,7 @@ struct rtl8169_private {
 		u32 (*read)(struct rtl8169_private *, int);
 	} csi_ops;
 
-	int (*set_speed)(struct net_device *, u8 aneg, u16 sp, u8 dpx, u32 adv);
-	int (*get_link_ksettings)(struct net_device *,
-				  struct ethtool_link_ksettings *);
-	void (*phy_reset_enable)(struct rtl8169_private *tp);
 	void (*hw_start)(struct net_device *);
-	unsigned int (*phy_reset_pending)(struct rtl8169_private *tp);
-	unsigned int (*link_ok)(void __iomem *);
-	int (*do_ioctl)(struct rtl8169_private *tp, struct mii_ioctl_data *data, int cmd);
 	bool (*tso_csum)(struct rtl8169_private *, struct sk_buff *, u32 *);
 
 	struct {
@@ -1643,7 +1636,7 @@ static void __rtl8169_check_link_status(struct net_device *dev,
 					struct rtl8169_private *tp,
 					void __iomem *ioaddr, bool pm)
 {
-	if (tp->link_ok(ioaddr)) {
+	if (rtl8169_xmii_link_ok(ioaddr)) {
 		rtl_link_chg_patch(tp);
 		/* This is to cancel a scheduled suspend if there's one. */
 		if (pm)
@@ -1947,7 +1940,7 @@ static int rtl8169_set_speed(struct net_device *dev,
 	struct rtl8169_private *tp = netdev_priv(dev);
 	int ret;
 
-	ret = tp->set_speed(dev, autoneg, speed, duplex, advertising);
+	ret = rtl8169_set_speed_xmii(dev, autoneg, speed, duplex, advertising);
 	if (ret < 0)
 		goto out;
 
@@ -2053,7 +2046,7 @@ static int rtl8169_get_link_ksettings(struct net_device *dev,
 	int rc;
 
 	rtl_lock_work(tp);
-	rc = tp->get_link_ksettings(dev, cmd);
+	rc = rtl8169_get_link_ksettings_xmii(dev, cmd);
 	rtl_unlock_work(tp);
 
 	return rc;
@@ -4307,7 +4300,7 @@ static void rtl_phy_work(struct rtl8169_private *tp)
 
 	assert(tp->mac_version > RTL_GIGA_MAC_VER_01);
 
-	if (tp->phy_reset_pending(tp)) {
+	if (rtl8169_xmii_reset_pending(tp)) {
 		/*
 		 * A busy loop could burn quite a few cycles on nowadays CPU.
 		 * Let's delay the execution of the timer for a few ticks.
@@ -4316,12 +4309,12 @@ static void rtl_phy_work(struct rtl8169_private *tp)
 		goto out_mod_timer;
 	}
 
-	if (tp->link_ok(ioaddr))
+	if (rtl8169_xmii_link_ok(ioaddr))
 		return;
 
 	netif_dbg(tp, link, tp->dev, "PHY reset until link up\n");
 
-	tp->phy_reset_enable(tp);
+	rtl8169_xmii_reset_enable(tp);
 
 out_mod_timer:
 	mod_timer(timer, jiffies + timeout);
@@ -4342,13 +4335,13 @@ static void rtl8169_phy_timer(struct timer_list *t)
 
 DECLARE_RTL_COND(rtl_phy_reset_cond)
 {
-	return tp->phy_reset_pending(tp);
+	return rtl8169_xmii_reset_pending(tp);
 }
 
 static void rtl8169_phy_reset(struct net_device *dev,
 			      struct rtl8169_private *tp)
 {
-	tp->phy_reset_enable(tp);
+	rtl8169_xmii_reset_enable(tp);
 	rtl_msleep_loop_wait_low(tp, &rtl_phy_reset_cond, 1, 100);
 }
 
@@ -4411,14 +4404,6 @@ static int rtl_set_mac_address(struct net_device *dev, void *p)
 	return 0;
 }
 
-static int rtl8169_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-{
-	struct rtl8169_private *tp = netdev_priv(dev);
-	struct mii_ioctl_data *data = if_mii(ifr);
-
-	return netif_running(dev) ? tp->do_ioctl(tp, data, cmd) : -ENODEV;
-}
-
 static int rtl_xmii_ioctl(struct rtl8169_private *tp,
 			  struct mii_ioctl_data *data, int cmd)
 {
@@ -4438,6 +4423,14 @@ static int rtl_xmii_ioctl(struct rtl8169_private *tp,
 	return -EOPNOTSUPP;
 }
 
+static int rtl8169_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+{
+	struct rtl8169_private *tp = netdev_priv(dev);
+	struct mii_ioctl_data *data = if_mii(ifr);
+
+	return netif_running(dev) ? rtl_xmii_ioctl(tp, data, cmd) : -ENODEV;
+}
+
 static void rtl_init_mdio_ops(struct rtl8169_private *tp)
 {
 	struct mdio_ops *ops = &tp->mdio_ops;
@@ -8161,13 +8154,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	tp->features |= rtl_try_msi(tp, cfg);
 	RTL_W8(Cfg9346, Cfg9346_Lock);
 
-	tp->set_speed = rtl8169_set_speed_xmii;
-	tp->get_link_ksettings = rtl8169_get_link_ksettings_xmii;
-	tp->phy_reset_enable = rtl8169_xmii_reset_enable;
-	tp->phy_reset_pending = rtl8169_xmii_reset_pending;
-	tp->link_ok = rtl8169_xmii_link_ok;
-	tp->do_ioctl = rtl_xmii_ioctl;
-
 	mutex_init(&tp->wk.mutex);
 	u64_stats_init(&tp->rx_stats.syncp);
 	u64_stats_init(&tp->tx_stats.syncp);
-- 
2.15.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ