netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Corcodel Marian <corcodel.marian@gmail.com>
To: netdev@vger.kernel.org
Cc: Corcodel Marian <corcodel.marian@gmail.com>
Subject: [PATCH] r8169: Add ff_dup wich disable advertise on full duplex
Date: Sat,  1 Aug 2015 20:20:21 +0300	[thread overview]
Message-ID: <1438449621-3061-1-git-send-email-corcodel.marian@gmail.com> (raw)

   Add parameter ff_dup wich disable advertise 10/100Mbs
 duplex full   for card wich start on low speed on full duplex.Verry strange with this patch
 First insert module with ff_dup=1 link is good , unload module, load module wo parameter ff_dup
 and is full duplex and full speed on RTL_GIGA_MAC_VER_09.  


Signed-off-by: Corcodel Marian <corcodel.marian@gmail.com>

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 3df51fa..c635d11 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -346,6 +346,7 @@ MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl);
 
 static int rx_buf_sz = 16383;
 static int use_dac;
+static int ff_dup;
 static struct {
 	u32 msg_enable;
 } debug = { -1 };
@@ -850,6 +851,8 @@ module_param(use_dac, int, 0);
 MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot.");
 module_param_named(debug, debug.msg_enable, int, 0);
 MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)");
+module_param(ff_dup, int, 0);
+MODULE_PARM_DESC(ff_dup, "Disable full duplex operations. ");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(RTL8169_VERSION);
 MODULE_FIRMWARE(FIRMWARE_8168D_1);
@@ -1901,6 +1904,7 @@ static int rtl8169_set_speed_xmii(struct net_device *dev,
 				  u8 autoneg, u16 speed, u8 duplex, u32 adv)
 {
 	struct rtl8169_private *tp = netdev_priv(dev);
+	int adv_10baseT_full, adv_100baseT_full;
 	int giga_ctrl, bmcr;
 	int rc = -EINVAL;
 
@@ -1913,13 +1917,27 @@ static int rtl8169_set_speed_xmii(struct net_device *dev,
 		auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL |
 				ADVERTISE_100HALF | ADVERTISE_100FULL);
 
+		if (!ff_dup) {
+		  adv_10baseT_full = ADVERTISED_10baseT_Full;
+		  adv_100baseT_full = ADVERTISED_100baseT_Full;
+		} else {
+		  adv_10baseT_full = 0;
+		  adv_100baseT_full = 0;
+                 }
+
+		bmcr = BMCR_ANENABLE | BMCR_ANRESTART;
+		rtl_writephy(tp, MII_BMCR, bmcr);
+
+
 		if (adv & ADVERTISED_10baseT_Half)
 			auto_nego |= ADVERTISE_10HALF;
-		if (adv & ADVERTISED_10baseT_Full)
-			auto_nego |= ADVERTISE_10FULL;
 		if (adv & ADVERTISED_100baseT_Half)
 			auto_nego |= ADVERTISE_100HALF;
-		if (adv & ADVERTISED_100baseT_Full)
+
+		if (adv & adv_10baseT_full)
+			auto_nego |= ADVERTISE_10FULL;
+
+		if (adv & adv_100baseT_full)
 			auto_nego |= ADVERTISE_100FULL;
 
 		auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
@@ -1940,7 +1958,7 @@ static int rtl8169_set_speed_xmii(struct net_device *dev,
 			goto out;
 		}
 
-		bmcr = BMCR_ANENABLE | BMCR_ANRESTART;
+		//bmcr = BMCR_ANENABLE | BMCR_ANRESTART;
 
 		rtl_writephy(tp, MII_ADVERTISE, auto_nego);
 		rtl_writephy(tp, MII_CTRL1000, giga_ctrl);
-- 
2.1.4

             reply	other threads:[~2015-08-01 17:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-01 17:20 Corcodel Marian [this message]
2015-08-01 23:19 ` [PATCH] r8169: Add ff_dup wich disable advertise on full duplex David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438449621-3061-1-git-send-email-corcodel.marian@gmail.com \
    --to=corcodel.marian@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).