netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v4] r8169: Add EEPROM support and disable MWI on pci express.
@ 2016-02-07 17:38 Corcodel Marian
  2016-02-07 18:10 ` Sergei Shtylyov
  0 siblings, 1 reply; 4+ messages in thread
From: Corcodel Marian @ 2016-02-07 17:38 UTC (permalink / raw)
  To: netdev; +Cc: Corcodel Marian

  On chip with external eeprom ASPM settings is loaded from eeprom and
   on pci express interface not support MWI.

Signed-off-by: Corcodel Marian <asd@marian1000.go.ro>
---
 drivers/net/ethernet/realtek/r8169.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 1d119a6..bebd550 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -733,6 +733,7 @@ enum features {
 	RTL_FEATURE_WOL		= (1 << 0),
 	RTL_FEATURE_MSI		= (1 << 1),
 	RTL_FEATURE_GMII	= (1 << 2),
+	RTL_FEATURE_EEPROM	= (1 << 3),
 };
 
 struct rtl8169_counters {
@@ -4372,7 +4373,8 @@ static void rtl8169_release_board(struct pci_dev *pdev, struct net_device *dev,
 {
 	iounmap(ioaddr);
 	pci_release_regions(pdev);
-	pci_clear_mwi(pdev);
+	if (!pci_is_pcie(pdev))
+	 pci_clear_mwi(pdev);
 	pci_disable_device(pdev);
 	free_netdev(dev);
 }
@@ -8042,7 +8044,7 @@ static const struct rtl_cfg_info {
 		.align		= 8,
 		.event_slow	= SYSErr | LinkChg | RxOverflow | RxFIFOOver |
 				  PCSTimeout | SWInt | TxDescUnavail,
-		.features	= RTL_FEATURE_MSI,
+		.features	= RTL_FEATURE_MSI | RTL_FEATURE_EEPROM,
 		.default_ver	= RTL_GIGA_MAC_VER_13,
 	}
 };
@@ -8151,6 +8153,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data;
 	const unsigned int region = cfg->region;
+	unsigned features = cfg->features;
 	struct rtl8169_private *tp;
 	struct mii_if_info *mii;
 	struct net_device *dev;
@@ -8186,8 +8189,10 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	/* disable ASPM completely as that cause random device stop working
 	 * problems as well as full system hangs for some PCIe devices users */
-	pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
-				     PCIE_LINK_STATE_CLKPM);
+	if (!(features & RTL_FEATURE_EEPROM)) 
+		pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S |
+					PCIE_LINK_STATE_L1 |
+				     	PCIE_LINK_STATE_CLKPM);
 
 	mdelay(RTL8169_EE_TIMEOUT);
 	/* enable device (incl. PCI PM wakeup and hotplug setup) */
@@ -8196,10 +8201,10 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 		netif_err(tp, probe, dev, "enable failure\n");
 		goto err_out_free_dev_1;
 	}
-
-	if (pci_set_mwi(pdev) < 0)
+	if (!pci_is_pcie(pdev)) {
+	 if (pci_set_mwi(pdev) < 0)
 		netif_info(tp, probe, dev, "Mem-Wr-Inval unavailable\n");
-
+        }
 	/* make sure PCI base addr 1 is MMIO */
 	if (!(pci_resource_flags(pdev, region) & IORESOURCE_MEM)) {
 		netif_err(tp, probe, dev,
@@ -8462,7 +8467,8 @@ err_out_msi_4:
 err_out_free_res_3:
 	pci_release_regions(pdev);
 err_out_mwi_2:
-	pci_clear_mwi(pdev);
+        if (!pci_is_pcie(pdev))
+	 pci_clear_mwi(pdev);
 	pci_disable_device(pdev);
 err_out_free_dev_1:
 	free_netdev(dev);
-- 
2.5.0

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

* Re: [PATCH net v4] r8169: Add EEPROM support and disable MWI on pci express.
  2016-02-07 17:38 [PATCH net v4] r8169: Add EEPROM support and disable MWI on pci express Corcodel Marian
@ 2016-02-07 18:10 ` Sergei Shtylyov
  2016-02-07 18:40   ` Corcodel Marian
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2016-02-07 18:10 UTC (permalink / raw)
  To: Corcodel Marian, netdev

Hello.

On 02/07/2016 08:38 PM, Corcodel Marian wrote:

>    On chip with external eeprom ASPM settings is loaded from eeprom and
>     on pci express interface not support MWI.

    Does not support.

>
> Signed-off-by: Corcodel Marian <asd@marian1000.go.ro>
> ---
>   drivers/net/ethernet/realtek/r8169.c | 22 ++++++++++++++--------
>   1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
> index 1d119a6..bebd550 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
[...]
> @@ -4372,7 +4373,8 @@ static void rtl8169_release_board(struct pci_dev *pdev, struct net_device *dev,
>   {
>   	iounmap(ioaddr);
>   	pci_release_regions(pdev);
> -	pci_clear_mwi(pdev);
> +	if (!pci_is_pcie(pdev))
> +	 pci_clear_mwi(pdev);

    Please indent with tab, not space.

>   	pci_disable_device(pdev);
>   	free_netdev(dev);
>   }
> @@ -8042,7 +8044,7 @@ static const struct rtl_cfg_info {
>   		.align		= 8,
>   		.event_slow	= SYSErr | LinkChg | RxOverflow | RxFIFOOver |
>   				  PCSTimeout | SWInt | TxDescUnavail,
> -		.features	= RTL_FEATURE_MSI,
> +		.features	= RTL_FEATURE_MSI | RTL_FEATURE_EEPROM,
>   		.default_ver	= RTL_GIGA_MAC_VER_13,
>   	}
>   };
> @@ -8151,6 +8153,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>   {
>   	const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data;
>   	const unsigned int region = cfg->region;
> +	unsigned features = cfg->features;

    Not sure you need this variable.

>   	struct rtl8169_private *tp;
>   	struct mii_if_info *mii;
>   	struct net_device *dev;
> @@ -8186,8 +8189,10 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>
>   	/* disable ASPM completely as that cause random device stop working
>   	 * problems as well as full system hangs for some PCIe devices users */
> -	pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
> -				     PCIE_LINK_STATE_CLKPM);
> +	if (!(features & RTL_FEATURE_EEPROM))
> +		pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S |
> +					PCIE_LINK_STATE_L1 |
> +				     	PCIE_LINK_STATE_CLKPM);

    The continuation likes should start under 'pdev', that's a style used by 
the networking code.

>
>   	mdelay(RTL8169_EE_TIMEOUT);
>   	/* enable device (incl. PCI PM wakeup and hotplug setup) */
> @@ -8196,10 +8201,10 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>   		netif_err(tp, probe, dev, "enable failure\n");
>   		goto err_out_free_dev_1;
>   	}
> -
> -	if (pci_set_mwi(pdev) < 0)
> +	if (!pci_is_pcie(pdev)) {
> +	 if (pci_set_mwi(pdev) < 0)

    Please indent with tab, not space.

>   		netif_info(tp, probe, dev, "Mem-Wr-Inval unavailable\n");
> -
> +        }
>   	/* make sure PCI base addr 1 is MMIO */
>   	if (!(pci_resource_flags(pdev, region) & IORESOURCE_MEM)) {
>   		netif_err(tp, probe, dev,
> @@ -8462,7 +8467,8 @@ err_out_msi_4:
>   err_out_free_res_3:
>   	pci_release_regions(pdev);
>   err_out_mwi_2:
> -	pci_clear_mwi(pdev);
> +        if (!pci_is_pcie(pdev))
> +	 pci_clear_mwi(pdev);

    Please indent properly.

[...]

MBR, Sergei

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

* Re: [PATCH net v4] r8169: Add EEPROM support and disable MWI on pci express.
  2016-02-07 18:10 ` Sergei Shtylyov
@ 2016-02-07 18:40   ` Corcodel Marian
  2016-02-07 18:48     ` Sergei Shtylyov
  0 siblings, 1 reply; 4+ messages in thread
From: Corcodel Marian @ 2016-02-07 18:40 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: netdev

On Sun, 2016-02-07 at 21:10 +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 02/07/2016 08:38 PM, Corcodel Marian wrote:
> 
> >    On chip with external eeprom ASPM settings is loaded from eeprom
> > and
> >     on pci express interface not support MWI.
> 
>     Does not support.
> 
> > 
> > Signed-off-by: Corcodel Marian <asd@marian1000.go.ro>
> > ---
> >   drivers/net/ethernet/realtek/r8169.c | 22 ++++++++++++++--------
> >   1 file changed, 14 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/realtek/r8169.c
> > b/drivers/net/ethernet/realtek/r8169.c
> > index 1d119a6..bebd550 100644
> > --- a/drivers/net/ethernet/realtek/r8169.c
> > +++ b/drivers/net/ethernet/realtek/r8169.c
> [...]
> > @@ -4372,7 +4373,8 @@ static void rtl8169_release_board(struct
> > pci_dev *pdev, struct net_device *dev,
> >   {
> >   	iounmap(ioaddr);
> >   	pci_release_regions(pdev);
> > -	pci_clear_mwi(pdev);
> > +	if (!pci_is_pcie(pdev))
> > +	 pci_clear_mwi(pdev);
> 
>     Please indent with tab, not space.
> 
> >   	pci_disable_device(pdev);
> >   	free_netdev(dev);
> >   }
> > @@ -8042,7 +8044,7 @@ static const struct rtl_cfg_info {
> >   		.align		= 8,
> >   		.event_slow	= SYSErr | LinkChg |
> > RxOverflow | RxFIFOOver |
> >   				  PCSTimeout | SWInt |
> > TxDescUnavail,
> > -		.features	= RTL_FEATURE_MSI,
> > +		.features	= RTL_FEATURE_MSI |
> > RTL_FEATURE_EEPROM,
> >   		.default_ver	= RTL_GIGA_MAC_VER_13,
> >   	}
> >   };
> > @@ -8151,6 +8153,7 @@ static int rtl_init_one(struct pci_dev *pdev,
> > const struct pci_device_id *ent)
> >   {
> >   	const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent
> > ->driver_data;
> >   	const unsigned int region = cfg->region;
> > +	unsigned features = cfg->features;
> 
>     Not sure you need this variable.
> 
> >   	struct rtl8169_private *tp;
> >   	struct mii_if_info *mii;
> >   	struct net_device *dev;
> > @@ -8186,8 +8189,10 @@ static int rtl_init_one(struct pci_dev
> > *pdev, const struct pci_device_id *ent)
> > 
> >   	/* disable ASPM completely as that cause random device
> > stop working
> >   	 * problems as well as full system hangs for some PCIe
> > devices users */
> > -	pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S |
> > PCIE_LINK_STATE_L1 |
> > -				     PCIE_LINK_STATE_CLKPM);
> > +	if (!(features & RTL_FEATURE_EEPROM))
> > +		pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S |
> > +					PCIE_LINK_STATE_L1 |
> > +				     	PCIE_LINK_STATE_CLKPM
> > );
> 
>     The continuation likes should start under 'pdev', that's a style
> used by 
> the networking code.
> 
> > 
> >   	mdelay(RTL8169_EE_TIMEOUT);
> >   	/* enable device (incl. PCI PM wakeup and hotplug setup)
> > */
> > @@ -8196,10 +8201,10 @@ static int rtl_init_one(struct pci_dev
> > *pdev, const struct pci_device_id *ent)
> >   		netif_err(tp, probe, dev, "enable failure\n");
> >   		goto err_out_free_dev_1;
> >   	}
> > -
> > -	if (pci_set_mwi(pdev) < 0)
> > +	if (!pci_is_pcie(pdev)) {
> > +	 if (pci_set_mwi(pdev) < 0)
> 
>     Please indent with tab, not space.
> 
> >   		netif_info(tp, probe, dev, "Mem-Wr-Inval
> > unavailable\n");
> > -
> > +        }
> >   	/* make sure PCI base addr 1 is MMIO */
> >   	if (!(pci_resource_flags(pdev, region) & IORESOURCE_MEM))
> > {
> >   		netif_err(tp, probe, dev,
> > @@ -8462,7 +8467,8 @@ err_out_msi_4:
> >   err_out_free_res_3:
> >   	pci_release_regions(pdev);
> >   err_out_mwi_2:
> > -	pci_clear_mwi(pdev);
> > +        if (!pci_is_pcie(pdev))
> > +	 pci_clear_mwi(pdev);
> 
>     Please indent properly.
> 
> [...]
> 
> MBR, Sergei
> 

Hi i have one question, this patch can be reused or need to create new
one.

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

* Re: [PATCH net v4] r8169: Add EEPROM support and disable MWI on pci express.
  2016-02-07 18:40   ` Corcodel Marian
@ 2016-02-07 18:48     ` Sergei Shtylyov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2016-02-07 18:48 UTC (permalink / raw)
  To: Corcodel Marian; +Cc: netdev

On 02/07/2016 09:40 PM, Corcodel Marian wrote:

    [No need to qulate the full patch if you ask a question unrelated to the 
comments.]

> Hi i have one question, this patch can be reused or need to create new
> one.

    In case you were asking whether you should repost the updated patch in the 
same thread, the answer is "no". OItgherwise I fail to understand. :-)

MBR, Sergei

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

end of thread, other threads:[~2016-02-07 18:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-07 17:38 [PATCH net v4] r8169: Add EEPROM support and disable MWI on pci express Corcodel Marian
2016-02-07 18:10 ` Sergei Shtylyov
2016-02-07 18:40   ` Corcodel Marian
2016-02-07 18:48     ` Sergei Shtylyov

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