netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] r8169: Add ff_dup wich disable advertise on full duplex
@ 2015-08-01 17:20 Corcodel Marian
  2015-08-01 23:19 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Corcodel Marian @ 2015-08-01 17:20 UTC (permalink / raw)
  To: netdev; +Cc: Corcodel Marian

   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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] r8169: Add ff_dup wich disable advertise on full duplex
  2015-08-01 17:20 [PATCH] r8169: Add ff_dup wich disable advertise on full duplex Corcodel Marian
@ 2015-08-01 23:19 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-08-01 23:19 UTC (permalink / raw)
  To: corcodel.marian; +Cc: netdev

From: Corcodel Marian <corcodel.marian@gmail.com>
Date: Sat,  1 Aug 2015 20:20:21 +0300

>    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>

This patch, like all of your other patches, is not acceptable.

First of all, such module parameters are strongly discouraged.

Instead, such things should be controlled by portable, generic, run
time configurations mechanisms such as ethtool.

Furthermore, you are not explaining sufficiently why this configuration
option is really needed and in exactly what circumstances they would
be used.

I want to _STRONGLY_ impress upon you how much time and effort is
seemingly being wasted on your poorly thought out and formatted
patches.

If this continues do not be surprised if you find it hard for people
willing to look at your submissions at all.  You need to start making
clean proper submissions soon.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-01 23:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-01 17:20 [PATCH] r8169: Add ff_dup wich disable advertise on full duplex Corcodel Marian
2015-08-01 23:19 ` David Miller

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).