Hello Guillermo,

On 08/11/15(Sun) 17:06, Guillermo Bernaldo de Quiros Maraver wrote:
> Hi, good afternoon.
> 
> I don't know if this is the correct list to post the next email so, I'm
> sorry if this isn't the correct place.
> 
> My laptop computer wich is an MSI GE70 2QE has a network interface which
> currently it seems to be not supported by -current so I tried to port the
> device driver to OpenBSD based on the driver from FreeBSD which is similar
> and now the network interface is working correctly. Next I paste some
> information about the hardware and the device driver:
> 
> 1º Dmesg:
> alc0 at pci4 dev 0 function 0 "Attansic Technology E2200" rev 0x13: msi,
> address d8:cb:8a:84:db:cc
> atphy0 at alc0 phy 0: F1 10/100/1000 PHY, rev. 9
> 
> 2º Output of ifconfig alc0
>  alc0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> lladdr d8:cb:8a:84:db:cc
> priority: 0
> groups: egress
> media: Ethernet autoselect (1000baseT full-duplex,rxpause,txpause)
> status: active
> inet 192.168.1.7 netmask 0xffffff00 broadcast 192.168.1.255
> 3º full dmesg in the attachment
> 4º cvs diff if_alc.c and cvs diff in the attachments.
> 
> I don't know if you're interested to apply the diff's into base but I think
> that could be a good idea.

Some comments inline.

> alc0: could not disable Rx/Tx MAC(0x40009e00)!

Did you investigate what does that mean?

> Index: if_alc.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_alc.c,v
> retrieving revision 1.35
> diff -u -p -r1.35 if_alc.c
> --- if_alc.c  25 Oct 2015 13:04:28 -0000      1.35
> +++ if_alc.c  8 Nov 2015 16:02:09 -0000
> @@ -120,7 +120,8 @@ const struct pci_matchid alc_devices[] =
>       { PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_L1D },
>       { PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_L1D_1 },
>       { PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_L2C_1 },
> -     { PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_L2C_2 }
> +     { PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_L2C_2 },
> +     { PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_E2200 }
>  };
>  
>  struct cfattach alc_ca = {
> @@ -525,6 +526,7 @@ alc_phy_down(struct alc_softc *sc)
>       switch (sc->sc_product) {
>       case PCI_PRODUCT_ATTANSIC_L1D:
>       case PCI_PRODUCT_ATTANSIC_L1D_1:
> +     case PCI_PRODUCT_ATTANSIC_E2200:
>               /*
>                * GPHY power down caused more problems on AR8151 v2.0.
>                * When driver is reloaded after GPHY power down,
> @@ -783,10 +785,14 @@ alc_attach(struct device *parent, struct
>       case PCI_PRODUCT_ATTANSIC_L1D_1:
>               sc->alc_flags |= ALC_FLAG_APS;
>               /* FALLTHROUGH */
> +     case PCI_PRODUCT_ATTANSIC_E2200:
> +             sc->alc_flags |= ALC_FLAG_AR816X_FAMILY;
> +             break;
>       default:
>               break;
>       }
> -     sc->alc_flags |= ALC_FLAG_ASPM_MON | ALC_FLAG_JUMBO;
> +     //sc->alc_flags |= ALC_FLAG_ASPM_MON | ALC_FLAG_JUMBO;
> +     sc->alc_flags |= ALC_FLAG_JUMBO;

Why did you change this flag?  This cannot be committed as-is if this is
really needed then you could add a conditional statement based on the
product ID.


> @@ -797,6 +803,7 @@ alc_attach(struct device *parent, struct
>       case PCI_PRODUCT_ATTANSIC_L1D_1:
>       case PCI_PRODUCT_ATTANSIC_L2C_1:
>       case PCI_PRODUCT_ATTANSIC_L2C_2:
> +     case PCI_PRODUCT_ATTANSIC_E2200:
>               sc->alc_max_framelen = 6 * 1024;
>               break;
>       }
> @@ -2035,7 +2042,9 @@ alc_reset(struct alc_softc *sc)
>               printf("%s: master reset timeout!\n", sc->sc_dev.dv_xname);
>  
>       for (i = ALC_RESET_TIMEOUT; i > 0; i--) {
> -             if ((reg = CSR_READ_4(sc, ALC_IDLE_STATUS)) == 0)
> +             reg = CSR_READ_4(sc,ALC_IDLE_STATUS);   
> +             if ((reg & (IDLE_STATUS_RXMAC | IDLE_STATUS_TXMAC | 
> +                     IDLE_STATUS_RXQ | IDLE_STATUS_TXQ)) == 0)

Isn't this related to the message in your dmesg?

>                       break;
>               DELAY(10);
>       }
> @@ -2485,6 +2494,7 @@ alc_stop_queue(struct alc_softc *sc)
>               reg &= ~TXQ_CFG_ENB;
>               CSR_WRITE_4(sc, ALC_TXQ_CFG, reg);
>       }
> +     DELAY(40);
>       for (i = ALC_TIMEOUT; i > 0; i--) {
>               reg = CSR_READ_4(sc, ALC_IDLE_STATUS);
>               if ((reg & (IDLE_STATUS_RXQ | IDLE_STATUS_TXQ)) == 0)

> Index: if_alcreg.h
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_alcreg.h,v
> retrieving revision 1.5
> diff -u -p -r1.5 if_alcreg.h
> --- if_alcreg.h       27 Nov 2014 14:52:04 -0000      1.5
> +++ if_alcreg.h       8 Nov 2015 16:05:42 -0000
> @@ -1164,6 +1164,7 @@ struct alc_softc {
>  #define      ALC_FLAG_L0S            0x0400
>  #define      ALC_FLAG_L1S            0x0800
>  #define      ALC_FLAG_APS            0x1000
> +#define ALC_FLAG_AR816X_FAMILY 0x2000        

Please use a tab here, to be coherent with the rest of the defines.

>  #define      ALC_FLAG_DETACH         0x4000
>  #define      ALC_FLAG_LINK           0x8000
>  

Reply via email to