* [PATCH net v3.16]r8169: Not enable/disable bus mastering when is enabled on BIOS
@ 2016-03-12 6:33 Corcodel Marian
2016-03-12 9:44 ` Francois Romieu
2016-03-12 19:09 ` Sergei Shtylyov
0 siblings, 2 replies; 5+ messages in thread
From: Corcodel Marian @ 2016-03-12 6:33 UTC (permalink / raw)
To: netdev; +Cc: Francois Romieu, Corcodel Marian
This patch not enable/disable bus mastering when is enabled on BIOS..
pci_disable_device function also disable bus mastering for, disable bus mastering
is dedicate function.
Signed-off-by: Corcodel Marian <asd@marian1000.go.ro>
---
drivers/net/ethernet/realtek/r8169.c | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 02aec96..ec555e7 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -754,6 +754,7 @@ struct rtl8169_private {
struct timer_list timer;
u16 cp_cmd;
bool pcie;
+ bool bios_support;
u16 event_slow;
@@ -3718,13 +3719,27 @@ static void rtl8169_phy_timer(unsigned long __opaque)
rtl_schedule_task(tp, RTL_FLAG_TASK_PHY_PENDING);
}
+static void rtl_disable_device (struct pci_dev *pdev)
+{
+ dev_WARN_ONCE(&pdev->dev, atomic_read(&pdev->enable_cnt) <= 0,
+ "disabling already-disabled device");
+
+ if (atomic_dec_return(&pdev->enable_cnt) != 0)
+ return;
+}
+
static void rtl8169_release_board(struct pci_dev *pdev, struct net_device *dev,
void __iomem *ioaddr)
{
+ struct rtl8169_private *tp = netdev_priv(dev);
+
iounmap(ioaddr);
pci_release_regions(pdev);
pci_clear_mwi(pdev);
- pci_disable_device(pdev);
+ if (!tp->bios_support)
+ pci_disable_device(pdev);
+ else
+ rtl_disable_device(pdev);
free_netdev(dev);
}
@@ -6779,7 +6794,8 @@ static void rtl_wol_shutdown_quirk(struct rtl8169_private *tp)
case RTL_GIGA_MAC_VER_11:
case RTL_GIGA_MAC_VER_12:
case RTL_GIGA_MAC_VER_17:
- pci_clear_master(tp->pci_dev);
+ if (!tp->bios_support)
+ pci_clear_master(tp->pci_dev);
RTL_W8(ChipCmd, CmdRxEnb);
/* PCI commit */
@@ -6996,6 +7012,7 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
void __iomem *ioaddr;
int chipset, i;
int rc;
+ u16 cmd;
if (netif_msg_drv(&debug)) {
printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n",
@@ -7103,7 +7120,13 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
rtl_ack_events(tp, 0xffff);
- pci_set_master(pdev);
+ pci_read_config_word(pdev, PCI_COMMAND, &cmd);
+ if (cmd & PCI_COMMAND_MASTER)
+ tp->bios_support = true;
+ else {
+ tp->bios_support = false;
+ pci_set_master(pdev);
+ }
/*
* Pretend we are using VLANs; This bypasses a nasty bug where
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net v3.16]r8169: Not enable/disable bus mastering when is enabled on BIOS
2016-03-12 6:33 [PATCH net v3.16]r8169: Not enable/disable bus mastering when is enabled on BIOS Corcodel Marian
@ 2016-03-12 9:44 ` Francois Romieu
2016-03-12 10:48 ` Corcodel Marian
2016-03-12 19:09 ` Sergei Shtylyov
1 sibling, 1 reply; 5+ messages in thread
From: Francois Romieu @ 2016-03-12 9:44 UTC (permalink / raw)
To: Corcodel Marian; +Cc: netdev
Corcodel Marian <asd@marian1000.go.ro> :
> This patch not enable/disable bus mastering when is enabled on BIOS..
It bloats the driver without any benefit.
--
Ueimor
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v3.16]r8169: Not enable/disable bus mastering when is enabled on BIOS
2016-03-12 9:44 ` Francois Romieu
@ 2016-03-12 10:48 ` Corcodel Marian
2016-03-12 12:15 ` Francois Romieu
0 siblings, 1 reply; 5+ messages in thread
From: Corcodel Marian @ 2016-03-12 10:48 UTC (permalink / raw)
To: Francois Romieu; +Cc: netdev
On Sat, 12 Mar 2016 10:44:01 +0100
Francois Romieu <romieu@fr.zoreil.com> wrote:
> Corcodel Marian <asd@marian1000.go.ro> :
> > This patch not enable/disable bus mastering when is enabled on
> > BIOS..
>
> It bloats the driver without any benefit.
>
For mee this patch is very important , decrease time to autonegociation
and start nic on full speed alltimes.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v3.16]r8169: Not enable/disable bus mastering when is enabled on BIOS
2016-03-12 10:48 ` Corcodel Marian
@ 2016-03-12 12:15 ` Francois Romieu
0 siblings, 0 replies; 5+ messages in thread
From: Francois Romieu @ 2016-03-12 12:15 UTC (permalink / raw)
To: Corcodel Marian; +Cc: netdev
Corcodel Marian <asd@marian1000.go.ro> :
[...]
> For mee this patch is very important , decrease time to autonegociation
> and start nic on full speed alltimes.
Really ? The commit message did not tell much about it.
How much did time decrease ? How did you measure it ?
Against which chipset(s) ?
On which motherboard ?
How does it behave on current kernel ?
How many different patches are you testing at the same time ?
Who was able to reproduce it ?
How do you explain it ?
--
Ueimor
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v3.16]r8169: Not enable/disable bus mastering when is enabled on BIOS
2016-03-12 6:33 [PATCH net v3.16]r8169: Not enable/disable bus mastering when is enabled on BIOS Corcodel Marian
2016-03-12 9:44 ` Francois Romieu
@ 2016-03-12 19:09 ` Sergei Shtylyov
1 sibling, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2016-03-12 19:09 UTC (permalink / raw)
To: Corcodel Marian, netdev; +Cc: Francois Romieu
Hello.
On 03/12/2016 09:33 AM, Corcodel Marian wrote:
> This patch not enable/disable bus mastering when is enabled on BIOS..
> pci_disable_device function also disable bus mastering for, disable bus mastering
> is dedicate function.
>
> Signed-off-by: Corcodel Marian <asd@marian1000.go.ro>
> ---
> drivers/net/ethernet/realtek/r8169.c | 29 ++++++++++++++++++++++++++---
> 1 file changed, 26 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
> index 02aec96..ec555e7 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
[...]
> @@ -7103,7 +7120,13 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>
> rtl_ack_events(tp, 0xffff);
>
> - pci_set_master(pdev);
> + pci_read_config_word(pdev, PCI_COMMAND, &cmd);
> + if (cmd & PCI_COMMAND_MASTER)
> + tp->bios_support = true;
> + else {
Documentation/CodingStyle requites {} on all branches of the *if*
statement if at least one branch has them.
> + tp->bios_support = false;
> + pci_set_master(pdev);
> + }
>
> /*
> * Pretend we are using VLANs; This bypasses a nasty bug where
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-03-12 19:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-12 6:33 [PATCH net v3.16]r8169: Not enable/disable bus mastering when is enabled on BIOS Corcodel Marian
2016-03-12 9:44 ` Francois Romieu
2016-03-12 10:48 ` Corcodel Marian
2016-03-12 12:15 ` Francois Romieu
2016-03-12 19:09 ` Sergei Shtylyov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.