Skip to contentSkip to conversation

r8169: Disable some bits on pcie

PATCH In review Corcodel Marian 3 participants 4 messages Aug 20, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 r8169: Disable some bits on pcie

Disable legacy interrupt on pci express interface use msi
disable some bits from pci express interface wich is not need on this nic.

drivers/net/ethernet/realtek/r8169.c +7 -0
index 6d16de3..b1fb54f 100644
@@ -8164,6 +8164,13 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (!pci_is_pcie(pdev))
 		netif_info(tp, probe, dev, "not PCI Express\n");
 
+	if (pci_is_pcie(pdev))
+		pci_write_config_word(pdev, PCI_COMMAND, ~(PCI_COMMAND_FAST_BACK | PCI_COMMAND_WAIT |
+					PCI_COMMAND_VGA_PALETTE | PCI_COMMAND_INVALIDATE | PCI_COMMAND_SPECIAL));
+
+	if (pci_is_pcie(pdev))
+		pci_intx(pdev, 0);
+
 	/* Identify chip attached to board */
 	rtl8169_get_mac_version(tp, dev, cfg->default_ver);
 
Signature · 1 line
2.1.4
#1 lore raw

Hello.

Quoted 11 lines · Corcodel Marian

Disable legacy interrupt on pci express interface use msi
disable some bits from pci express interface wich is not need on this nic.

drivers/net/ethernet/realtek/r8169.c +0 -0
index 6d16de3..b1fb54f 100644

drivers/net/ethernet/realtek/r8169.c static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · line 8169

Quoted 6 lines
drivers/net/ethernet/realtek/r8169.c +3 -0
@@ -8164,6 +8164,13 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
  	if (!pci_is_pcie(pdev))
  		netif_info(tp, probe, dev, "not PCI Express\n");
 
+	if (pci_is_pcie(pdev))
+		pci_write_config_word(pdev, PCI_COMMAND, ~(PCI_COMMAND_FAST_BACK | PCI_COMMAND_WAIT |
+					PCI_COMMAND_VGA_PALETTE | PCI_COMMAND_INVALIDATE | PCI_COMMAND_SPECIAL));

Please start the continuation line under 'pdev' on the first line.

drivers/net/ethernet/realtek/r8169.c static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · line 8173

Quoted 4 lines
drivers/net/ethernet/realtek/r8169.c +4 -0
+
+	if (pci_is_pcie(pdev))
+		pci_intx(pdev, 0);
+

Why two identical *if* statements? Please make it one.

MBR, Sergei

#2 lore raw
Quoted 16 lines · Sergei Shtylyov
Quoted 16 lines

Disable legacy interrupt on pci express interface use msi
disable some bits from pci express interface wich is not need on this nic.

drivers/net/ethernet/realtek/r8169.c +0 -0
index 6d16de3..b1fb54f 100644
@@ -8164,6 +8164,13 @@ static int rtl_init_one(struct pci_dev *pdev, const
 struct pci_device_id *ent)
      if (!pci_is_pcie(pdev))
          netif_info(tp, probe, dev, "not PCI Express\n");
 
Quoted 7 lines
Quoted 5 lines
drivers/net/ethernet/realtek/r8169.c +2 -0
+    if (pci_is_pcie(pdev))
+        pci_write_config_word(pdev, PCI_COMMAND, ~(PCI_COMMAND_FAST_BACK |

PCI_COMMAND_WAIT |
+ PCI_COMMAND_VGA_PALETTE | PCI_COMMAND_INVALIDATE |
PCI_COMMAND_SPECIAL));

Please start the continuation line under 'pdev' on the first line.

Can all those bits indeed be set for a networking device?
PCI_COMMAND_VGA_PALETTE is the most incredible...

Quoted 6 lines

drivers/net/ethernet/realtek/r8169.c static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · line 8173

Quoted 4 lines
drivers/net/ethernet/realtek/r8169.c +4 -0
+
+    if (pci_is_pcie(pdev))
+        pci_intx(pdev, 0);
+

Why two identical *if* statements? Please make it one.

Ah, I missed the *if* at the top. You need just an *else* clause here.

MBR, Sergei

#3 lore raw
In reply to Corcodel Marian
Quoted 14 lines · Corcodel Marian

Disable legacy interrupt on pci express interface use msi
disable some bits from pci express interface wich is not need on this nic.

drivers/net/ethernet/realtek/r8169.c +0 -0
index 6d16de3..b1fb54f 100644
@@ -8164,6 +8164,13 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (!pci_is_pcie(pdev))
 		netif_info(tp, probe, dev, "not PCI Express\n");
 

drivers/net/ethernet/realtek/r8169.c static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · line 8176

Quoted 10 lines
drivers/net/ethernet/realtek/r8169.c +7 -0
+	if (pci_is_pcie(pdev))
+		pci_write_config_word(pdev, PCI_COMMAND, ~(PCI_COMMAND_FAST_BACK | PCI_COMMAND_WAIT |
+					PCI_COMMAND_VGA_PALETTE | PCI_COMMAND_INVALIDATE | PCI_COMMAND_SPECIAL));
+
+	if (pci_is_pcie(pdev))
+		pci_intx(pdev, 0);
+
 	/* Identify chip attached to board */
 	rtl8169_get_mac_version(tp, dev, cfg->default_ver);
 

Why is it needed ?

PCI_COMMAND_VGA_PALETTE is never used in a networking driver, why should we eventually take care ?

What exact problem are you solving ?

We wont accept a patch without a clear description, given all the crap you have sent.