Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2019 23:30:46 +0300
From:      Sergey Kandaurov <pluknet@gmail.com>
To:        Gleb Smirnoff <glebius@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r353848 - head/sys/dev/jme
Message-ID:  <CAE-mSOLZzZE3Hhxg1_LJjntB=0yROULQ5%2BEFeQ5KxLEYpmgPVQ@mail.gmail.com>
In-Reply-To: <201910211811.x9LIBhea069573@repo.freebsd.org>
References:  <201910211811.x9LIBhea069573@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
=D0=BF=D0=BD, 21 =D0=BE=D0=BA=D1=82. 2019 =D0=B3. =D0=B2 21:14, Gleb Smirno=
ff <glebius@freebsd.org>:

> Author: glebius
> Date: Mon Oct 21 18:11:43 2019
> New Revision: 353848
> URL: https://svnweb.freebsd.org/changeset/base/353848
>
> Log:
>   Convert to if_foreach_llmaddr() KPI.
>
> Modified:
>   head/sys/dev/jme/if_jme.c
>
> Modified: head/sys/dev/jme/if_jme.c
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/dev/jme/if_jme.c   Mon Oct 21 18:11:38 2019        (r353847)
> +++ head/sys/dev/jme/if_jme.c   Mon Oct 21 18:11:43 2019        (r353848)
> @@ -3236,12 +3236,26 @@ jme_set_vlan(struct jme_softc *sc)
>         CSR_WRITE_4(sc, JME_RXMAC, reg);
>  }
>
> +static u_int
> +jme_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
> +{
> +       uint32_t crc, *mchash =3D arg;
> +
> +       crc =3D ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN);
> +
> +       /* Just want the 6 least significant bits. */
> +       crc &=3D 0x3f;
> +
> +       /* Set the corresponding bit in the hash table. */
> +       mchash[crc >> 5] |=3D 1 << (crc & 0x1f);
> +
> +       return (1);
> +}
> +
>  static void
>  jme_set_filter(struct jme_softc *sc)
>  {
>         struct ifnet *ifp;
> -       struct ifmultiaddr *ifma;
> -       uint32_t crc;
>         uint32_t mchash[2];
>         uint32_t rxcfg;
>
> @@ -3276,21 +3290,7 @@ jme_set_filter(struct jme_softc *sc)
>          */
>         rxcfg |=3D RXMAC_MULTICAST;
>         bzero(mchash, sizeof(mchash));
> -
> -       if_maddr_rlock(ifp);
> -       CK_STAILQ_FOREACH(ifma, &sc->jme_ifp->if_multiaddrs, ifma_link) {
> -               if (ifma->ifma_addr->sa_family !=3D AF_LINK)
> -                       continue;
> -               crc =3D ether_crc32_be(LLADDR((struct sockaddr_dl *)
> -                   ifma->ifma_addr), ETHER_ADDR_LEN);
> -
> -               /* Just want the 6 least significant bits. */
> -               crc &=3D 0x3f;
> -
> -               /* Set the corresponding bit in the hash table. */
> -               mchash[crc >> 5] |=3D 1 << (crc & 0x1f);
> -       }
> -       if_maddr_runlock(ifp);
> +       if_foreach_llmaddr(ifp, jme_hash_maddr, &mchash);
>

Should not be there just =E2=80=9Cmchash=E2=80=9D?
You seems to be passing (uint32_t **),
also in tsec.


>         CSR_WRITE_4(sc, JME_MAR0, mchash[0]);
>         CSR_WRITE_4(sc, JME_MAR1, mchash[1]);
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAE-mSOLZzZE3Hhxg1_LJjntB=0yROULQ5%2BEFeQ5KxLEYpmgPVQ>