The following diff replaces the use of the RL_FLAG_INVMAR flag checking
in the re_iff() function to know when to do the swapping of the hash
filter values for newer PCIe chipsets with the PCIe flag. No change
for the existing chipsets and eliminates a flag.

Idea from FreeBSD.


This affects the following chipsets RTL8100E, RTL8101E, RTL8102E(L),
RTL8103E, RTL8168, RTL8168C(P), RTL8168D(P).


Index: re.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/re.c,v
retrieving revision 1.112
diff -u -p -r1.112 re.c
--- re.c        18 Jul 2009 13:21:32 -0000      1.112
+++ re.c        18 Jul 2009 13:45:36 -0000
@@ -566,7 +566,7 @@ re_iff(struct rl_softc *sc)
         * parts. This means we have to write the hash pattern in reverse
         * order for those devices.
         */
-       if (sc->rl_flags & RL_FLAG_INVMAR) {
+       if (sc->rl_flags & RL_FLAG_PCIE) {
                CSR_WRITE_4(sc, RL_MAR0, swap32(hashes[1]));
                CSR_WRITE_4(sc, RL_MAR4, swap32(hashes[0]));
        } else {
@@ -816,21 +816,20 @@ re_attach(struct rl_softc *sc, const cha
        case RL_HWREV_8100E_SPIN1:
        case RL_HWREV_8100E_SPIN2:
        case RL_HWREV_8101E:
-               sc->rl_flags |= RL_FLAG_NOJUMBO | RL_FLAG_INVMAR |
-                   RL_FLAG_PHYWAKE;
+               sc->rl_flags |= RL_FLAG_NOJUMBO | RL_FLAG_PHYWAKE;
                break;
        case RL_HWREV_8102E:
        case RL_HWREV_8102EL:
        case RL_HWREV_8103E:
-               sc->rl_flags |= RL_FLAG_NOJUMBO | RL_FLAG_INVMAR |
-                   RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 |
-                   RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD;
+               sc->rl_flags |= RL_FLAG_NOJUMBO | RL_FLAG_PHYWAKE |
+                   RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT |
+                   RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD;
                break;
        case RL_HWREV_8168_SPIN1:
        case RL_HWREV_8168_SPIN2:
        case RL_HWREV_8168_SPIN3:
-               sc->rl_flags |= RL_FLAG_INVMAR | RL_FLAG_PHYWAKE |
-                   RL_FLAG_MACSTAT | RL_FLAG_HWIM;
+               sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_MACSTAT |
+                   RL_FLAG_HWIM;
                break;
        case RL_HWREV_8168C_SPIN2:
                sc->rl_flags |= RL_FLAG_MACSLEEP;
@@ -839,9 +838,9 @@ re_attach(struct rl_softc *sc, const cha
        case RL_HWREV_8168CP:
        case RL_HWREV_8168D:
        case RL_HWREV_8168DP:
-               sc->rl_flags |= RL_FLAG_INVMAR | RL_FLAG_PHYWAKE |
-                   RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT |
-                   RL_FLAG_HWIM | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD;
+               sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR |
+                   RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_HWIM |
+                   RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD;
                /*
                 * These controllers support jumbo frame but it seems
                 * that enabling it requires touching additional magic
Index: rtl81x9reg.h
===================================================================
RCS file: /cvs/src/sys/dev/ic/rtl81x9reg.h,v
retrieving revision 1.65
diff -u -p -r1.65 rtl81x9reg.h
--- rtl81x9reg.h        11 Jul 2009 16:51:58 -0000      1.65
+++ rtl81x9reg.h        18 Jul 2009 13:42:46 -0000
@@ -823,18 +823,17 @@ struct rl_softc {
 #define        RL_FLAG_MSI             0x0001
 #define        RL_FLAG_PCI64           0x0002
 #define        RL_FLAG_PCIE            0x0004
-#define        RL_FLAG_INVMAR          0x0008
-#define        RL_FLAG_PHYWAKE         0x0010
-#define        RL_FLAG_NOJUMBO         0x0020
-#define        RL_FLAG_PAR             0x0040
-#define        RL_FLAG_DESCV2          0x0080
-#define        RL_FLAG_MACSTAT         0x0100
-#define        RL_FLAG_HWIM            0x0200
-#define        RL_FLAG_TIMERINTR       0x0400
-#define        RL_FLAG_MACLDPS         0x0800
-#define        RL_FLAG_CMDSTOP         0x1000
-#define        RL_FLAG_MACSLEEP        0x2000
-#define        RL_FLAG_AUTOPAD         0x4000
+#define        RL_FLAG_PHYWAKE         0x0008
+#define        RL_FLAG_NOJUMBO         0x0010
+#define        RL_FLAG_PAR             0x0020
+#define        RL_FLAG_DESCV2          0x0040
+#define        RL_FLAG_MACSTAT         0x0080
+#define        RL_FLAG_HWIM            0x0100
+#define        RL_FLAG_TIMERINTR       0x0200
+#define        RL_FLAG_MACLDPS         0x0400
+#define        RL_FLAG_CMDSTOP         0x0800
+#define        RL_FLAG_MACSLEEP        0x1000
+#define        RL_FLAG_AUTOPAD         0x2000
 #define        RL_FLAG_LINK            0x8000
 
        u_int16_t               rl_intrs;

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Reply via email to