svn commit: r342029 - head
Author: dim Date: Thu Dec 13 06:59:55 2018 New Revision: 342029 URL: https://svnweb.freebsd.org/changeset/base/342029 Log: Fix dates that I set into the future incorrectly. Noticed by: ler Modified: head/ObsoleteFiles.inc head/UPDATING Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Thu Dec 13 06:51:20 2018(r342028) +++ head/ObsoleteFiles.inc Thu Dec 13 06:59:55 2018(r342029) @@ -38,7 +38,7 @@ # xargs -n1 | sort | uniq -d; # done -# 20181218: new clang import which bumps version from 6.0.1 to 7.0.1. +# 20181211: new clang import which bumps version from 6.0.1 to 7.0.1. OLD_FILES+=usr/lib/clang/6.0.1/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/6.0.1/include/sanitizer/asan_interface.h OLD_FILES+=usr/lib/clang/6.0.1/include/sanitizer/common_interface_defs.h Modified: head/UPDATING == --- head/UPDATING Thu Dec 13 06:51:20 2018(r342028) +++ head/UPDATING Thu Dec 13 06:59:55 2018(r342029) @@ -31,7 +31,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) -20181218: +20181211: Clang, llvm, lld, lldb, compiler-rt and libc++ have been upgraded to 7.0.1. Please see the 20141231 entry below for information about prerequisites and upgrading, if you are not already using clang 3.5.0 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r342009 - head/secure/lib/libcrypto
Jung-uk Kim wrote: Author: jkim Date: Wed Dec 12 21:56:47 2018 New Revision: 342009 URL: https://svnweb.freebsd.org/changeset/base/342009 Log: Enable devcryptoeng for OpenSSL. Since OpenSSL 1.1.1, the good old BSD-specific cryptodev engine has been deprecated in favor of this new engine. However, this engine is not throughly tested on FreeBSD because it was originally written for Linux. http://cryptodev-linux.org/ Also, the author actually meant to enable it by default on BSD platforms but he failed to do so because there was a bug in the Configure script. https://github.com/openssl/openssl/pull/7882 Now they found that it was more generic issue. https://github.com/openssl/openssl/pull/7885 Therefore, we need to enable this engine on head to give it more exposure. Modified: head/secure/lib/libcrypto/Makefile head/secure/lib/libcrypto/opensslconf.h.in Modified: head/secure/lib/libcrypto/Makefile == --- head/secure/lib/libcrypto/Makefile Wed Dec 12 21:56:45 2018 (r342008) +++ head/secure/lib/libcrypto/Makefile Wed Dec 12 21:56:47 2018 (r342009) @@ -192,8 +192,8 @@ SRCS+= ecp_nistz256-x86.S ecp_nistz256.c .endif # engine -SRCS+= eng_all.c eng_cnf.c eng_ctrl.c eng_dyn.c eng_err.c eng_fat.c -SRCS+= eng_init.c eng_lib.c eng_list.c eng_openssl.c eng_pkey.c +SRCS+= eng_all.c eng_cnf.c eng_ctrl.c eng_devcrypto.c eng_dyn.c eng_err.c +SRCS+= eng_fat.c eng_init.c eng_lib.c eng_list.c eng_openssl.c eng_pkey.c SRCS+=eng_rdrand.c eng_table.c tb_asnmth.c tb_cipher.c tb_dh.c tb_digest.c SRCS+=tb_dsa.c tb_eckey.c tb_pkmeth.c tb_rand.c tb_rsa.c Modified: head/secure/lib/libcrypto/opensslconf.h.in == --- head/secure/lib/libcrypto/opensslconf.h.in Wed Dec 12 21:56:45 2018 (r342008) +++ head/secure/lib/libcrypto/opensslconf.h.in Wed Dec 12 21:56:47 2018 (r342009) @@ -46,9 +46,6 @@ extern "C" { #ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE # define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE #endif -#ifndef OPENSSL_NO_DEVCRYPTOENG -# define OPENSSL_NO_DEVCRYPTOENG -#endif #ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 # define OPENSSL_NO_EC_NISTP_64_GCC_128 #endif I'm now getting "Could not open /dev/crypto: No such file or directory" from every other utility unless cryptodev is loaded; given that it's not in GENERIC, this is somewhat unexpected change in behavior. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342026 - head/sys/powerpc/include
Author: jhibbits Date: Thu Dec 13 05:07:39 2018 New Revision: 342026 URL: https://svnweb.freebsd.org/changeset/base/342026 Log: powerpc/booke: Change KERNBASE to be physical load address Previous commits have made VM_MIN_KERNEL_ADDRESS its own separate entity, and rebased the kernel around that address instead of KERNBASE. This commit pulls the trigger to rebase KERNBASE to a physical load address. The eventual goal is to align the address with the AIM KERNBASE, but at this time that's not an option. Currently a Book-E kernel must be loaded on a 64MB boundary, due to size issues. The common load address is at the 64MB mark (0x0400), so simply make that the default KERNBASE. As of this commit, Book-E kernels can be loaded and booted with ubldr. MFC after:3 weeks Modified: head/sys/powerpc/include/vmparam.h Modified: head/sys/powerpc/include/vmparam.h == --- head/sys/powerpc/include/vmparam.h Thu Dec 13 04:48:28 2018 (r342025) +++ head/sys/powerpc/include/vmparam.h Thu Dec 13 05:07:39 2018 (r342026) @@ -133,16 +133,9 @@ #else /* Book-E */ -#ifdef __powerpc64__ -#ifndef LOCORE -#defineKERNBASE0xe100UL/* start of kernel virtual */ -#else -#defineKERNBASE0xe100 /* start of kernel virtual */ -#endif -#else -#defineKERNBASE0xc000 /* start of kernel virtual */ - -#defineVM_MIN_KERNEL_ADDRESS KERNBASE +#defineKERNBASE0x04000100 /* start of kernel physical */ +#ifndef __powerpc64__ +#defineVM_MIN_KERNEL_ADDRESS 0xc000 #defineVM_MAX_KERNEL_ADDRESS 0xefff #defineVM_MAX_SAFE_KERNEL_ADDRESS VM_MAX_KERNEL_ADDRESS #endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342025 - head/sys/powerpc/booke
Author: jhibbits Date: Thu Dec 13 04:48:28 2018 New Revision: 342025 URL: https://svnweb.freebsd.org/changeset/base/342025 Log: powerpcspe: Fix GPR handling in SPE exception handler Optimize the exception handler to only save and load the upper word of the GPRs used in the emulating instruction. This reduces the save/load overhead, and as a side effect does not overwrite the upper word of any temporary register. With this commit I am now able to run editors/abiword and math/gnumeric on a e500-based system. MFC after:1 week MFC With: r341752,r341751 Modified: head/sys/powerpc/booke/spe.c Modified: head/sys/powerpc/booke/spe.c == --- head/sys/powerpc/booke/spe.cThu Dec 13 04:40:53 2018 (r342024) +++ head/sys/powerpc/booke/spe.cThu Dec 13 04:48:28 2018 (r342025) @@ -66,7 +66,6 @@ save_vec_int(struct thread *td) */ msr = mfmsr(); mtmsr(msr | PSL_VEC); - isync(); /* * Save the vector registers and SPEFSCR to the PCB @@ -419,6 +418,52 @@ spe_explode(struct fpemu *fe, struct fpn *fp, uint32_t return (0); } +/* + * Save the high word of a 64-bit GPR for manipulation in the exception handler. + */ +static uint32_t +spe_save_reg_high(int reg) +{ + uint32_t vec[2]; +#define EVSTDW(n) case n: __asm ("evstdw %1,0(%0)" \ + :: "b"(vec), "n"(n)); break; + switch (reg) { + EVSTDW(0); EVSTDW(1); EVSTDW(2); EVSTDW(3); + EVSTDW(4); EVSTDW(5); EVSTDW(6); EVSTDW(7); + EVSTDW(8); EVSTDW(9); EVSTDW(10); EVSTDW(11); + EVSTDW(12); EVSTDW(13); EVSTDW(14); EVSTDW(15); + EVSTDW(16); EVSTDW(17); EVSTDW(18); EVSTDW(19); + EVSTDW(20); EVSTDW(21); EVSTDW(22); EVSTDW(23); + EVSTDW(24); EVSTDW(25); EVSTDW(26); EVSTDW(27); + EVSTDW(28); EVSTDW(29); EVSTDW(30); EVSTDW(31); + } +#undef EVSTDW + + return (vec[0]); +} + +/* + * Load the given value into the high word of the requested register. + */ +static void +spe_load_reg_high(int reg, uint32_t val) +{ +#defineEVLDW(n) case n: __asm __volatile("evmergelo "#n",%0,0," \ + :: "r"(val)); break; + switch (reg) { + EVLDW(1); EVLDW(2); EVLDW(3); EVLDW(4); + EVLDW(5); EVLDW(6); EVLDW(7); EVLDW(8); + EVLDW(9); EVLDW(10); EVLDW(11); EVLDW(12); + EVLDW(13); EVLDW(14); EVLDW(15); EVLDW(16); + EVLDW(17); EVLDW(18); EVLDW(19); EVLDW(20); + EVLDW(21); EVLDW(22); EVLDW(23); EVLDW(24); + EVLDW(25); EVLDW(26); EVLDW(27); EVLDW(28); + EVLDW(29); EVLDW(30); EVLDW(31); EVLDW(0); + } +#undef EVLDW + +} + void spe_handle_fpdata(struct trapframe *frame) { @@ -426,11 +471,12 @@ spe_handle_fpdata(struct trapframe *frame) struct fpn *result; uint32_t instr, instr_sec_op; uint32_t cr_shift, ra, rb, rd, src; - uint32_t high, low, res; /* For vector operations. */ + uint32_t high, low, res, tmp; /* For vector operations. */ uint32_t spefscr = 0; uint32_t ftod_res[2]; int width; /* Single, Double, Vector, Integer */ int err; + uint32_t msr; err = fueword32((void *)frame->srr0, ); @@ -441,6 +487,7 @@ spe_handle_fpdata(struct trapframe *frame) if ((instr >> OPC_SHIFT) != SPE_OPC) return; + msr = mfmsr(); /* * 'cr' field is the upper 3 bits of rd. Magically, since a) rd is 5 * bits, b) each 'cr' field is 4 bits, and c) Only the 'GT' bit is @@ -460,32 +507,35 @@ spe_handle_fpdata(struct trapframe *frame) width = NONE; switch (src) { case SPE: - save_vec_nodrop(curthread); + mtmsr(msr | PSL_VEC); switch (instr_sec_op) { case EVFSABS: - curthread->td_pcb->pcb_vec.vr[rd][0] = - curthread->td_pcb->pcb_vec.vr[ra][0] & ~(1U << 31); + high = spe_save_reg_high(ra) & ~(1U << 31); frame->fixreg[rd] = frame->fixreg[ra] & ~(1U << 31); + spe_load_reg_high(rd, high); break; case EVFSNABS: - curthread->td_pcb->pcb_vec.vr[rd][0] = - curthread->td_pcb->pcb_vec.vr[ra][0] | (1U << 31); + high = spe_save_reg_high(ra) | (1U << 31); frame->fixreg[rd] = frame->fixreg[ra] | (1U << 31); + spe_load_reg_high(rd, high); break; case EVFSNEG: - curthread->td_pcb->pcb_vec.vr[rd][0] = -
svn commit: r342024 - in head/sys: crypto/aesni opencrypto
Author: mmacy Date: Thu Dec 13 04:40:53 2018 New Revision: 342024 URL: https://svnweb.freebsd.org/changeset/base/342024 Log: Generalize AES iov optimization Right now, aesni_cipher_alloc does a bit of special-casing for CRYPTO_F_IOV, to not do any allocation if the first uio is large enough for the requested size. While working on ZFS crypto port, I ran into horrible performance because the code uses scatter-gather, and many of the times the data to encrypt was in the second entry. This code looks through the list, and tries to see if there is a single uio that can contain the requested data, and, if so, uses that. This has a slight impact on the current consumers, in that the check is a little more complicated for the ones that use CRYPTO_F_IOV -- but none of them meet the criteria for testing more than one. Submitted by: sef at ixsystems.com Reviewed by: cem@ MFC after:3 days Sponsored by: iX Systems Differential Revision:https://reviews.freebsd.org/D18522 Modified: head/sys/crypto/aesni/aesni.c head/sys/opencrypto/criov.c head/sys/opencrypto/cryptodev.h Modified: head/sys/crypto/aesni/aesni.c == --- head/sys/crypto/aesni/aesni.c Thu Dec 13 03:12:15 2018 (r342023) +++ head/sys/crypto/aesni/aesni.c Thu Dec 13 04:40:53 2018 (r342024) @@ -403,29 +403,14 @@ static uint8_t * aesni_cipher_alloc(struct cryptodesc *enccrd, struct cryptop *crp, bool *allocated) { - struct mbuf *m; - struct uio *uio; - struct iovec *iov; uint8_t *addr; - if (crp->crp_flags & CRYPTO_F_IMBUF) { - m = (struct mbuf *)crp->crp_buf; - if (m->m_next != NULL) - goto alloc; - addr = mtod(m, uint8_t *); - } else if (crp->crp_flags & CRYPTO_F_IOV) { - uio = (struct uio *)crp->crp_buf; - if (uio->uio_iovcnt != 1) - goto alloc; - iov = uio->uio_iov; - addr = (uint8_t *)iov->iov_base; - } else - addr = (uint8_t *)crp->crp_buf; - *allocated = false; - addr += enccrd->crd_skip; - return (addr); - -alloc: + addr = crypto_contiguous_subsegment(crp->crp_flags, + crp->crp_buf, enccrd->crd_skip, enccrd->crd_len); + if (addr != NULL) { + *allocated = false; + return (addr); + } addr = malloc(enccrd->crd_len, M_AESNI, M_NOWAIT); if (addr != NULL) { *allocated = true; Modified: head/sys/opencrypto/criov.c == --- head/sys/opencrypto/criov.c Thu Dec 13 03:12:15 2018(r342023) +++ head/sys/opencrypto/criov.c Thu Dec 13 04:40:53 2018(r342024) @@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include @@ -239,3 +241,55 @@ crypto_mbuftoiov(struct mbuf *mbuf, struct iovec **iov *cnt = i; return 0; } + +static inline void * +m_contiguous_subsegment(struct mbuf *m, size_t skip, size_t len) +{ + int rel_off; + + MPASS(skip <= INT_MAX); + + m = m_getptr(m, (int)skip, _off); + if (m == NULL) + return (NULL); + + MPASS(rel_off >= 0); + skip = rel_off; + if (skip + len > m->m_len) + return (NULL); + + return (mtod(m, char*) + skip); +} + +static inline void * +cuio_contiguous_segment(struct uio *uio, size_t skip, size_t len) +{ + int rel_off, idx; + + MPASS(skip <= INT_MAX); + idx = cuio_getptr(uio, (int)skip, _off); + if (idx < 0) + return (NULL); + + MPASS(rel_off >= 0); + skip = rel_off; + if (skip + len > uio->uio_iov[idx].iov_len) + return (NULL); + return ((char *)uio->uio_iov[idx].iov_base + skip); +} + +void * +crypto_contiguous_subsegment(int crp_flags, void *crpbuf, +size_t skip, size_t len) +{ + if ((crp_flags & CRYPTO_F_IMBUF) != 0) + return (m_contiguous_subsegment(crpbuf, skip, len)); + else if ((crp_flags & CRYPTO_F_IOV) != 0) + return (cuio_contiguous_segment(crpbuf, skip, len)); + else { + MPASS((crp_flags & (CRYPTO_F_IMBUF | CRYPTO_F_IOV)) != + (CRYPTO_F_IMBUF | CRYPTO_F_IOV)); + return ((char*)crpbuf + skip); + } +} + Modified: head/sys/opencrypto/cryptodev.h == --- head/sys/opencrypto/cryptodev.h Thu Dec 13 03:12:15 2018 (r342023) +++ head/sys/opencrypto/cryptodev.h Thu Dec 13 04:40:53 2018 (r342024) @@ -564,5 +564,7 @@ extern void crypto_copydata(int flags, caddr_t buf, in extern int crypto_apply(int flags, caddr_t buf, int off, int len, int
svn commit: r342023 - in stable: 10/contrib/ipfilter/ipsend 10/sys/contrib/ipfilter/netinet 11/contrib/ipfilter/ipsend 11/sys/contrib/ipfilter/netinet 12/contrib/ipfilter/ipsend 12/sys/contrib/ipfi...
Author: cy Date: Thu Dec 13 03:12:15 2018 New Revision: 342023 URL: https://svnweb.freebsd.org/changeset/base/342023 Log: MFC r341650: Remove an ugly Ultrix hack. Ultrix has been AWOL since the last ice age, more to come. Modified: stable/12/contrib/ipfilter/ipsend/ip.c stable/12/contrib/ipfilter/ipsend/resend.c stable/12/sys/contrib/ipfilter/netinet/ip_compat.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/ipfilter/ipsend/ip.c stable/10/contrib/ipfilter/ipsend/resend.c stable/10/sys/contrib/ipfilter/netinet/ip_compat.h stable/11/contrib/ipfilter/ipsend/ip.c stable/11/contrib/ipfilter/ipsend/resend.c stable/11/sys/contrib/ipfilter/netinet/ip_compat.h Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/contrib/ipfilter/ipsend/ip.c == --- stable/12/contrib/ipfilter/ipsend/ip.c Thu Dec 13 00:42:26 2018 (r342022) +++ stable/12/contrib/ipfilter/ipsend/ip.c Thu Dec 13 03:12:15 2018 (r342023) @@ -67,9 +67,9 @@ int send_ether(nfd, buf, len, gwip) bcopy((char *)buf, s + sizeof(*eh), len); if (gwip.s_addr == last_gw.s_addr) { - bcopy(last_arp, (char *)A_A eh->ether_dhost, 6); + bcopy(last_arp, (char *) >ether_dhost, 6); } - else if (arp((char *), (char *)A_A eh->ether_dhost) == -1) + else if (arp((char *), (char *) >ether_dhost) == -1) { perror("arp"); return -2; @@ -109,17 +109,17 @@ int send_ip(nfd, mtu, ip, gwip, frag) eh = (ether_header_t *)ipbuf; - bzero((char *)A_A eh->ether_shost, sizeof(eh->ether_shost)); + bzero((char *) >ether_shost, sizeof(eh->ether_shost)); if (last_gw.s_addr && (gwip.s_addr == last_gw.s_addr)) { - bcopy(last_arp, (char *)A_A eh->ether_dhost, 6); + bcopy(last_arp, (char *) >ether_dhost, 6); } - else if (arp((char *), (char *)A_A eh->ether_dhost) == -1) + else if (arp((char *), (char *) >ether_dhost) == -1) { perror("arp"); return -2; } - bcopy((char *)A_A eh->ether_dhost, last_arp, sizeof(last_arp)); + bcopy((char *) >ether_dhost, last_arp, sizeof(last_arp)); eh->ether_type = htons(ETHERTYPE_IP); bcopy((char *)ip, (char *), sizeof(*ip)); @@ -136,11 +136,11 @@ int send_ip(nfd, mtu, ip, gwip, frag) } if (ip->ip_src.s_addr != local_ip.s_addr) { - (void) arp((char *)>ip_src, (char *)A_A local_arp); - bcopy(local_arp, (char *)A_A eh->ether_shost,sizeof(last_arp)); + (void) arp((char *)>ip_src, (char *) _arp); + bcopy(local_arp, (char *) >ether_shost,sizeof(last_arp)); local_ip = ip->ip_src; } else - bcopy(local_arp, (char *)A_A eh->ether_shost, 6); + bcopy(local_arp, (char *) >ether_shost, 6); if (!frag || (sizeof(*eh) + iplen < mtu)) { Modified: stable/12/contrib/ipfilter/ipsend/resend.c == --- stable/12/contrib/ipfilter/ipsend/resend.c Thu Dec 13 00:42:26 2018 (r342022) +++ stable/12/contrib/ipfilter/ipsend/resend.c Thu Dec 13 03:12:15 2018 (r342023) @@ -97,7 +97,7 @@ int ip_resend(dev, mtu, r, gwip, datain) return -2; } - bzero((char *)A_A eh->ether_shost, sizeof(eh->ether_shost)); + bzero((char *) >ether_shost, sizeof(eh->ether_shost)); if (gwip.s_addr && (arp((char *), dhost) == -1)) { perror("arp"); @@ -113,12 +113,12 @@ int ip_resend(dev, mtu, r, gwip, datain) eh->ether_type = htons((u_short)ETHERTYPE_IP); if (!gwip.s_addr) { if (arp((char *), - (char *)A_A eh->ether_dhost) == -1) { + (char *) >ether_dhost) == -1) { perror("arp"); continue; } } else - bcopy(dhost, (char *)A_A eh->ether_dhost, + bcopy(dhost, (char *) >ether_dhost, sizeof(dhost)); if (!ip->ip_sum) ip->ip_sum = chksum((u_short *)ip, Modified: stable/12/sys/contrib/ipfilter/netinet/ip_compat.h == --- stable/12/sys/contrib/ipfilter/netinet/ip_compat.h Thu Dec 13 00:42:26 2018(r342022) +++
svn commit: r342023 - in stable: 10/contrib/ipfilter/ipsend 10/sys/contrib/ipfilter/netinet 11/contrib/ipfilter/ipsend 11/sys/contrib/ipfilter/netinet 12/contrib/ipfilter/ipsend 12/sys/contrib/ipfi...
Author: cy Date: Thu Dec 13 03:12:15 2018 New Revision: 342023 URL: https://svnweb.freebsd.org/changeset/base/342023 Log: MFC r341650: Remove an ugly Ultrix hack. Ultrix has been AWOL since the last ice age, more to come. Modified: stable/11/contrib/ipfilter/ipsend/ip.c stable/11/contrib/ipfilter/ipsend/resend.c stable/11/sys/contrib/ipfilter/netinet/ip_compat.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/ipfilter/ipsend/ip.c stable/10/contrib/ipfilter/ipsend/resend.c stable/10/sys/contrib/ipfilter/netinet/ip_compat.h stable/12/contrib/ipfilter/ipsend/ip.c stable/12/contrib/ipfilter/ipsend/resend.c stable/12/sys/contrib/ipfilter/netinet/ip_compat.h Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/contrib/ipfilter/ipsend/ip.c == --- stable/11/contrib/ipfilter/ipsend/ip.c Thu Dec 13 00:42:26 2018 (r342022) +++ stable/11/contrib/ipfilter/ipsend/ip.c Thu Dec 13 03:12:15 2018 (r342023) @@ -67,9 +67,9 @@ int send_ether(nfd, buf, len, gwip) bcopy((char *)buf, s + sizeof(*eh), len); if (gwip.s_addr == last_gw.s_addr) { - bcopy(last_arp, (char *)A_A eh->ether_dhost, 6); + bcopy(last_arp, (char *) >ether_dhost, 6); } - else if (arp((char *), (char *)A_A eh->ether_dhost) == -1) + else if (arp((char *), (char *) >ether_dhost) == -1) { perror("arp"); return -2; @@ -109,17 +109,17 @@ int send_ip(nfd, mtu, ip, gwip, frag) eh = (ether_header_t *)ipbuf; - bzero((char *)A_A eh->ether_shost, sizeof(eh->ether_shost)); + bzero((char *) >ether_shost, sizeof(eh->ether_shost)); if (last_gw.s_addr && (gwip.s_addr == last_gw.s_addr)) { - bcopy(last_arp, (char *)A_A eh->ether_dhost, 6); + bcopy(last_arp, (char *) >ether_dhost, 6); } - else if (arp((char *), (char *)A_A eh->ether_dhost) == -1) + else if (arp((char *), (char *) >ether_dhost) == -1) { perror("arp"); return -2; } - bcopy((char *)A_A eh->ether_dhost, last_arp, sizeof(last_arp)); + bcopy((char *) >ether_dhost, last_arp, sizeof(last_arp)); eh->ether_type = htons(ETHERTYPE_IP); bcopy((char *)ip, (char *), sizeof(*ip)); @@ -136,11 +136,11 @@ int send_ip(nfd, mtu, ip, gwip, frag) } if (ip->ip_src.s_addr != local_ip.s_addr) { - (void) arp((char *)>ip_src, (char *)A_A local_arp); - bcopy(local_arp, (char *)A_A eh->ether_shost,sizeof(last_arp)); + (void) arp((char *)>ip_src, (char *) _arp); + bcopy(local_arp, (char *) >ether_shost,sizeof(last_arp)); local_ip = ip->ip_src; } else - bcopy(local_arp, (char *)A_A eh->ether_shost, 6); + bcopy(local_arp, (char *) >ether_shost, 6); if (!frag || (sizeof(*eh) + iplen < mtu)) { Modified: stable/11/contrib/ipfilter/ipsend/resend.c == --- stable/11/contrib/ipfilter/ipsend/resend.c Thu Dec 13 00:42:26 2018 (r342022) +++ stable/11/contrib/ipfilter/ipsend/resend.c Thu Dec 13 03:12:15 2018 (r342023) @@ -97,7 +97,7 @@ int ip_resend(dev, mtu, r, gwip, datain) return -2; } - bzero((char *)A_A eh->ether_shost, sizeof(eh->ether_shost)); + bzero((char *) >ether_shost, sizeof(eh->ether_shost)); if (gwip.s_addr && (arp((char *), dhost) == -1)) { perror("arp"); @@ -113,12 +113,12 @@ int ip_resend(dev, mtu, r, gwip, datain) eh->ether_type = htons((u_short)ETHERTYPE_IP); if (!gwip.s_addr) { if (arp((char *), - (char *)A_A eh->ether_dhost) == -1) { + (char *) >ether_dhost) == -1) { perror("arp"); continue; } } else - bcopy(dhost, (char *)A_A eh->ether_dhost, + bcopy(dhost, (char *) >ether_dhost, sizeof(dhost)); if (!ip->ip_sum) ip->ip_sum = chksum((u_short *)ip, Modified: stable/11/sys/contrib/ipfilter/netinet/ip_compat.h == --- stable/11/sys/contrib/ipfilter/netinet/ip_compat.h Thu Dec 13 00:42:26 2018(r342022) +++
svn commit: r342023 - in stable: 10/contrib/ipfilter/ipsend 10/sys/contrib/ipfilter/netinet 11/contrib/ipfilter/ipsend 11/sys/contrib/ipfilter/netinet 12/contrib/ipfilter/ipsend 12/sys/contrib/ipfi...
Author: cy Date: Thu Dec 13 03:12:15 2018 New Revision: 342023 URL: https://svnweb.freebsd.org/changeset/base/342023 Log: MFC r341650: Remove an ugly Ultrix hack. Ultrix has been AWOL since the last ice age, more to come. Modified: stable/10/contrib/ipfilter/ipsend/ip.c stable/10/contrib/ipfilter/ipsend/resend.c stable/10/sys/contrib/ipfilter/netinet/ip_compat.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/ipfilter/ipsend/ip.c stable/11/contrib/ipfilter/ipsend/resend.c stable/11/sys/contrib/ipfilter/netinet/ip_compat.h stable/12/contrib/ipfilter/ipsend/ip.c stable/12/contrib/ipfilter/ipsend/resend.c stable/12/sys/contrib/ipfilter/netinet/ip_compat.h Directory Properties: stable/11/ (props changed) stable/12/ (props changed) Modified: stable/10/contrib/ipfilter/ipsend/ip.c == --- stable/10/contrib/ipfilter/ipsend/ip.c Thu Dec 13 00:42:26 2018 (r342022) +++ stable/10/contrib/ipfilter/ipsend/ip.c Thu Dec 13 03:12:15 2018 (r342023) @@ -70,9 +70,9 @@ int send_ether(nfd, buf, len, gwip) bcopy((char *)buf, s + sizeof(*eh), len); if (gwip.s_addr == last_gw.s_addr) { - bcopy(last_arp, (char *)A_A eh->ether_dhost, 6); + bcopy(last_arp, (char *) >ether_dhost, 6); } - else if (arp((char *), (char *)A_A eh->ether_dhost) == -1) + else if (arp((char *), (char *) >ether_dhost) == -1) { perror("arp"); return -2; @@ -112,17 +112,17 @@ int send_ip(nfd, mtu, ip, gwip, frag) eh = (ether_header_t *)ipbuf; - bzero((char *)A_A eh->ether_shost, sizeof(eh->ether_shost)); + bzero((char *) >ether_shost, sizeof(eh->ether_shost)); if (last_gw.s_addr && (gwip.s_addr == last_gw.s_addr)) { - bcopy(last_arp, (char *)A_A eh->ether_dhost, 6); + bcopy(last_arp, (char *) >ether_dhost, 6); } - else if (arp((char *), (char *)A_A eh->ether_dhost) == -1) + else if (arp((char *), (char *) >ether_dhost) == -1) { perror("arp"); return -2; } - bcopy((char *)A_A eh->ether_dhost, last_arp, sizeof(last_arp)); + bcopy((char *) >ether_dhost, last_arp, sizeof(last_arp)); eh->ether_type = htons(ETHERTYPE_IP); bcopy((char *)ip, (char *), sizeof(*ip)); @@ -139,11 +139,11 @@ int send_ip(nfd, mtu, ip, gwip, frag) } if (ip->ip_src.s_addr != local_ip.s_addr) { - (void) arp((char *)>ip_src, (char *)A_A local_arp); - bcopy(local_arp, (char *)A_A eh->ether_shost,sizeof(last_arp)); + (void) arp((char *)>ip_src, (char *) _arp); + bcopy(local_arp, (char *) >ether_shost,sizeof(last_arp)); local_ip = ip->ip_src; } else - bcopy(local_arp, (char *)A_A eh->ether_shost, 6); + bcopy(local_arp, (char *) >ether_shost, 6); if (!frag || (sizeof(*eh) + iplen < mtu)) { Modified: stable/10/contrib/ipfilter/ipsend/resend.c == --- stable/10/contrib/ipfilter/ipsend/resend.c Thu Dec 13 00:42:26 2018 (r342022) +++ stable/10/contrib/ipfilter/ipsend/resend.c Thu Dec 13 03:12:15 2018 (r342023) @@ -100,7 +100,7 @@ int ip_resend(dev, mtu, r, gwip, datain) return -2; } - bzero((char *)A_A eh->ether_shost, sizeof(eh->ether_shost)); + bzero((char *) >ether_shost, sizeof(eh->ether_shost)); if (gwip.s_addr && (arp((char *), dhost) == -1)) { perror("arp"); @@ -116,12 +116,12 @@ int ip_resend(dev, mtu, r, gwip, datain) eh->ether_type = htons((u_short)ETHERTYPE_IP); if (!gwip.s_addr) { if (arp((char *), - (char *)A_A eh->ether_dhost) == -1) { + (char *) >ether_dhost) == -1) { perror("arp"); continue; } } else - bcopy(dhost, (char *)A_A eh->ether_dhost, + bcopy(dhost, (char *) >ether_dhost, sizeof(dhost)); if (!ip->ip_sum) ip->ip_sum = chksum((u_short *)ip, Modified: stable/10/sys/contrib/ipfilter/netinet/ip_compat.h == --- stable/10/sys/contrib/ipfilter/netinet/ip_compat.h Thu Dec 13 00:42:26 2018(r342022) +++
svn commit: r342022 - head/sys/mips/include
Author: imp Date: Thu Dec 13 00:42:26 2018 New Revision: 342022 URL: https://svnweb.freebsd.org/changeset/base/342022 Log: Correctly implemenet atomic_swap_long for mips64. MIPS64 has 64-bit longs, so use uint64_t for it, otherwise uint32_t. sizeof(long) == sizeof(ptr) for all platforms, so define atomic_swap_ptr in terms of atomic_swap_long. Submitted by: hps@ Modified: head/sys/mips/include/atomic.h Modified: head/sys/mips/include/atomic.h == --- head/sys/mips/include/atomic.h Wed Dec 12 22:39:17 2018 (r342021) +++ head/sys/mips/include/atomic.h Thu Dec 13 00:42:26 2018 (r342022) @@ -793,6 +793,7 @@ atomic_swap_64(volatile uint64_t *ptr, const uint64_t } #endif +#ifdef __mips_n64 static __inline unsigned long atomic_swap_long(volatile unsigned long *ptr, const unsigned long value) { @@ -800,16 +801,16 @@ atomic_swap_long(volatile unsigned long *ptr, const un retval = *ptr; - while (!atomic_fcmpset_32((volatile uint32_t *)ptr, - (uint32_t *), value)) + while (!atomic_fcmpset_64((volatile uint64_t *)ptr, + (uint64_t *), value)) ; return (retval); } - -static __inline uintptr_t -atomic_swap_ptr(volatile uintptr_t *ptr, const uintptr_t value) +#else +static __inline unsigned long +atomic_swap_long(volatile unsigned long *ptr, const unsigned long value) { - uintptr_t retval; + unsigned long retval; retval = *ptr; @@ -818,5 +819,7 @@ atomic_swap_ptr(volatile uintptr_t *ptr, const uintptr ; return (retval); } +#endif +#defineatomic_swap_ptr(ptr, value) atomic_swap_long((unsigned long *)(ptr), value) #endif /* ! _MACHINE_ATOMIC_H_ */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342021 - svnadmin/conf
Author: gjb Date: Wed Dec 12 22:39:17 2018 New Revision: 342021 URL: https://svnweb.freebsd.org/changeset/base/342021 Log: Update the approvers file to share custody of releng/12.0 between so@ and re@ until re@ is comfortable turning over releng/12.0 entirely. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: svnadmin/conf/approvers Modified: svnadmin/conf/approvers == --- svnadmin/conf/approvers Wed Dec 12 22:33:05 2018(r342020) +++ svnadmin/conf/approvers Wed Dec 12 22:39:17 2018(r342021) @@ -20,7 +20,7 @@ #^stable/12/ re #^stable/11/ re ^release/ re -^releng/12.0/ re +^releng/12.0/ (re|security-officer|so) ^releng/11.[0-2]/ (security-officer|so) ^releng/10.[0-4]/ (security-officer|so) ^releng/9.[0-3]/ (security-officer|so) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342020 - in head/sys: arm/mv arm64/conf conf
Author: manu Date: Wed Dec 12 22:33:05 2018 New Revision: 342020 URL: https://svnweb.freebsd.org/changeset/base/342020 Log: mv_thermal: Add thermal driver for AP806 and CP110 thermal sensor Sponsored by: Rubicon Communications, LLC ("Netgate") Added: head/sys/arm/mv/mv_thermal.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Added: head/sys/arm/mv/mv_thermal.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/mv_thermal.cWed Dec 12 22:33:05 2018 (r342020) @@ -0,0 +1,381 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#defineCONTROL00x00 +#define CONTROL0_TSEN_START(1 << 0) +#define CONTROL0_TSEN_RESET(1 << 1) +#define CONTROL0_TSEN_EN (1 << 2) +#define CONTROL0_CHANNEL_SHIFT 13 +#define CONTROL0_CHANNEL_MASK 0xF +#define CONTROL0_OSR_SHIFT 24 +#define CONTROL0_OSR_MAX 3 /* OSR = 512 * 4uS = ~2mS */ +#define CONTROL0_MODE_SHIFT30 +#define CONTROL0_MODE_EXTERNAL 0x2 +#define CONTROL0_MODE_MASK 0x3 + +#defineCONTROL10x04 +/* This doesn't seems to work */ +#defineCONTROL1_TSEN_SENS_SHIFT21 +#defineCONTROL1_TSEN_SENS_MASK 0x7 + +#defineSTATUS 0x00 +#defineSTATUS_TEMP_MASK0x3FF + +enum mv_thermal_type { + MV_AP806 = 1, + MV_CP110, +}; + +struct mv_thermal_config { + enum mv_thermal_typetype; + int ncpus; + int64_t calib_mul; + int64_t calib_add; + int64_t calib_div; + uint32_tvalid_mask; + boolsigned_value; +}; + +struct mv_thermal_softc { + device_tdev; + struct resource *res[2]; + struct mtx mtx; + + struct mv_thermal_config*config; + int cur_sensor; +}; + +static struct mv_thermal_config mv_ap806_config = { + .type = MV_AP806, + .ncpus = 4, + .calib_mul = 423, + .calib_add = -15, + .calib_div = 100, + .valid_mask = (1 << 16), + .signed_value = true, +}; + +static struct mv_thermal_config mv_cp110_config = { + .type = MV_CP110, + .calib_mul = 296, + .calib_add = 1172499100, + .calib_div = 420100, + .valid_mask = (1 << 10), + .signed_value = false, +}; + +static struct resource_spec mv_thermal_res_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_MEMORY, 1, RF_ACTIVE }, + { -1, 0 } +}; + +static struct ofw_compat_data compat_data[] = { + {"marvell,armada-ap806-thermal", (uintptr_t) _ap806_config}, + {"marvell,armada-cp110-thermal", (uintptr_t) _cp110_config}, + {NULL, 0} +}; + +#defineRD_STA(sc, reg) bus_read_4((sc)->res[0], (reg)) +#defineWR_STA(sc, reg, val)bus_write_4((sc)->res[0], (reg), (val)) +#defineRD_CON(sc, reg) bus_read_4((sc)->res[1], (reg)) +#defineWR_CON(sc, reg, val)bus_write_4((sc)->res[1], (reg), (val)) +
svn commit: r342019 - head/sys/arm/mv
Author: manu Date: Wed Dec 12 22:24:30 2018 New Revision: 342019 URL: https://svnweb.freebsd.org/changeset/base/342019 Log: arm64: mv_cp110_icu: Fix build Modified: head/sys/arm/mv/mv_cp110_icu.c Modified: head/sys/arm/mv/mv_cp110_icu.c == --- head/sys/arm/mv/mv_cp110_icu.c Wed Dec 12 22:10:11 2018 (r342018) +++ head/sys/arm/mv/mv_cp110_icu.c Wed Dec 12 22:24:30 2018 (r342019) @@ -196,7 +196,7 @@ mv_cp110_icu_map_intr(device_t dev, struct intr_map_da if ((reg & ICU_INT_ENABLE) == 0) { reg |= ICU_INT_ENABLE; - WR4(sc, ICU_INT_CFG(daf->cells[1], reg)); + WR4(sc, ICU_INT_CFG(daf->cells[1]), reg); } daf->cells[1] = reg & ICU_INT_MASK; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342018 - head/sys/arm/mv
Author: manu Date: Wed Dec 12 22:10:11 2018 New Revision: 342018 URL: https://svnweb.freebsd.org/changeset/base/342018 Log: mv_gpio: Since it's also an interrupt controller, attach sooner Sponsored by: Rubicon Communications, LLC ("Netgate") Modified: head/sys/arm/mv/gpio.c Modified: head/sys/arm/mv/gpio.c == --- head/sys/arm/mv/gpio.c Wed Dec 12 22:09:35 2018(r342017) +++ head/sys/arm/mv/gpio.c Wed Dec 12 22:10:11 2018(r342018) @@ -193,7 +193,8 @@ static driver_t mv_gpio_driver = { static devclass_t mv_gpio_devclass; -DRIVER_MODULE(mv_gpio, simplebus, mv_gpio_driver, mv_gpio_devclass, 0, 0); +EARLY_DRIVER_MODULE(mv_gpio, simplebus, mv_gpio_driver, mv_gpio_devclass, 0, 0, +BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LAST); struct ofw_compat_data compat_data[] = { { "mrvl,gpio", 1 }, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342017 - head/sys/dev/sdhci
Author: manu Date: Wed Dec 12 22:09:35 2018 New Revision: 342017 URL: https://svnweb.freebsd.org/changeset/base/342017 Log: sdhci_xenon: Add Marvell 8k compatible string Sponsored by: Rubicon Communications, LLC ("Netgate") Modified: head/sys/dev/sdhci/sdhci_xenon.c Modified: head/sys/dev/sdhci/sdhci_xenon.c == --- head/sys/dev/sdhci/sdhci_xenon.cWed Dec 12 22:08:43 2018 (r342016) +++ head/sys/dev/sdhci/sdhci_xenon.cWed Dec 12 22:09:35 2018 (r342017) @@ -62,11 +62,16 @@ __FBSDID("$FreeBSD$"); #include "sdhci_if.h" #include "opt_mmccam.h" +#include "opt_soc.h" #defineMAX_SLOTS 6 static struct ofw_compat_data compat_data[] = { { "marvell,armada-3700-sdhci", 1 }, +#ifdef SOC_MARVELL_8K + { "marvell,armada-cp110-sdhci", 1 }, + { "marvell,armada-ap806-sdhci", 1 }, +#endif { NULL, 0 } }; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342016 - in head/sys: arm/mv arm64/conf conf
Author: manu Date: Wed Dec 12 22:08:43 2018 New Revision: 342016 URL: https://svnweb.freebsd.org/changeset/base/342016 Log: arm64: Add mv_cp110_icu and mv_cp110_gicp icu is a interrupt concentrator in the CP110 block and gicp is a gic extension to allow interrupts in the CP block to be turned into GIC SPI interrupts Sponsored by: Rubicon Communications, LLC ("Netgate") Added: head/sys/arm/mv/mv_ap806_gicp.c (contents, props changed) head/sys/arm/mv/mv_cp110_icu.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Added: head/sys/arm/mv/mv_ap806_gicp.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/mv_ap806_gicp.c Wed Dec 12 22:08:43 2018 (r342016) @@ -0,0 +1,289 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include "pic_if.h" + +#defineMV_AP806_GICP_MAX_NIRQS 207 + +struct mv_ap806_gicp_softc { + device_tdev; + device_tparent; + struct resource *res; + + ssize_t spi_ranges_cnt; + uint32_t*spi_ranges; +}; + +static struct ofw_compat_data compat_data[] = { + {"marvell,ap806-gicp", 1}, + {NULL, 0} +}; + +#defineRD4(sc, reg)bus_read_4((sc)->res, (reg)) +#defineWR4(sc, reg, val) bus_write_4((sc)->res, (reg), (val)) + +static int +mv_ap806_gicp_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Marvell GICP"); + return (BUS_PROBE_DEFAULT); +} + +static int +mv_ap806_gicp_attach(device_t dev) +{ + struct mv_ap806_gicp_softc *sc; + phandle_t node, xref, intr_parent; + + sc = device_get_softc(dev); + sc->dev = dev; + node = ofw_bus_get_node(dev); + + /* Look for our parent */ + if ((intr_parent = ofw_bus_find_iparent(node)) == 0) { + device_printf(dev, "Cannot find our parent interrupt controller\n"); + return (ENXIO); + } + if ((sc->parent = OF_device_from_xref(intr_parent)) == NULL) { + device_printf(dev, "cannot find parent interrupt controller device\n"); + return (ENXIO); + } + + sc->spi_ranges_cnt = OF_getencprop_alloc(node, "marvell,spi-ranges", + (void **)>spi_ranges); + + xref = OF_xref_from_node(node); + if (intr_pic_register(dev, xref) == NULL) { + device_printf(dev, "Cannot register GICP\n"); + return (ENXIO); + } + + OF_device_register_xref(xref, dev); + + return (0); +} + +static int +mv_ap806_gicp_detach(device_t dev) +{ + + return (EBUSY); +} + +static int +mv_ap806_gicp_activate_intr(device_t dev, struct intr_irqsrc *isrc, +struct resource *res, struct intr_map_data *data) +{ + struct mv_ap806_gicp_softc *sc; + + sc = device_get_softc(dev); + + return (PIC_ACTIVATE_INTR(sc->parent, isrc, res, data)); +} + +static void +mv_ap806_gicp_enable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct mv_ap806_gicp_softc *sc; + + sc =
svn commit: r342015 - in head/sys: conf dev/iicbus/twsi
Author: manu Date: Wed Dec 12 22:05:07 2018 New Revision: 342015 URL: https://svnweb.freebsd.org/changeset/base/342015 Log: twsi: Clean up marvell part and add support for Marvell 7k/8k Sponsored by: Rubicon Communications, LLC ("Netgate") Modified: head/sys/conf/files.arm64 head/sys/dev/iicbus/twsi/mv_twsi.c head/sys/dev/iicbus/twsi/twsi.c head/sys/dev/iicbus/twsi/twsi.h Modified: head/sys/conf/files.arm64 == --- head/sys/conf/files.arm64 Wed Dec 12 22:04:21 2018(r342014) +++ head/sys/conf/files.arm64 Wed Dec 12 22:05:07 2018(r342015) @@ -201,6 +201,7 @@ dev/axgbe/xgbe-dev.coptionalaxgbe dev/axgbe/xgbe-drv.c optionalaxgbe dev/axgbe/xgbe-mdio.c optionalaxgbe dev/cpufreq/cpufreq_dt.c optionalcpufreq fdt +dev/iicbus/twsi/mv_twsi.c optionaltwsi fdt dev/iicbus/twsi/a10_twsi.c optionaltwsi fdt dev/iicbus/twsi/twsi.c optionaltwsi fdt dev/hwpmc/hwpmc_arm64.coptionalhwpmc Modified: head/sys/dev/iicbus/twsi/mv_twsi.c == --- head/sys/dev/iicbus/twsi/mv_twsi.c Wed Dec 12 22:04:21 2018 (r342014) +++ head/sys/dev/iicbus/twsi/mv_twsi.c Wed Dec 12 22:05:07 2018 (r342015) @@ -61,6 +61,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -98,6 +100,7 @@ static int mv_twsi_attach(device_t); static struct ofw_compat_data compat_data[] = { { "mrvl,twsi", true }, { "marvell,mv64xxx-i2c",true }, + { "marvell,mv78230-i2c",true }, { NULL, false } }; @@ -141,29 +144,27 @@ mv_twsi_probe(device_t dev) if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) return (ENXIO); - sc->reg_data = TWSI_DATA; - sc->reg_slave_addr = TWSI_ADDR; - sc->reg_slave_ext_addr = TWSI_XADDR; - sc->reg_control = TWSI_CNTR; - sc->reg_status = TWSI_STAT; - sc->reg_baud_rate = TWSI_BAUD_RATE; - sc->reg_soft_reset = TWSI_SRST; - device_set_desc(dev, "Marvell Integrated I2C Bus Controller"); return (BUS_PROBE_DEFAULT); } #defineABSSUB(a,b) (((a) > (b)) ? (a) - (b) : (b) - (a)) static void -mv_twsi_cal_baud_rate(const uint32_t target, struct twsi_baud_rate *rate) +mv_twsi_cal_baud_rate(struct twsi_softc *sc, const uint32_t target, +struct twsi_baud_rate *rate) { - uint32_t clk, cur, diff, diff0; + uint64_t clk; + uint32_t cur, diff, diff0; int m, n, m0, n0; /* Calculate baud rate. */ m0 = n0 = 4;/* Default values on reset */ diff0 = 0x; +#ifdef __aarch64__ + clk_get_freq(sc->clk_core, ); +#else clk = get_tclk(); +#endif for (n = 0; n < 8; n++) { for (m = 0; m < 16; m++) { @@ -186,17 +187,37 @@ static int mv_twsi_attach(device_t dev) { struct twsi_softc *sc; - phandle_t child, iicbusnode; - device_t childdev; - struct iicbus_ivar *devi; - char dname[32]; /* 32 is taken from struct u_device */ - uint32_t paddr; - int len, error, ret; +#ifdef __aarch64__ + int error; +#endif sc = device_get_softc(dev); + sc->dev = dev; - mv_twsi_cal_baud_rate(TWSI_BAUD_RATE_SLOW, >baud_rate[IIC_SLOW]); - mv_twsi_cal_baud_rate(TWSI_BAUD_RATE_FAST, >baud_rate[IIC_FAST]); +#ifdef __aarch64__ + /* Activate clock */ + error = clk_get_by_ofw_index(dev, 0, 0, >clk_core); + if (error != 0) { + device_printf(dev, "could not find core clock\n"); + return (error); + } + error = clk_enable(sc->clk_core); + if (error != 0) { + device_printf(dev, "could not enable core clock\n"); + return (error); + } + + if (clk_get_by_ofw_index(dev, 0, 1, >clk_reg) == 0) { + error = clk_enable(sc->clk_reg); + if (error != 0) { + device_printf(dev, "could not enable core clock\n"); + return (error); + } + } +#endif + + mv_twsi_cal_baud_rate(sc, TWSI_BAUD_RATE_SLOW, >baud_rate[IIC_SLOW]); + mv_twsi_cal_baud_rate(sc, TWSI_BAUD_RATE_FAST, >baud_rate[IIC_FAST]); if (bootverbose) device_printf(dev, "calculated baud rates are:\n" " %" PRIu32 " kHz (M=%d, N=%d) for slow,\n" @@ -208,56 +229,13 @@ mv_twsi_attach(device_t dev) sc->baud_rate[IIC_FAST].m, sc->baud_rate[IIC_FAST].n); + sc->reg_data = TWSI_DATA; + sc->reg_slave_addr = TWSI_ADDR; + sc->reg_slave_ext_addr = TWSI_XADDR; + sc->reg_control = TWSI_CNTR; +
svn commit: r342014 - in head/sys: arm/mv conf
Author: manu Date: Wed Dec 12 22:04:21 2018 New Revision: 342014 URL: https://svnweb.freebsd.org/changeset/base/342014 Log: arm64: marvell: Add cp110 clock controller support The cp110 clock controller controls the clocks and gate of the CP110 hardware block. Every clock/gate are implemented except the NAND clock. Sponsored by: Rubicon Communications, LLC ("Netgate") Added: head/sys/arm/mv/mv_cp110_clock.c (contents, props changed) head/sys/arm/mv/mv_cp110_clock.h (contents, props changed) Modified: head/sys/conf/files.arm64 Added: head/sys/arm/mv/mv_cp110_clock.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/mv_cp110_clock.cWed Dec 12 22:04:21 2018 (r342014) @@ -0,0 +1,375 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include +#include + +#include + +#include "clkdev_if.h" + +/* Clocks */ +static struct clk_fixed_def cp110_clk_pll_0 = { + .clkdef.id = CP110_PLL_0, + .freq = 10, +}; + +static const char *clk_parents_0[] = {"cp110-pll0-0"}; +static const char *clk_parents_1[] = {"cp110-pll0-1"}; + +static struct clk_fixed_def cp110_clk_ppv2_core = { + .clkdef.id = CP110_PPV2_CORE, + .clkdef.parent_cnt = 1, + .mult = 1, + .div = 3, +}; + +static struct clk_fixed_def cp110_clk_x2core = { + .clkdef.id = CP110_X2CORE, + .clkdef.parent_cnt = 1, + .mult = 1, + .div = 2, +}; + +static const char *core_parents_0[] = {"cp110-x2core-0"}; +static const char *core_parents_1[] = {"cp110-x2core-1"}; + +static struct clk_fixed_def cp110_clk_core = { + .clkdef.id = CP110_CORE, + .clkdef.parent_cnt = 1, + .mult = 1, + .div = 2, +}; + +static struct clk_fixed_def cp110_clk_sdio = { + .clkdef.id = CP110_SDIO, + .clkdef.parent_cnt = 1, + .mult = 2, + .div = 5, +}; + +/* Gates */ + +static struct cp110_gate cp110_gates[] = { + CCU_GATE(CP110_GATE_AUDIO, "cp110-gate-audio", 0) + CCU_GATE(CP110_GATE_COMM_UNIT, "cp110-gate-comm_unit", 1) + /* CCU_GATE(CP110_GATE_NAND, "cp110-gate-nand", 2) */ + CCU_GATE(CP110_GATE_PPV2, "cp110-gate-ppv2", 3) + CCU_GATE(CP110_GATE_SDIO, "cp110-gate-sdio", 4) + CCU_GATE(CP110_GATE_MG, "cp110-gate-mg", 5) + CCU_GATE(CP110_GATE_MG_CORE, "cp110-gate-mg_core", 6) + CCU_GATE(CP110_GATE_XOR1, "cp110-gate-xor1", 7) + CCU_GATE(CP110_GATE_XOR0, "cp110-gate-xor0", 8) + CCU_GATE(CP110_GATE_GOP_DP, "cp110-gate-gop_dp", 9) + CCU_GATE(CP110_GATE_PCIE_X1_0, "cp110-gate-pcie_x10", 11) + CCU_GATE(CP110_GATE_PCIE_X1_1, "cp110-gate-pcie_x11", 12) + CCU_GATE(CP110_GATE_PCIE_X4, "cp110-gate-pcie_x4", 13) + CCU_GATE(CP110_GATE_PCIE_XOR, "cp110-gate-pcie_xor", 14) + CCU_GATE(CP110_GATE_SATA, "cp110-gate-sata", 15) + CCU_GATE(CP110_GATE_SATA_USB, "cp110-gate-sata_usb", 16) + CCU_GATE(CP110_GATE_MAIN, "cp110-gate-main", 17) + CCU_GATE(CP110_GATE_SDMMC_GOP, "cp110-gate-sdmmc_gop", 18) + CCU_GATE(CP110_GATE_SLOW_IO, "cp110-gate-slow_io", 21) + CCU_GATE(CP110_GATE_USB3H0, "cp110-gate-usb3h0", 22) + CCU_GATE(CP110_GATE_USB3H1, "cp110-gate-usb3h1", 23) + CCU_GATE(CP110_GATE_USB3DEV, "cp110-gate-usb3dev", 24) +
svn commit: r342013 - in head/sys: arm/mv arm64/conf conf
Author: manu Date: Wed Dec 12 22:02:57 2018 New Revision: 342013 URL: https://svnweb.freebsd.org/changeset/base/342013 Log: arm64: mv_gpio: Add Marvell 8K support While here put the interrupts setup in it's own function Sponsored by: Rubicon Communications, LCC ("Netgate") Modified: head/sys/arm/mv/gpio.c head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Modified: head/sys/arm/mv/gpio.c == --- head/sys/arm/mv/gpio.c Wed Dec 12 22:01:06 2018(r342012) +++ head/sys/arm/mv/gpio.c Wed Dec 12 22:02:57 2018(r342013) @@ -60,6 +60,10 @@ __FBSDID("$FreeBSD$"); #include "gpio_if.h" +#ifdef __aarch64__ +#include "opt_soc.h" +#endif + #define GPIO_MAX_INTR_COUNT8 #define GPIO_PINS_PER_REG 32 #define GPIO_GENERIC_CAP (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ @@ -74,6 +78,7 @@ __FBSDID("$FreeBSD$"); #define DEBOUNCE_CHECK_TICKS ((hz / 1000) * DEBOUNCE_CHECK_MS) struct mv_gpio_softc { + device_tdev; device_tsc_busdev; struct resource * mem_res; int mem_rid; @@ -83,6 +88,7 @@ struct mv_gpio_softc { void*ih_cookie[GPIO_MAX_INTR_COUNT]; bus_space_tag_t bst; bus_space_handle_t bsh; + uint32_toffset; struct mtx mutex; uint8_t pin_num;/* number of GPIO pins */ uint8_t irq_num;/* number of real IRQs occupied by GPIO controller */ @@ -189,9 +195,12 @@ static devclass_t mv_gpio_devclass; DRIVER_MODULE(mv_gpio, simplebus, mv_gpio_driver, mv_gpio_devclass, 0, 0); -struct ofw_compat_data gpio_controllers[] = { - { "mrvl,gpio", (uintptr_t)true }, - { "marvell,orion-gpio", (uintptr_t)true }, +struct ofw_compat_data compat_data[] = { + { "mrvl,gpio", 1 }, + { "marvell,orion-gpio", 1 }, +#ifdef SOC_MARVELL_8K + { "marvell,armada-8k-gpio", 1 }, +#endif { NULL, 0 } }; @@ -201,7 +210,7 @@ mv_gpio_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (ofw_bus_search_compatible(dev, gpio_controllers)->ocd_data == 0) + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); device_set_desc(dev, "Marvell Integrated GPIO Controller"); @@ -209,61 +218,75 @@ mv_gpio_probe(device_t dev) } static int -mv_gpio_attach(device_t dev) +mv_gpio_setup_interrupts(struct mv_gpio_softc *sc, phandle_t node) { - int i, size; - struct mv_gpio_softc *sc; - pcell_t pincnt = 0; - pcell_t irq_cells = 0; phandle_t iparent; + pcell_t irq_cells; + int i, size; - sc = (struct mv_gpio_softc *)device_get_softc(dev); - if (sc == NULL) - return (ENXIO); - - if (OF_getencprop(ofw_bus_get_node(dev), "pin-count", , - sizeof(pcell_t)) >= 0 || - OF_getencprop(ofw_bus_get_node(dev), "ngpios", , - sizeof(pcell_t)) >= 0) { - sc->pin_num = MIN(pincnt, MV_GPIO_MAX_NPINS); - if (bootverbose) - device_printf(dev, "%d pins available\n", sc->pin_num); - } else { - device_printf(dev, "ERROR: no pin-count or ngpios entry found!\n"); - return (ENXIO); - } - - /* Assign generic capabilities to every gpio pin */ - for(i = 0; i < sc->pin_num; i++) - sc->gpio_setup[i].gp_caps = GPIO_GENERIC_CAP; - /* Find root interrupt controller */ - iparent = ofw_bus_find_iparent(ofw_bus_get_node(dev)); + iparent = ofw_bus_find_iparent(node); if (iparent == 0) { - device_printf(dev, "No interrupt-parrent found. " + device_printf(sc->dev, "No interrupt-parrent found. " "Error in DTB\n"); return (ENXIO); } else { /* While at parent - store interrupt cells prop */ if (OF_searchencprop(OF_node_from_xref(iparent), "#interrupt-cells", _cells, sizeof(irq_cells)) == -1) { - device_printf(dev, "DTB: Missing #interrupt-cells " + device_printf(sc->dev, "DTB: Missing #interrupt-cells " "property in interrupt parent node\n"); return (ENXIO); } } - size = OF_getproplen(ofw_bus_get_node(dev), "interrupts"); + size = OF_getproplen(node, "interrupts"); if (size != -1) { size = size / sizeof(pcell_t); size = size / irq_cells; sc->irq_num = size; - device_printf(dev, "%d IRQs available\n", sc->irq_num); + device_printf(sc->dev, "%d IRQs available\n", sc->irq_num);
svn commit: r342012 - in head/sys: arm/mv conf
Author: manu Date: Wed Dec 12 22:01:06 2018 New Revision: 342012 URL: https://svnweb.freebsd.org/changeset/base/342012 Log: arm64: marvell: Add driver for Marvell Ap806 System Controller The first two clocks are for the clusters and their frequencies can be found reading a register. Then a fixed 1200Mhz clock is present and two fixed clocks, 'mss' which is 1200 / 6 and 'sdio' which is 1200 / 3. Sponsored by: Rubicon Communications, LLC ("Netgate") Added: head/sys/arm/mv/mv_ap806_clock.c (contents, props changed) Modified: head/sys/conf/files.arm64 Added: head/sys/arm/mv/mv_ap806_clock.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/mv_ap806_clock.cWed Dec 12 22:01:06 2018 (r342012) @@ -0,0 +1,210 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include + +static struct clk_fixed_def ap806_clk_cluster_0 = { + .clkdef.id = 0, + .clkdef.name = "ap806-cpu-cluster-0", + .freq = 0, +}; + +static struct clk_fixed_def ap806_clk_cluster_1 = { + .clkdef.id = 1, + .clkdef.name = "ap806-cpu-cluster-1", + .freq = 0, +}; + +static struct clk_fixed_def ap806_clk_fixed = { + .clkdef.id = 2, + .clkdef.name = "ap806-fixed", + .freq = 12, +}; + +/* Thoses are the only exported clocks AFAICT */ + +static const char *mss_parents[] = {"ap806-fixed"}; +static struct clk_fixed_def ap806_clk_mss = { + .clkdef.id = 3, + .clkdef.name = "ap806-mss", + .clkdef.parent_names = mss_parents, + .clkdef.parent_cnt = 1, + .mult = 1, + .div = 6, +}; + +static const char *sdio_parents[] = {"ap806-fixed"}; +static struct clk_fixed_def ap806_clk_sdio = { + .clkdef.id = 4, + .clkdef.name = "ap806-sdio", + .clkdef.parent_names = sdio_parents, + .clkdef.parent_cnt = 1, + .mult = 1, + .div = 3, +}; + +struct mv_ap806_clock_softc { + struct simplebus_softc simplebus_sc; + device_tdev; + struct resource *res; +}; + +static struct resource_spec mv_ap806_clock_res_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE | RF_SHAREABLE }, + { -1, 0 } +}; + +static struct ofw_compat_data compat_data[] = { + {"marvell,ap806-clock", 1}, + {NULL, 0} +}; + +#defineRD4(sc, reg)bus_read_4((sc)->res, (reg)) +#defineWR4(sc, reg, val) bus_write_4((sc)->res, (reg), (val)) + +static int +mv_ap806_clock_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Marvell AP806 Clock Controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +mv_ap806_clock_attach(device_t dev) +{ + struct mv_ap806_clock_softc *sc; + struct clkdom *clkdom; + uint64_t clock_freq; + uint32_t reg; + + sc = device_get_softc(dev); + sc->dev = dev; + + if (bus_alloc_resources(dev, mv_ap806_clock_res_spec, >res) != 0) { + device_printf(dev, "cannot allocate resources for device\n"); + return (ENXIO); + } + + /* +* We might miss some combinations +
svn commit: r342009 - head/secure/lib/libcrypto
Author: jkim Date: Wed Dec 12 21:56:47 2018 New Revision: 342009 URL: https://svnweb.freebsd.org/changeset/base/342009 Log: Enable devcryptoeng for OpenSSL. Since OpenSSL 1.1.1, the good old BSD-specific cryptodev engine has been deprecated in favor of this new engine. However, this engine is not throughly tested on FreeBSD because it was originally written for Linux. http://cryptodev-linux.org/ Also, the author actually meant to enable it by default on BSD platforms but he failed to do so because there was a bug in the Configure script. https://github.com/openssl/openssl/pull/7882 Now they found that it was more generic issue. https://github.com/openssl/openssl/pull/7885 Therefore, we need to enable this engine on head to give it more exposure. Modified: head/secure/lib/libcrypto/Makefile head/secure/lib/libcrypto/opensslconf.h.in Modified: head/secure/lib/libcrypto/Makefile == --- head/secure/lib/libcrypto/Makefile Wed Dec 12 21:56:45 2018 (r342008) +++ head/secure/lib/libcrypto/Makefile Wed Dec 12 21:56:47 2018 (r342009) @@ -192,8 +192,8 @@ SRCS+= ecp_nistz256-x86.S ecp_nistz256.c .endif # engine -SRCS+= eng_all.c eng_cnf.c eng_ctrl.c eng_dyn.c eng_err.c eng_fat.c -SRCS+= eng_init.c eng_lib.c eng_list.c eng_openssl.c eng_pkey.c +SRCS+= eng_all.c eng_cnf.c eng_ctrl.c eng_devcrypto.c eng_dyn.c eng_err.c +SRCS+= eng_fat.c eng_init.c eng_lib.c eng_list.c eng_openssl.c eng_pkey.c SRCS+= eng_rdrand.c eng_table.c tb_asnmth.c tb_cipher.c tb_dh.c tb_digest.c SRCS+= tb_dsa.c tb_eckey.c tb_pkmeth.c tb_rand.c tb_rsa.c Modified: head/secure/lib/libcrypto/opensslconf.h.in == --- head/secure/lib/libcrypto/opensslconf.h.in Wed Dec 12 21:56:45 2018 (r342008) +++ head/secure/lib/libcrypto/opensslconf.h.in Wed Dec 12 21:56:47 2018 (r342009) @@ -46,9 +46,6 @@ extern "C" { #ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE # define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE #endif -#ifndef OPENSSL_NO_DEVCRYPTOENG -# define OPENSSL_NO_DEVCRYPTOENG -#endif #ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 # define OPENSSL_NO_EC_NISTP_64_GCC_128 #endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342011 - in head/sys: arm/mv arm64/conf conf
Author: manu Date: Wed Dec 12 22:00:05 2018 New Revision: 342011 URL: https://svnweb.freebsd.org/changeset/base/342011 Log: arm64: mvebu_pinctrl: Add driver for Marvell Pinmux Controller Add a driver compatible with Marvell mvebu-pinctrl and add ap806-pinctrl support. Sponsored by: Rubicon Communications, LCC ("Netgate") Added: head/sys/arm/mv/mvebu_pinctrl.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Added: head/sys/arm/mv/mvebu_pinctrl.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/mvebu_pinctrl.c Wed Dec 12 22:00:05 2018 (r342011) @@ -0,0 +1,246 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include + +#include "opt_soc.h" + +#definePINS_PER_REG8 +#defineBITS_PER_PIN4 +#definePINS_MASK 0xf +#defineMAX_PIN_FUNC5 + +struct mv_pins { + const char *name; + const char *functions[MAX_PIN_FUNC]; +}; + +struct mv_padconf { + const struct mv_pins*pins; + size_t npins; +}; + +#ifdef SOC_MARVELL_8K +const static struct mv_pins ap806_pins[] = { + {"mpp0", {"gpio", "sdio", NULL, "spi0"}}, + {"mpp1", {"gpio", "sdio", NULL, "spi0"}}, + {"mpp2", {"gpio", "sdio", NULL, "spi0"}}, + {"mpp3", {"gpio", "sdio", NULL, "spi0"}}, + {"mpp4", {"gpio", "sdio", NULL, "i2c0"}}, + {"mpp5", {"gpio", "sdio", NULL, "i2c0"}}, + {"mpp6", {"gpio", "sdio", NULL, NULL}}, + {"mpp7", {"gpio", "sdio", NULL, "uart1"}}, + {"mpp8", {"gpio", "sdio", NULL, "uart1"}}, + {"mpp9", {"gpio", "sdio", NULL, "spi0"}}, + {"mpp10", {"gpio", "sdio", NULL, NULL}}, + {"mpp11", {"gpio", NULL, NULL, "uart0"}}, + {"mpp12", {"gpio", "sdio", "sdio", NULL}}, + {"mpp13", {"gpio", NULL, NULL}}, + {"mpp14", {"gpio", NULL, NULL}}, + {"mpp15", {"gpio", NULL, NULL}}, + {"mpp16", {"gpio", NULL, NULL}}, + {"mpp17", {"gpio", NULL, NULL}}, + {"mpp18", {"gpio", NULL, NULL}}, + {"mpp19", {"gpio", NULL, NULL, "uart0", "sdio"}}, +}; + +const struct mv_padconf ap806_padconf = { + .npins = nitems(ap806_pins), + .pins = ap806_pins, +}; +#endif + +struct mv_pinctrl_softc { + device_tdev; + struct resource *res; + + struct mv_padconf *padconf; +}; + +static struct resource_spec mv_pinctrl_res_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE | RF_SHAREABLE }, + { -1, 0 } +}; + +static struct ofw_compat_data compat_data[] = { +#ifdef SOC_MARVELL_8K + {"marvell,ap806-pinctrl", (uintptr_t)_padconf}, +#endif + {NULL, 0} +}; + +#defineRD4(sc, reg)bus_read_4((sc)->res, (reg)) +#defineWR4(sc, reg, val) bus_write_4((sc)->res, (reg), (val)) + +static void +mv_pinctrl_configure_pin(struct mv_pinctrl_softc *sc, uint32_t pin, +uint32_t function) +{ + uint32_t offset, shift, reg; + + offset = (pin / PINS_PER_REG) * BITS_PER_PIN; + shift = (pin % PINS_PER_REG) * BITS_PER_PIN; + reg = RD4(sc, offset); + reg &= ~(PINS_MASK << shift); + reg |= function << shift; + WR4(sc, offset, reg); +} + +static int
svn commit: r342010 - in head/sys: arm64/conf conf
Author: manu Date: Wed Dec 12 21:58:30 2018 New Revision: 342010 URL: https://svnweb.freebsd.org/changeset/base/342010 Log: arm64: Add new SoC type MARVELL_8K Sponsored by: Rubicon Communications, LLC ("Netgate") Modified: head/sys/arm64/conf/GENERIC head/sys/conf/options.arm64 Modified: head/sys/arm64/conf/GENERIC == --- head/sys/arm64/conf/GENERIC Wed Dec 12 21:56:47 2018(r342009) +++ head/sys/arm64/conf/GENERIC Wed Dec 12 21:58:30 2018(r342010) @@ -107,6 +107,7 @@ options SOC_ALLWINNER_H5 optionsSOC_CAVM_THUNDERX optionsSOC_HISI_HI6220 optionsSOC_BRCM_BCM2837 +optionsSOC_MARVELL_8K optionsSOC_ROCKCHIP_RK3328 optionsSOC_ROCKCHIP_RK3399 optionsSOC_XILINX_ZYNQ Modified: head/sys/conf/options.arm64 == --- head/sys/conf/options.arm64 Wed Dec 12 21:56:47 2018(r342009) +++ head/sys/conf/options.arm64 Wed Dec 12 21:58:30 2018(r342010) @@ -19,6 +19,7 @@ SOC_ALLWINNER_H5 opt_soc.h SOC_BRCM_BCM2837 opt_soc.h SOC_CAVM_THUNDERX opt_soc.h SOC_HISI_HI6220opt_soc.h +SOC_MARVELL_8K opt_soc.h SOC_ROCKCHIP_RK3328opt_soc.h SOC_ROCKCHIP_RK3399opt_soc.h SOC_XILINX_ZYNQopt_soc.h ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342008 - in head/sys: conf dev/fdt
Author: manu Date: Wed Dec 12 21:56:45 2018 New Revision: 342008 URL: https://svnweb.freebsd.org/changeset/base/342008 Log: fdt: Add support for simple-mfd bus Quoting the binding Documentation : "These devices comprise a nexus for heterogeneous hardware blocks containing more than one non-unique yet varying hardware functionality." Reviewed by: loos Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision:https://reviews.freebsd.org/D17751 Added: head/sys/dev/fdt/simple_mfd.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/fdt/simplebus.c head/sys/dev/fdt/simplebus.h Modified: head/sys/conf/files == --- head/sys/conf/files Wed Dec 12 21:25:52 2018(r342007) +++ head/sys/conf/files Wed Dec 12 21:56:45 2018(r342008) @@ -1762,6 +1762,7 @@ dev/fdt/fdt_slicer.c optional fdt cfi | fdt nand | fd dev/fdt/fdt_static_dtb.S optional fdt fdt_dtb_static \ dependency "fdt_dtb_file" dev/fdt/simplebus.coptional fdt +dev/fdt/simple_mfd.c optional fdt dev/fe/if_fe.c optional fe dev/fe/if_fe_pccard.c optional fe pccard dev/filemon/filemon.c optional filemon Added: head/sys/dev/fdt/simple_mfd.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/fdt/simple_mfd.c Wed Dec 12 21:56:45 2018 (r342008) @@ -0,0 +1,176 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +struct simple_mfd_softc { + struct simplebus_softc sc; +}; + +device_t simple_mfd_add_device(device_t dev, phandle_t node, u_int order, +const char *name, int unit, struct simplebus_devinfo *di); +struct simplebus_devinfo *simple_mfd_setup_dinfo(device_t dev, phandle_t node, struct simplebus_devinfo *di); + +static int +simple_mfd_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + if (!ofw_bus_is_compatible(dev, "simple-mfd")) + return (ENXIO); + + device_set_desc(dev, "Simple MFD (Multi-Functions Device)"); + + return (BUS_PROBE_GENERIC); +} + +static int +simple_mfd_attach(device_t dev) +{ + struct simple_mfd_softc *sc; + phandle_t node, child; + device_t cdev; + + sc = device_get_softc(dev); + node = ofw_bus_get_node(dev); + + /* Parse address-cells and size-cells from the parent node as a fallback */ + if (OF_getencprop(node, "#address-cells", >sc.acells, + sizeof(sc->sc.acells)) == -1) { + if (OF_getencprop(OF_parent(node), "#address-cells", >sc.acells, + sizeof(sc->sc.acells)) == -1) { + sc->sc.acells = 2; + } + } + if (OF_getencprop(node, "#size-cells", >sc.scells, + sizeof(sc->sc.scells)) == -1) { + if (OF_getencprop(OF_parent(node), "#size-cells", >sc.scells, + sizeof(sc->sc.scells)) == -1) { + sc->sc.scells = 1; + } + } + + /* If the node has a ranges prop, parse it so children mapping will be done correctly */ + if (OF_hasprop(node, "ranges")) { + if (simplebus_fill_ranges(node, >sc) < 0) { +
svn commit: r342007 - head/usr.sbin/pwm
Author: manu Date: Wed Dec 12 21:25:52 2018 New Revision: 342007 URL: https://svnweb.freebsd.org/changeset/base/342007 Log: pwm: Fix some arches by using %ju and casting to uintmax_t Reported by: ci.freebsd.org Modified: head/usr.sbin/pwm/pwm.c Modified: head/usr.sbin/pwm/pwm.c == --- head/usr.sbin/pwm/pwm.c Wed Dec 12 21:10:34 2018(r342006) +++ head/usr.sbin/pwm/pwm.c Wed Dec 12 21:25:52 2018(r342007) @@ -190,9 +190,9 @@ main(int argc, char *argv[]) } break; case PWM_SHOW_CONFIG: - printf("period: %lu\nduty: %lu\nenabled:%d\n", - state.period, - state.duty, + printf("period: %ju\nduty: %ju\nenabled:%d\n", + (uintmax_t) state.period, + (uintmax_t) state.duty, state.enable); break; case PWM_PERIOD: ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342006 - head/sys/dts/arm64/overlays
Author: manu Date: Wed Dec 12 21:10:34 2018 New Revision: 342006 URL: https://svnweb.freebsd.org/changeset/base/342006 Log: arm64: allwinner: Fix pwm dtso Double patched files ended up in the tree Reported by: kevans Modified: head/sys/dts/arm64/overlays/sun50i-a64-pwm.dtso head/sys/dts/arm64/overlays/sun50i-a64-rpwm.dtso Modified: head/sys/dts/arm64/overlays/sun50i-a64-pwm.dtso == --- head/sys/dts/arm64/overlays/sun50i-a64-pwm.dtso Wed Dec 12 21:02:22 2018(r342005) +++ head/sys/dts/arm64/overlays/sun50i-a64-pwm.dtso Wed Dec 12 21:10:34 2018(r342006) @@ -24,29 +24,3 @@ function = "pwm"; }; }; -/dts-v1/; -/plugin/; - -/ { - compatible = "allwinner,sun50i-a64"; -}; - -&{/soc} { - pwm: pwm@1c21400 { - compatible = "allwinner,sun50i-a64-pwm", -"allwinner,sun5i-a13-pwm"; - reg = <0x01c21400 0x400>; - clocks = <>; - pinctrl-names = "default"; - pinctrl-0 = <_pin>; - #pwm-cells = <3>; - status = "disabled"; - }; -}; - -&{/soc/pinctrl@1c20800} { - pwm_pin: pwm_pin { - pins = "PD22"; - function = "pwm"; - }; -}; Modified: head/sys/dts/arm64/overlays/sun50i-a64-rpwm.dtso == --- head/sys/dts/arm64/overlays/sun50i-a64-rpwm.dtsoWed Dec 12 21:02:22 2018(r342005) +++ head/sys/dts/arm64/overlays/sun50i-a64-rpwm.dtsoWed Dec 12 21:10:34 2018(r342006) @@ -24,29 +24,3 @@ function = "s_pwm"; }; }; -/dts-v1/; -/plugin/; - -/ { - compatible = "allwinner,sun50i-a64"; -}; - -&{/soc} { - r_pwm: pwm@1f03800 { - compatible = "allwinner,sun50i-a64-pwm", -"allwinner,sun5i-a13-pwm"; - reg = <0x01f03800 0x400>; - clocks = <>; - pinctrl-names = "default"; - pinctrl-0 = <_pwm_pin>; - #pwm-cells = <3>; - status = "okay"; - }; -}; - -&{/soc/pinctrl@1f02c00} { - r_pwm_pin: pwm { - pins = "PL10"; - function = "s_pwm"; - }; -}; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342005 - in head/sys: dts/arm64/overlays modules/dtb/allwinner
Author: manu Date: Wed Dec 12 21:02:22 2018 New Revision: 342005 URL: https://svnweb.freebsd.org/changeset/base/342005 Log: arm64: allwinner: Add DTSO for pwm and r_pwm Those are both dtso (overlays) for the two pwm controllers found on the A64. Added: head/sys/dts/arm64/overlays/sun50i-a64-pwm.dtso (contents, props changed) head/sys/dts/arm64/overlays/sun50i-a64-rpwm.dtso (contents, props changed) Modified: head/sys/modules/dtb/allwinner/Makefile Added: head/sys/dts/arm64/overlays/sun50i-a64-pwm.dtso == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dts/arm64/overlays/sun50i-a64-pwm.dtso Wed Dec 12 21:02:22 2018(r342005) @@ -0,0 +1,52 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "allwinner,sun50i-a64"; +}; + +&{/soc} { + pwm: pwm@1c21400 { + compatible = "allwinner,sun50i-a64-pwm", +"allwinner,sun5i-a13-pwm"; + reg = <0x01c21400 0x400>; + clocks = <>; + pinctrl-names = "default"; + pinctrl-0 = <_pin>; + #pwm-cells = <3>; + status = "disabled"; + }; +}; + +&{/soc/pinctrl@1c20800} { + pwm_pin: pwm_pin { + pins = "PD22"; + function = "pwm"; + }; +}; +/dts-v1/; +/plugin/; + +/ { + compatible = "allwinner,sun50i-a64"; +}; + +&{/soc} { + pwm: pwm@1c21400 { + compatible = "allwinner,sun50i-a64-pwm", +"allwinner,sun5i-a13-pwm"; + reg = <0x01c21400 0x400>; + clocks = <>; + pinctrl-names = "default"; + pinctrl-0 = <_pin>; + #pwm-cells = <3>; + status = "disabled"; + }; +}; + +&{/soc/pinctrl@1c20800} { + pwm_pin: pwm_pin { + pins = "PD22"; + function = "pwm"; + }; +}; Added: head/sys/dts/arm64/overlays/sun50i-a64-rpwm.dtso == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dts/arm64/overlays/sun50i-a64-rpwm.dtsoWed Dec 12 21:02:22 2018(r342005) @@ -0,0 +1,52 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "allwinner,sun50i-a64"; +}; + +&{/soc} { + r_pwm: pwm@1f03800 { + compatible = "allwinner,sun50i-a64-pwm", +"allwinner,sun5i-a13-pwm"; + reg = <0x01f03800 0x400>; + clocks = <>; + pinctrl-names = "default"; + pinctrl-0 = <_pwm_pin>; + #pwm-cells = <3>; + status = "okay"; + }; +}; + +&{/soc/pinctrl@1f02c00} { + r_pwm_pin: pwm { + pins = "PL10"; + function = "s_pwm"; + }; +}; +/dts-v1/; +/plugin/; + +/ { + compatible = "allwinner,sun50i-a64"; +}; + +&{/soc} { + r_pwm: pwm@1f03800 { + compatible = "allwinner,sun50i-a64-pwm", +"allwinner,sun5i-a13-pwm"; + reg = <0x01f03800 0x400>; + clocks = <>; + pinctrl-names = "default"; + pinctrl-0 = <_pwm_pin>; + #pwm-cells = <3>; + status = "okay"; + }; +}; + +&{/soc/pinctrl@1f02c00} { + r_pwm_pin: pwm { + pins = "PL10"; + function = "s_pwm"; + }; +}; Modified: head/sys/modules/dtb/allwinner/Makefile == --- head/sys/modules/dtb/allwinner/Makefile Wed Dec 12 20:58:43 2018 (r342004) +++ head/sys/modules/dtb/allwinner/Makefile Wed Dec 12 21:02:22 2018 (r342005) @@ -45,6 +45,8 @@ DTS= \ allwinner/sun50i-h5-orangepi-pc2.dts DTSO= sun50i-a64-opp.dtso \ + sun50i-a64-pwm.dtso \ + sun50i-a64-rpwm.dtso \ sun50i-a64-sid.dtso \ sun50i-a64-ths.dtso \ sun50i-a64-timer.dtso ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342004 - in head/sys: arm/allwinner arm64/conf conf
Author: manu Date: Wed Dec 12 20:58:43 2018 New Revision: 342004 URL: https://svnweb.freebsd.org/changeset/base/342004 Log: arm64: allwinner: Add pwm driver Add a pwm driver for Allwinner PWM Add pwm and aw_pwm to the GENERIC kernel Added: head/sys/arm/allwinner/aw_pwm.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Added: head/sys/arm/allwinner/aw_pwm.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/aw_pwm.c Wed Dec 12 20:58:43 2018 (r342004) @@ -0,0 +1,340 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Emmanuel Vadot + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include "pwm_if.h" + +#defineAW_PWM_CTRL 0x00 +#define AW_PWM_CTRL_PRESCALE_MASK 0xF +#define AW_PWM_CTRL_EN (1 << 4) +#define AW_PWM_CTRL_ACTIVE_LEVEL_HIGH (1 << 5) +#define AW_PWM_CTRL_GATE (1 << 6) +#define AW_PWM_CTRL_MODE_MASK 0x80 +#define AW_PWM_CTRL_PULSE_MODE (1 << 7) +#define AW_PWM_CTRL_CYCLE_MODE (0 << 7) +#define AW_PWM_CTRL_PULSE_START(1 << 8) +#define AW_PWM_CTRL_CLK_BYPASS (1 << 9) +#define AW_PWM_CTRL_PERIOD_BUSY(1 << 28) + +#defineAW_PWM_PERIOD 0x04 +#defineAW_PWM_PERIOD_TOTAL_MASK0x +#defineAW_PWM_PERIOD_TOTAL_SHIFT 16 +#defineAW_PWM_PERIOD_ACTIVE_MASK 0x +#defineAW_PWM_PERIOD_ACTIVE_SHIFT 0 + +#defineAW_PWM_MAX_FREQ 2400 + +#defineNS_PER_SEC 10 + +static struct ofw_compat_data compat_data[] = { + { "allwinner,sun5i-a13-pwm",1 }, + { NULL, 0 } +}; + +static struct resource_spec aw_pwm_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +struct aw_pwm_softc { + device_tdev; + device_tbusdev; + clk_t clk; + struct resource *res; + + uint64_tclk_freq; + uint64_tperiod; + uint64_tduty; + uint32_tflags; + boolenabled; +}; + +static uint32_t aw_pwm_clk_prescaler[] = { + 120, + 180, + 240, + 360, + 480, + 0, + 0, + 0, + 12000, + 24000, + 36000, + 48000, + 72000, + 0, + 0, + 1, +}; + +#defineAW_PWM_READ(sc, reg)bus_read_4((sc)->res, (reg)) +#defineAW_PWM_WRITE(sc, reg, val) bus_write_4((sc)->res, (reg), (val)) + +static int aw_pwm_probe(device_t dev); +static int aw_pwm_attach(device_t dev); +static int aw_pwm_detach(device_t dev); + +static int +aw_pwm_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (ENXIO); + + device_set_desc(dev, "Allwinner PWM"); + return (BUS_PROBE_DEFAULT); +} + +static int +aw_pwm_attach(device_t dev) +{ + struct aw_pwm_softc *sc; + /* uint32_t reg; */ + int error; + + sc = device_get_softc(dev); + sc->dev = dev; + + error = clk_get_by_ofw_index(dev, 0, 0, >clk); + if (error != 0) { +
svn commit: r342003 - in head: share/man/man9 sys/conf sys/dev/pwm sys/sys usr.sbin usr.sbin/pwm
Author: manu Date: Wed Dec 12 20:56:56 2018 New Revision: 342003 URL: https://svnweb.freebsd.org/changeset/base/342003 Log: Add a pwm subsystem so we can configure pwm controller from kernel and userland. The pwm subsystem consist of API for PWM controllers, pwmbus to register them and a pwm(8) utility to talk to them from userland. Reviewed by: oshgobo (capsicum), bcr (manpage), 0mp (manpage) Differential Revision:https://reviews.freebsd.org/D17938 Added: head/share/man/man9/pwm.9 (contents, props changed) head/share/man/man9/pwmbus.9 (contents, props changed) head/sys/dev/pwm/ head/sys/dev/pwm/ofw_pwm.c (contents, props changed) head/sys/dev/pwm/pwm_if.m (contents, props changed) head/sys/dev/pwm/pwmbus.c (contents, props changed) head/sys/dev/pwm/pwmbus.h (contents, props changed) head/sys/dev/pwm/pwmbus_if.m (contents, props changed) head/sys/dev/pwm/pwmc.c (contents, props changed) head/sys/sys/pwm.h (contents, props changed) head/usr.sbin/pwm/ head/usr.sbin/pwm/Makefile (contents, props changed) head/usr.sbin/pwm/pwm.8 (contents, props changed) head/usr.sbin/pwm/pwm.c (contents, props changed) Modified: head/share/man/man9/Makefile head/sys/conf/files head/usr.sbin/Makefile Modified: head/share/man/man9/Makefile == --- head/share/man/man9/MakefileWed Dec 12 20:40:01 2018 (r342002) +++ head/share/man/man9/MakefileWed Dec 12 20:56:56 2018 (r342003) @@ -269,6 +269,8 @@ MAN=accept_filter.9 \ proc_rwmem.9 \ pseudofs.9 \ psignal.9 \ + pwm.9 \ + pwmbus.9 \ random.9 \ random_harvest.9 \ ratecheck.9 \ Added: head/share/man/man9/pwm.9 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/pwm.9 Wed Dec 12 20:56:56 2018(r342003) @@ -0,0 +1,93 @@ +.\" Copyright (c) 2018 Emmanuel Vadot +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 12, 2018 +.Dt PWM 9 +.Os +.Sh NAME +.Nm pwm , +.Nm PWM_GET_BUS , +.Nm PWM_CHANNEL_CONFIG , +.Nm PWM_CHANNEL_GET_CONFIG , +.Nm PWM_CHANNEL_SET_FLAGS , +.Nm PWM_CHANNEL_GET_FLAGS , +.Nm PWM_CHANNEL_ENABLE , +.Nm PWM_CHANNEL_IS_ENABLED , +.Nm PWM_CHANNEL_MAX +.Nd PWM methods +.Sh SYNOPSIS +.Cd "device pwm" +.In "pwm_if.h" +.Ft device_t +.Fn PWM_GET_BUS "device_t dev" +.Ft int +.Fn PWM_CHANNEL_CONFIG "device_t dev" "int channel" "uint64_t period" "uint64_t duty" +.Ft int +.Fn PWM_CHANNEL_GET_CONFIG "device_t dev" "int channel" "uint64_t *period" "uint64_t *duty" +.Ft int +.Fn PWM_CHANNEL_SET_FLAGS "device_t dev" "int channel" "uint32_t flags" +.Ft int +.Fn PWM_CHANNEL_GET_FLAGS "device_t dev" "int channel" "uint32_t *flags" +.Ft int +.Fn PWM_CHANNEL_ENABLE "device_t dev" "int channel" "bool enable" +.Ft int +.Fn PWM_CHANNEL_IS_ENABLED "device_t dev" "int channel" "bool *enabled" +.Ft int +.Fn PWM_CHANNEL_MAX "device_t dev" "int channel" "int *nchannel" +.Sh DESCRIPTION +The PWM (Pulse-Width Modulation) interface allows the device driver to register to a global +bus so other devices in the kernel can use them in a generic way. +.Sh INTERFACE +.Bl -tag -width indent +.It Fn PWM_GET_BUS "device_t dev" +Return the bus device. +.It Fn PWM_CHANNEL_CONFIG "device_t dev" "int channel" "uint64_t period" "uint64_t duty" +Configure the period and duty (in nanoseconds) in the PWM controller for the specified channel. +Returns 0 on success or +.Er EINVAL +if the values are not supported by the controller or +.Er EBUSY +is the PWM controller is in
svn commit: r342002 - head/sys/conf
Author: sobomax Date: Wed Dec 12 20:40:01 2018 New Revision: 342002 URL: https://svnweb.freebsd.org/changeset/base/342002 Log: Add NETGRAPH_CHECKSUM. MFC after:1 week Modified: head/sys/conf/options Modified: head/sys/conf/options == --- head/sys/conf/options Wed Dec 12 20:32:17 2018(r342001) +++ head/sys/conf/options Wed Dec 12 20:40:01 2018(r342002) @@ -504,6 +504,7 @@ NETGRAPH_BLUETOOTH_UBTBCMFW opt_netgraph.h NETGRAPH_BPF opt_netgraph.h NETGRAPH_BRIDGEopt_netgraph.h NETGRAPH_CAR opt_netgraph.h +NETGRAPH_CHECKSUM opt_netgraph.h NETGRAPH_CISCO opt_netgraph.h NETGRAPH_DEFLATE opt_netgraph.h NETGRAPH_DEVICEopt_netgraph.h ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342001 - head/lib/libcapsicum
Author: oshogbo Date: Wed Dec 12 20:32:17 2018 New Revision: 342001 URL: https://svnweb.freebsd.org/changeset/base/342001 Log: libcapsicum: add missing links Reported by: manu Modified: head/lib/libcapsicum/Makefile Modified: head/lib/libcapsicum/Makefile == --- head/lib/libcapsicum/Makefile Wed Dec 12 20:19:56 2018 (r342000) +++ head/lib/libcapsicum/Makefile Wed Dec 12 20:32:17 2018 (r342001) @@ -9,6 +9,8 @@ MAN+= capsicum_helpers.3 MLINKS+=capsicum_helpers.3 caph_enter.3 MLINKS+=capsicum_helpers.3 caph_enter_casper.3 MLINKS+=capsicum_helpers.3 caph_rights_limit.3 +MLINKS+=capsicum_helpers.3 caph_fcntls_limit.3 +MLINKS+=capsicum_helpers.3 caph_ioctls_limit.3 MLINKS+=capsicum_helpers.3 caph_limit_stream.3 MLINKS+=capsicum_helpers.3 caph_limit_stdin.3 MLINKS+=capsicum_helpers.3 caph_limit_stderr.3 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342000 - head/tests/sys/netpfil/pf
Author: kp Date: Wed Dec 12 20:19:56 2018 New Revision: 342000 URL: https://svnweb.freebsd.org/changeset/base/342000 Log: pf tests: Basic rdr test MFC after:2 weeks Added: head/tests/sys/netpfil/pf/rdr.sh (contents, props changed) Modified: head/tests/sys/netpfil/pf/Makefile Modified: head/tests/sys/netpfil/pf/Makefile == --- head/tests/sys/netpfil/pf/Makefile Wed Dec 12 20:19:18 2018 (r341999) +++ head/tests/sys/netpfil/pf/Makefile Wed Dec 12 20:19:56 2018 (r342000) @@ -12,6 +12,7 @@ ATF_TESTS_SH+=anchor \ names \ nat \ set_tos \ + rdr \ route_to \ synproxy \ set_skip \ Added: head/tests/sys/netpfil/pf/rdr.sh == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/pf/rdr.shWed Dec 12 20:19:56 2018 (r342000) @@ -0,0 +1,48 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "basic" "cleanup" +basic_head() +{ + atf_set descr 'Basic rdr test' + atf_set require.user root +} + +basic_body() +{ + pft_init + + epair=$(pft_mkepair) + + pft_mkjail alcatraz ${epair}b + + ifconfig ${epair}a 192.0.2.2/24 up + route add -net 198.51.100.0/24 192.0.2.1 + + jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up + jexec alcatraz sysctl net.inet.ip.forwarding=1 + + # Enable pf! + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "rdr pass on ${epair}b proto tcp from any to 198.51.100.0/24 port 1234 -> 192.0.2.1 port 4321" + + echo "foo" | jexec alcatraz nc -N -l 4321 & + sleep 1 + + result=$(nc -N -w 3 198.51.100.2 1234) + if [ "$result" != "foo" ]; then + atf_fail "Redirect failed" + fi +} + +basic_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "basic" +} ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341999 - head/tests/sys/netpfil/pf
Author: kp Date: Wed Dec 12 20:19:18 2018 New Revision: 341999 URL: https://svnweb.freebsd.org/changeset/base/341999 Log: pf tests: NAT exhaustion test It's been reported that pf doesn't handle running out of available ports for NAT correctly. It freezes until a state expires and it can find a free port. Test for this, by setting up a situation where only two ports are available for NAT and then attempting to create three connections. If successful the third connection will fail immediately. In an incorrect case the connection attempt will freeze, also freezing all interaction with pf through pfctl and trigger timeout. PR: 233867 MFC after:2 weeks Added: head/tests/sys/netpfil/pf/nat.sh (contents, props changed) Modified: head/tests/sys/netpfil/pf/Makefile Modified: head/tests/sys/netpfil/pf/Makefile == --- head/tests/sys/netpfil/pf/Makefile Wed Dec 12 20:15:06 2018 (r341998) +++ head/tests/sys/netpfil/pf/Makefile Wed Dec 12 20:19:18 2018 (r341999) @@ -10,6 +10,7 @@ ATF_TESTS_SH+=anchor \ forward \ fragmentation \ names \ + nat \ set_tos \ route_to \ synproxy \ Added: head/tests/sys/netpfil/pf/nat.sh == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/pf/nat.shWed Dec 12 20:19:18 2018 (r341999) @@ -0,0 +1,64 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "exhaust" "cleanup" +exhaust_head() +{ + atf_set descr 'Test exhausting the NAT pool' + atf_set require.user root +} + +exhaust_body() +{ + pft_init + + epair_nat=$(pft_mkepair) + epair_echo=$(pft_mkepair) + + pft_mkjail nat ${epair_nat}b ${epair_echo}a + pft_mkjail echo ${epair_echo}b + + ifconfig ${epair_nat}a 192.0.2.2/24 up + route add -net 198.51.100.0/24 192.0.2.1 + + jexec nat ifconfig ${epair_nat}b 192.0.2.1/24 up + jexec nat ifconfig ${epair_echo}a 198.51.100.1/24 up + jexec nat sysctl net.inet.ip.forwarding=1 + + jexec echo ifconfig ${epair_echo}b 198.51.100.2/24 up + jexec echo /usr/sbin/inetd $(atf_get_srcdir)/echo_inetd.conf + + # Enable pf! + jexec nat pfctl -e + pft_set_rules nat \ + "nat pass on ${epair_echo}a inet from 192.0.2.0/24 to any -> (${epair_echo}a) port 3:30001 sticky-address" + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 3 198.51.100.2 + + echo "foo" | nc -N 198.51.100.2 7 + echo "foo" | nc -N 198.51.100.2 7 + + # This one will fail, but that's expected + echo "foo" | nc -N 198.51.100.2 7 & + + sleep 1 + + # If the kernel is stuck in pf_get_sport() this will not succeed either. + timeout 2 jexec nat pfctl -sa + if [ $? -eq 124 ]; then + # Timed out + atf_fail "pfctl timeout" + fi +} + +exhaust_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "exhaust" +} ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341998 - head/sys/netpfil/pf
Author: kp Date: Wed Dec 12 20:15:06 2018 New Revision: 341998 URL: https://svnweb.freebsd.org/changeset/base/341998 Log: pf: Fix endless loop on NAT exhaustion with sticky-address When we try to find a source port in pf_get_sport() it's possible that all available source ports will be in use. In that case we call pf_map_addr() to try to find a new source IP to try from. If there are no more available source IPs pf_map_addr() will return 1 and we stop trying. However, if sticky-address is set we'll always return the same IP address, even if we've already tried that one. We need to check the supplied address, because if that's the one we'd set it means pf_get_sport() has already tried it, and we should error out rather than keep trying. PR: 233867 MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D18483 Modified: head/sys/netpfil/pf/pf.c head/sys/netpfil/pf/pf_lb.c Modified: head/sys/netpfil/pf/pf.c == --- head/sys/netpfil/pf/pf.cWed Dec 12 19:58:54 2018(r341997) +++ head/sys/netpfil/pf/pf.cWed Dec 12 20:15:06 2018(r341998) @@ -5513,6 +5513,8 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, dst.sin_len = sizeof(dst); dst.sin_addr = ip->ip_dst; + bzero(, sizeof(naddr)); + if (TAILQ_EMPTY(>rpool.list)) { DPFPRINTF(PF_DEBUG_URGENT, ("%s: TAILQ_EMPTY(>rpool.list)\n", __func__)); @@ -5671,6 +5673,8 @@ pf_route6(struct mbuf **m, struct pf_rule *r, int dir, dst.sin6_family = AF_INET6; dst.sin6_len = sizeof(dst); dst.sin6_addr = ip6->ip6_dst; + + bzero(, sizeof(naddr)); if (TAILQ_EMPTY(>rpool.list)) { DPFPRINTF(PF_DEBUG_URGENT, Modified: head/sys/netpfil/pf/pf_lb.c == --- head/sys/netpfil/pf/pf_lb.c Wed Dec 12 19:58:54 2018(r341997) +++ head/sys/netpfil/pf/pf_lb.c Wed Dec 12 20:15:06 2018(r341998) @@ -328,6 +328,12 @@ pf_map_addr(sa_family_t af, struct pf_rule *r, struct src node was created just a moment ago in pf_create_state and it needs to be filled in with routing decision calculated here. */ if (*sn != NULL && !PF_AZERO(&(*sn)->raddr, af)) { + /* If the supplied address is the same as the current one we've +* been asked before, so tell the caller that there's no other +* address to be had. */ + if (PF_AEQ(naddr, &(*sn)->raddr, af)) + return (1); + PF_ACPY(naddr, &(*sn)->raddr, af); if (V_pf_status.debug >= PF_DEBUG_MISC) { printf("pf_map_addr: src tracking maps "); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341997 - head/usr.bin/calendar/calendars
Author: syrinx Date: Wed Dec 12 19:58:54 2018 New Revision: 341997 URL: https://svnweb.freebsd.org/changeset/base/341997 Log: Add myself to the calendar Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd == --- head/usr.bin/calendar/calendars/calendar.freebsdWed Dec 12 19:02:37 2018(r341996) +++ head/usr.bin/calendar/calendars/calendar.freebsdWed Dec 12 19:58:54 2018(r341997) @@ -425,6 +425,7 @@ 11/19 Konstantin Belousov born in Kiev, USSR, 1972 11/20 Dmitry Morozovsky born in Moscow, USSR, 1968 11/20 Gavin Atkinson born in Middlesbrough, United Kingdom, 1979 +11/21 Shteryana Shopova born in Petrich, Bulgaria, 1982 11/21 Mark Johnston born in Toronto, Ontario, Canada, 1989 11/22 Frederic Culot born in Saint-Germain-En-Laye, France, 1976 11/23 Josef Lawrence Karthauser born in Pembury, Kent, United Kingdom, 1972 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341996 - head/sys/conf
Author: sobomax Date: Wed Dec 12 19:02:37 2018 New Revision: 341996 URL: https://svnweb.freebsd.org/changeset/base/341996 Log: Add NETGRAPH_CHECKSUM. MFC after:1 week Modified: head/sys/conf/NOTES head/sys/conf/files Modified: head/sys/conf/NOTES == --- head/sys/conf/NOTES Wed Dec 12 18:18:34 2018(r341995) +++ head/sys/conf/NOTES Wed Dec 12 19:02:37 2018(r341996) @@ -767,6 +767,7 @@ options NETGRAPH_BLUETOOTH_UBTBCMFW # ubtbcmfw(4) optionsNETGRAPH_BPF optionsNETGRAPH_BRIDGE optionsNETGRAPH_CAR +optionsNETGRAPH_CHECKSUM optionsNETGRAPH_CISCO optionsNETGRAPH_DEFLATE optionsNETGRAPH_DEVICE Modified: head/sys/conf/files == --- head/sys/conf/files Wed Dec 12 18:18:34 2018(r341995) +++ head/sys/conf/files Wed Dec 12 19:02:37 2018(r341996) @@ -4212,6 +4212,7 @@ netgraph/ng_base.coptional netgraph netgraph/ng_bpf.c optional netgraph_bpf netgraph/ng_bridge.c optional netgraph_bridge netgraph/ng_car.c optional netgraph_car +netgraph/ng_checksum.c optional netgraph_checksum netgraph/ng_cisco.coptional netgraph_cisco netgraph/ng_deflate.c optional netgraph_deflate netgraph/ng_device.c optional netgraph_device ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341995 - stable/11/release
Author: gjb Date: Wed Dec 12 18:18:34 2018 New Revision: 341995 URL: https://svnweb.freebsd.org/changeset/base/341995 Log: MFC r339873: Set OPTIONS_UNSET in the argument list to env(1), and add AVAHI to the list. This fixes the textproc/docproj build seemingly following FLAVORS being added. Specifically, the problem with the dependency chain here is: - textproc/docproj depends on print/cups, which sets AVAHI=on by default; - net/avahi-app depends on devel/gobject-introspection, which requires python3+; - graphics/netpbm depends on graphics/mesa-libs, which can only be built with python2.7; - textproc/docproj depends on a number of graphics ports for font rendering, etc. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/release.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/release/release.sh == --- stable/11/release/release.shWed Dec 12 18:13:56 2018 (r341994) +++ stable/11/release/release.shWed Dec 12 18:18:34 2018 (r341995) @@ -287,9 +287,9 @@ extra_chroot_setup() { PBUILD_FLAGS="${PBUILD_FLAGS} OSREL=${REVISION}" PBUILD_FLAGS="${PBUILD_FLAGS} WRKDIRPREFIX=/tmp/ports" PBUILD_FLAGS="${PBUILD_FLAGS} DISTDIR=/tmp/distfiles" - chroot ${CHROOTDIR} env ${PBUILD_FLAGS} make -C \ + chroot ${CHROOTDIR} env ${PBUILD_FLAGS} \ + OPTIONS_UNSET="AVAHI FOP IGOR" make -C \ /usr/ports/textproc/docproj \ - OPTIONS_UNSET="FOP IGOR" \ FORCE_PKG_REGISTER=1 \ install clean distclean fi ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341994 - head/sys/geom/mirror
Author: cem Date: Wed Dec 12 18:13:56 2018 New Revision: 341994 URL: https://svnweb.freebsd.org/changeset/base/341994 Log: gmirror: Remove a last-minute INVARIANTS breakage in r341840 I mistakenly added a lock assertion to this routine at the last minute without confirming it was held during g_mirror_create. It isn't (it isn't even initialized yet). Mea culpa. Access is exclusive in both callers, just not always by that particular lock. Reported by: lwhsu X-MFC-With: r341840, r341674 Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c == --- head/sys/geom/mirror/g_mirror.c Wed Dec 12 17:05:47 2018 (r341993) +++ head/sys/geom/mirror/g_mirror.c Wed Dec 12 18:13:56 2018 (r341994) @@ -3061,8 +3061,6 @@ g_mirror_reinit_from_metadata(struct g_mirror_softc *s const struct g_mirror_metadata *md) { - sx_assert(>sc_lock, SX_XLOCKED); - sc->sc_genid = md->md_genid; sc->sc_syncid = md->md_syncid; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341993 - head/share/man/man4
Author: vmaffione Date: Wed Dec 12 17:05:47 2018 New Revision: 341993 URL: https://svnweb.freebsd.org/changeset/base/341993 Log: netmap: add man page for ptnet Add a man page for ptnet(4), describing the guest driver for netmap passthrough. Reviewed by: bcr MFC after:3 days Differential Revision:https://reviews.freebsd.org/D18518 Added: head/share/man/man4/ptnet.4 (contents, props changed) Added: head/share/man/man4/ptnet.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ptnet.4 Wed Dec 12 17:05:47 2018(r341993) @@ -0,0 +1,140 @@ +.\" Copyright (c) 2018 Vincenzo Maffione +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 11, 2018 +.Dt PTNET 4 +.Os +.Sh NAME +.Nm ptnet +.Nd Ethernet driver for passed-through netmap ports +.Sh SYNOPSIS +This network driver is included in +.Xr netmap 4 , +and it can be compiled into the kernel by adding the following +line in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device netmap" +.Ed +.Sh DESCRIPTION +The +.Nm +device driver provides direct access to host netmap ports, +from within a Virtual Machine (VM). +Applications running inside +the VM can access the TX/RX rings and buffers of a netmap port +that the hypervisor has passed-through to the VM. +Hypervisor support for +.Nm +is currently available for QEMU/KVM. +Any +.Xr netmap 4 +port can be passed-through, including physical NICs, +.Xr vale 4 +ports, netmap pipes, etc. +.Pp +The main use-case for netmap passthrough is Network Function +Virtualization (NFV), where middlebox applications running within +VMs may want to process very high packet rates (e.g., 1-10 millions +packets per second or more). +Note, however, that those applications +must use the device in netmap mode in order to achieve such rates. +In addition to the general advantages of netmap, the improved +performance of +.Nm +when compared to hypervisor device emulation or paravirtualization (e.g., +.Xr vtnet 4 , +.Xr vmx 4 ) +comes from the hypervisor being completely bypassed in the data-path. +For example, when using +.Xr vtnet 4 +the VM has to convert each +.Xr mbuf 9 +to a VirtIO-specific packet representation +and publish that to a VirtIO queue; on the hypervisor side, the +packet is extracted from the VirtIO queue and converted to a +hypervisor-specific packet representation. +The overhead of format conversions (and packet copies, in same cases) is not +incured by +.Nm +in netmap mode, because mbufs are not used at all, and the packet format +is the one defined by netmap (e.g., +.Ar struct netmap_slot ) +along the whole data-path. +No format conversions or copies happen. +.Pp +It is also possible to use a +.Nm +device like a regular network interface, which interacts with the +.Fx +network stack (i.e., not in netmap mode). +However, in that case it is necessary to pay the cost of data copies +between mbufs and netmap buffers, which generally results in lower +TCP/UDP performance than +.Xr vtnet 4 +or other paravirtualized network devices. +If the passed-through netmap port supports the VirtIO network header, +.Nm +is able to use it, and support TCP/UDP checksum offload (for both transmit +and receive), TCP segmentation offload (TSO) and TCP large receive offload +(LRO). +Currently, +.Xr vale 4 +ports support the header. +Note that the VirtIO network header is generally not used in NFV +use-cases, because middleboxes are not endpoints of TCP/UDP connections. +.Sh TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel
svn commit: r341992 - head/sys/dev/netmap
Author: vmaffione Date: Wed Dec 12 16:32:15 2018 New Revision: 341992 URL: https://svnweb.freebsd.org/changeset/base/341992 Log: netmap: fix warning in netmap_kloop.c Reported by: markj MFC after:3 days Modified: head/sys/dev/netmap/netmap_kloop.c Modified: head/sys/dev/netmap/netmap_kloop.c == --- head/sys/dev/netmap/netmap_kloop.c Wed Dec 12 16:25:30 2018 (r341991) +++ head/sys/dev/netmap/netmap_kloop.c Wed Dec 12 16:32:15 2018 (r341992) @@ -111,6 +111,7 @@ csb_ktoa_kick_enable(struct nm_csb_ktoa __user *csb_kt CSB_WRITE(csb_ktoa, kern_need_kick, val); } +#ifdef SYNC_KLOOP_POLL /* Are application interrupt enabled or disabled? */ static inline uint32_t csb_atok_intr_enabled(struct nm_csb_atok __user *csb_atok) @@ -121,6 +122,7 @@ csb_atok_intr_enabled(struct nm_csb_atok __user *csb_a return v; } +#endif /* SYNC_KLOOP_POLL */ static inline void sync_kloop_kring_dump(const char *title, const struct netmap_kring *kring) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341991 - stable/12/contrib/elftoolchain/readelf
Author: sobomax Date: Wed Dec 12 16:25:30 2018 New Revision: 341991 URL: https://svnweb.freebsd.org/changeset/base/341991 Log: MFC: r340745, fix CU: output of the --debug-dump=decodedline. Modified: stable/12/contrib/elftoolchain/readelf/readelf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/elftoolchain/readelf/readelf.c == --- stable/12/contrib/elftoolchain/readelf/readelf.cWed Dec 12 15:49:14 2018(r341990) +++ stable/12/contrib/elftoolchain/readelf/readelf.cWed Dec 12 16:25:30 2018(r341991) @@ -4720,7 +4720,7 @@ dump_dwarf_line_decoded(struct readelf *re) DW_DLV_OK) dir = NULL; printf("CU: "); - if (dir && file) + if (dir && file && file[0] != '/') printf("%s/", dir); if (file) printf("%s", file); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341990 - head/sys/dev/bwn
Author: markj Date: Wed Dec 12 15:49:14 2018 New Revision: 341990 URL: https://svnweb.freebsd.org/changeset/base/341990 Log: Fix a possible mbuf double free in bwn_dma_tx_start(). If bus_dmamap_load_mbuf() fails following a defrag, the caller of bwn_dma_tx_start() would free the original mbuf after m_defrag() had already done so. Fix this by returning the defragged mbuf to the caller instead. Update bwn_pio_tx_start() similarly for consistency. Reported by: Ilja Van Sprundel Reviewed by: landonf Tested by:landonf MFC after:3 days admbug: 820 Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D18342 Modified: head/sys/dev/bwn/if_bwn.c Modified: head/sys/dev/bwn/if_bwn.c == --- head/sys/dev/bwn/if_bwn.c Wed Dec 12 15:23:40 2018(r341989) +++ head/sys/dev/bwn/if_bwn.c Wed Dec 12 15:49:14 2018(r341990) @@ -209,7 +209,7 @@ static void bwn_pio_rx_write_2(struct bwn_pio_rxqueue static voidbwn_pio_rx_write_4(struct bwn_pio_rxqueue *, uint16_t, uint32_t); static int bwn_pio_tx_start(struct bwn_mac *, struct ieee80211_node *, - struct mbuf *); + struct mbuf **); static struct bwn_pio_txqueue *bwn_pio_select(struct bwn_mac *, uint8_t); static uint32_tbwn_pio_write_multi_4(struct bwn_mac *, struct bwn_pio_txqueue *, uint32_t, const void *, int); @@ -273,7 +273,7 @@ static void bwn_ratectl_tx_complete(const struct ieee8 static voidbwn_dma_handle_txeof(struct bwn_mac *, const struct bwn_txstatus *); static int bwn_dma_tx_start(struct bwn_mac *, struct ieee80211_node *, - struct mbuf *); + struct mbuf **); static int bwn_dma_getslot(struct bwn_dma_ring *); static struct bwn_dma_ring *bwn_dma_select(struct bwn_mac *, uint8_t); @@ -1068,7 +1068,7 @@ bwn_tx_start(struct bwn_softc *sc, struct ieee80211_no } error = (mac->mac_flags & BWN_MAC_FLAG_DMA) ? - bwn_dma_tx_start(mac, ni, m) : bwn_pio_tx_start(mac, ni, m); + bwn_dma_tx_start(mac, ni, ) : bwn_pio_tx_start(mac, ni, ); if (error) { m_freem(m); return (error); @@ -1077,13 +1077,14 @@ bwn_tx_start(struct bwn_softc *sc, struct ieee80211_no } static int -bwn_pio_tx_start(struct bwn_mac *mac, struct ieee80211_node *ni, struct mbuf *m) +bwn_pio_tx_start(struct bwn_mac *mac, struct ieee80211_node *ni, +struct mbuf **mp) { struct bwn_pio_txpkt *tp; - struct bwn_pio_txqueue *tq = bwn_pio_select(mac, M_WME_GETAC(m)); + struct bwn_pio_txqueue *tq; struct bwn_softc *sc = mac->mac_sc; struct bwn_txhdr txhdr; - struct mbuf *m_new; + struct mbuf *m, *m_new; uint32_t ctl32; int error; uint16_t ctl16; @@ -1092,6 +1093,8 @@ bwn_pio_tx_start(struct bwn_mac *mac, struct ieee80211 /* XXX TODO send packets after DTIM */ + m = *mp; + tq = bwn_pio_select(mac, M_WME_GETAC(m)); KASSERT(!TAILQ_EMPTY(>tq_pktlist), ("%s: fail", __func__)); tp = TAILQ_FIRST(>tq_pktlist); tp->tp_ni = ni; @@ -,13 +1114,14 @@ bwn_pio_tx_start(struct bwn_mac *mac, struct ieee80211 /* * XXX please removes m_defrag(9) */ - m_new = m_defrag(m, M_NOWAIT); + m_new = m_defrag(*mp, M_NOWAIT); if (m_new == NULL) { device_printf(sc->sc_dev, "%s: can't defrag TX buffer\n", __func__); return (ENOBUFS); } + *mp = m_new; if (m_new->m_next != NULL) device_printf(sc->sc_dev, "TODO: fragmented packets for PIO\n"); @@ -1168,15 +1172,17 @@ bwn_pio_select(struct bwn_mac *mac, uint8_t prio) } static int -bwn_dma_tx_start(struct bwn_mac *mac, struct ieee80211_node *ni, struct mbuf *m) +bwn_dma_tx_start(struct bwn_mac *mac, struct ieee80211_node *ni, +struct mbuf **mp) { #defineBWN_GET_TXHDRCACHE(slot) \ &(txhdr_cache[(slot / BWN_TX_SLOTS_PER_FRAME) * BWN_HDRSIZE(mac)]) struct bwn_dma *dma = >mac_method.dma; - struct bwn_dma_ring *dr = bwn_dma_select(mac, M_WME_GETAC(m)); + struct bwn_dma_ring *dr = bwn_dma_select(mac, M_WME_GETAC(*mp)); struct bwn_dmadesc_generic *desc; struct bwn_dmadesc_meta *mt; struct bwn_softc *sc = mac->mac_sc; + struct mbuf *m; uint8_t *txhdr_cache = (uint8_t *)dr->dr_txhdr_cache; int error, slot, backup[2] = { dr->dr_curslot, dr->dr_usedslot }; @@ -1185,6 +1191,7 @@ bwn_dma_tx_start(struct bwn_mac
svn commit: r341989 - head
Author: emaste Date: Wed Dec 12 15:23:40 2018 New Revision: 341989 URL: https://svnweb.freebsd.org/changeset/base/341989 Log: Makefile.inc1: update stale wpa dependency removal statement Only stale .depend files are removed; do not mention object files. Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Wed Dec 12 13:43:55 2018(r341988) +++ head/Makefile.inc1 Wed Dec 12 15:23:40 2018(r341989) @@ -981,7 +981,7 @@ _cleanobj_fast_depend_hack: .PHONY @if [ -e "${OBJTOP}/usr.sbin/wpa/wpa_supplicant/.depend.rrm.o" ] && \ egrep -q 'src/ap/rrm.c' \ ${OBJTOP}/usr.sbin/wpa/wpa_supplicant/.depend.rrm.o; then \ - echo "Removing stale wpa dependencies and objects"; \ + echo "Removing stale wpa dependencies"; \ rm -f ${OBJTOP}/usr.sbin/wpa/*/.depend*; \ fi ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341988 - head/sys/dev/asmc
Author: dab Date: Wed Dec 12 13:43:55 2018 New Revision: 341988 URL: https://svnweb.freebsd.org/changeset/base/341988 Log: asmc: Add Support for Macbook Pro 8,1 PR: 217505 Submitted by: John O. Brickley , updated by Maciej Pasternacki Reported by: John O. Brickley MFC after:1 week Modified: head/sys/dev/asmc/asmc.c head/sys/dev/asmc/asmcvar.h Modified: head/sys/dev/asmc/asmc.c == --- head/sys/dev/asmc/asmc.cWed Dec 12 13:17:51 2018(r341987) +++ head/sys/dev/asmc/asmc.cWed Dec 12 13:43:55 2018(r341988) @@ -219,9 +219,15 @@ struct asmc_model asmc_models[] = { }, { + "MacBookPro8,1", "Apple SMC MacBook Pro (early 2011, 13-inch)", + ASMC_SMS_FUNCS_DISABLED, ASMC_FAN_FUNCS2, ASMC_LIGHT_FUNCS, + ASMC_MBP81_TEMPS, ASMC_MBP81_TEMPNAMES, ASMC_MBP81_TEMPDESCS + }, + + { "MacBookPro8,2", "Apple SMC MacBook Pro (early 2011)", ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS, - ASMC_MBP8_TEMPS, ASMC_MBP8_TEMPNAMES, ASMC_MBP8_TEMPDESCS + ASMC_MBP82_TEMPS, ASMC_MBP82_TEMPNAMES, ASMC_MBP82_TEMPDESCS }, { Modified: head/sys/dev/asmc/asmcvar.h == --- head/sys/dev/asmc/asmcvar.h Wed Dec 12 13:17:51 2018(r341987) +++ head/sys/dev/asmc/asmcvar.h Wed Dec 12 13:43:55 2018(r341988) @@ -218,21 +218,39 @@ struct asmc_softc { "Heatsink 2", "Memory Controller", \ "PCI Express Slot Pin", "PCI Express Slot (unk)" } -#define ASMC_MBP8_TEMPS{ "TB0T", "TB1T", "TB2T", "TC0C", "TC0D", \ +#define ASMC_MBP81_TEMPS { "TB0T", "TB1T", "TB2T", "TC0C", "TC0D", \ "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ + "TCFC", "TCGC", "TCSA", "TM0S", "TMBS", \ + "TP0P", "TPCD", "TW0P", "Th1H", "Ts0P", \ + "Ts0S", NULL } + +#define ASMC_MBP81_TEMPNAMES { "enclosure", "TB1T", "TB2T", "TC0C", "TC0D", \ + "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ + "TCFC", "TCGC", "TCSA", "TM0S", "TMBS", \ + "TP0P", "TPCD", "wireless", "Th1H", "Ts0P", \ + "Ts0S" } + +#define ASMC_MBP81_TEMPDESCS { "Enclosure Bottomside", "TB1T", "TB2T", "TC0C", "TC0D", \ + "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ + "TCFC", "TCGC", "TCSA", "TM0S", "TMBS", \ + "TP0P", "TPCD", "TW0P", "Th1H", "Ts0P", \ + "Ts0S" } + +#define ASMC_MBP82_TEMPS { "TB0T", "TB1T", "TB2T", "TC0C", "TC0D", \ + "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ "TC3C", "TC4C", "TCFC", "TCGC", "TCSA", \ "TCTD", "TG0D", "TG0P", "THSP", "TM0S", \ "TMBS", "TP0P", "TPCD", "TW0P", "Th1H", \ "Th2H", "Tm0P", "Ts0P", "Ts0S", NULL } -#define ASMC_MBP8_TEMPNAMES{ "enclosure", "TB1T", "TB2T", "TC0C", "TC0D", \ +#define ASMC_MBP82_TEMPNAMES { "enclosure", "TB1T", "TB2T", "TC0C", "TC0D", \ "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ "TC3C", "TC4C", "TCFC", "TCGC", "TCSA", \ "TCTD", "graphics", "TG0P", "THSP", "TM0S", \ "TMBS", "TP0P", "TPCD", "wireless", "Th1H", \ "Th2H", "memory", "Ts0P", "Ts0S" } -#define ASMC_MBP8_TEMPDESCS{ "Enclosure Bottomside", "TB1T", "TB2T", "TC0C", "TC0D", \ +#define ASMC_MBP82_TEMPDESCS { "Enclosure Bottomside", "TB1T", "TB2T", "TC0C", "TC0D", \ "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ "TC3C", "TC4C", "TCFC", "TCGC", "TCSA", \ "TCTD", "TG0D", "TG0P", "THSP", "TM0S", \ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341986 - in stable/12/sys/dev: mlx4/mlx4_core mlx4/mlx4_ib mlx5/mlx5_core mlx5/mlx5_en mlx5/mlx5_ib
Author: hselasky Date: Wed Dec 12 13:17:49 2018 New Revision: 341986 URL: https://svnweb.freebsd.org/changeset/base/341986 Log: MFC r341587: mlx4/mlx5: Updated driver version to 3.5.0 Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx4/mlx4_core/mlx4.h stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx4/mlx4_core/mlx4.h == --- stable/12/sys/dev/mlx4/mlx4_core/mlx4.h Wed Dec 12 13:16:39 2018 (r341985) +++ stable/12/sys/dev/mlx4/mlx4_core/mlx4.h Wed Dec 12 13:17:49 2018 (r341986) @@ -53,8 +53,8 @@ #define DRV_NAME "mlx4_core" #define PFXDRV_NAME ": " -#define DRV_VERSION"3.4.1" -#define DRV_RELDATE"October 2017" +#define DRV_VERSION"3.5.0" +#define DRV_RELDATE"November 2018" #define MLX4_FS_UDP_UC_EN (1 << 1) #define MLX4_FS_TCP_UC_EN (1 << 2) Modified: stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c == --- stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Wed Dec 12 13:16:39 2018(r341985) +++ stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Wed Dec 12 13:17:49 2018(r341986) @@ -64,9 +64,9 @@ #define DRV_NAME MLX4_IB_DRV_NAME #ifndef DRV_VERSION -#define DRV_VERSION"3.4.1" +#define DRV_VERSION"3.5.0" #endif -#define DRV_RELDATE"February 2018" +#define DRV_RELDATE"November 2018" #define MLX4_IB_FLOW_MAX_PRIO 0xFFF #define MLX4_IB_FLOW_QPN_MASK 0xFF Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.hWed Dec 12 13:16:39 2018(r341985) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.hWed Dec 12 13:17:49 2018(r341986) @@ -34,9 +34,9 @@ #define DRIVER_NAME "mlx5_core" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.4.2" +#define DRIVER_VERSION "3.5.0" #endif -#define DRIVER_RELDATE "July 2018" +#define DRIVER_RELDATE "November 2018" extern int mlx5_core_debug_mask; Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:16:39 2018(r341985) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:17:49 2018(r341986) @@ -31,8 +31,9 @@ #include #ifndef ETH_DRIVER_VERSION -#defineETH_DRIVER_VERSION "3.4.2" +#defineETH_DRIVER_VERSION "3.5.0" #endif +#define DRIVER_RELDATE "November 2018" static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c == --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 13:16:39 2018(r341985) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 13:17:49 2018(r341986) @@ -52,9 +52,9 @@ #define DRIVER_NAME "mlx5ib" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.4.2" +#define DRIVER_VERSION "3.5.0" #endif -#define DRIVER_RELDATE "July 2018" +#define DRIVER_RELDATE "November 2018" MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); MODULE_LICENSE("Dual BSD/GPL"); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341987 - in stable/11/sys/dev: mlx4/mlx4_core mlx4/mlx4_ib mlx5/mlx5_core mlx5/mlx5_en mlx5/mlx5_ib
Author: hselasky Date: Wed Dec 12 13:17:51 2018 New Revision: 341987 URL: https://svnweb.freebsd.org/changeset/base/341987 Log: MFC r341587: mlx4/mlx5: Updated driver version to 3.5.0 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx4/mlx4_core/mlx4.h stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx4/mlx4_core/mlx4.h == --- stable/11/sys/dev/mlx4/mlx4_core/mlx4.h Wed Dec 12 13:17:49 2018 (r341986) +++ stable/11/sys/dev/mlx4/mlx4_core/mlx4.h Wed Dec 12 13:17:51 2018 (r341987) @@ -53,8 +53,8 @@ #define DRV_NAME "mlx4_core" #define PFXDRV_NAME ": " -#define DRV_VERSION"3.4.1" -#define DRV_RELDATE"October 2017" +#define DRV_VERSION"3.5.0" +#define DRV_RELDATE"November 2018" #define MLX4_FS_UDP_UC_EN (1 << 1) #define MLX4_FS_TCP_UC_EN (1 << 2) Modified: stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c == --- stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Wed Dec 12 13:17:49 2018(r341986) +++ stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Wed Dec 12 13:17:51 2018(r341987) @@ -64,9 +64,9 @@ #define DRV_NAME MLX4_IB_DRV_NAME #ifndef DRV_VERSION -#define DRV_VERSION"3.4.1" +#define DRV_VERSION"3.5.0" #endif -#define DRV_RELDATE"February 2018" +#define DRV_RELDATE"November 2018" #define MLX4_IB_FLOW_MAX_PRIO 0xFFF #define MLX4_IB_FLOW_QPN_MASK 0xFF Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.hWed Dec 12 13:17:49 2018(r341986) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.hWed Dec 12 13:17:51 2018(r341987) @@ -34,9 +34,9 @@ #define DRIVER_NAME "mlx5_core" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.4.2" +#define DRIVER_VERSION "3.5.0" #endif -#define DRIVER_RELDATE "July 2018" +#define DRIVER_RELDATE "November 2018" extern int mlx5_core_debug_mask; Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:17:49 2018(r341986) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:17:51 2018(r341987) @@ -31,8 +31,9 @@ #include #ifndef ETH_DRIVER_VERSION -#defineETH_DRIVER_VERSION "3.4.2" +#defineETH_DRIVER_VERSION "3.5.0" #endif +#define DRIVER_RELDATE "November 2018" static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c == --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 13:17:49 2018(r341986) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 13:17:51 2018(r341987) @@ -52,9 +52,9 @@ #define DRIVER_NAME "mlx5ib" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.4.2" +#define DRIVER_VERSION "3.5.0" #endif -#define DRIVER_RELDATE "July 2018" +#define DRIVER_RELDATE "November 2018" MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); MODULE_LICENSE("Dual BSD/GPL"); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341985 - stable/12/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Dec 12 13:16:39 2018 New Revision: 341985 URL: https://svnweb.freebsd.org/changeset/base/341985 Log: MFC r341586: mlx5en: Implement backpressure indication. The backpressure indication is implemented using an unlimited rate type of mbuf send tag. When the upper layers typically the socket layer has obtained such a tag, it can then query the destination driver queue for the current amount of space available in the send queue. A single mbuf send tag may be referenced multiple times and a refcount has been added to the mlx5e_priv structure to track its usage. Because the send tag resides in the mlx5e_channel structure, there is no need to wait for refcounts to reach zero until the mlx4en(4) driver is detached. The channels structure is persistant during the lifetime of the mlx5en(4) driver it belongs to and can so be accessed without any need of synchronization. The mlx5e_snd_tag structure was extended to contain a type field, because there are now two different tag types which end up in the driver which need to be distinguished. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/en_rl.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h == --- stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 13:14:41 2018 (r341984) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 13:16:39 2018 (r341985) @@ -580,6 +580,11 @@ enum { MLX5E_SQ_FULL }; +struct mlx5e_snd_tag { + struct m_snd_tag m_snd_tag; /* send tag */ + u32 type; /* tag type */ +}; + struct mlx5e_sq { /* data path */ struct mtx lock; @@ -640,11 +645,27 @@ mlx5e_sq_has_room_for(struct mlx5e_sq *sq, u16 n) return ((sq->wq.sz_m1 & (cc - pc)) >= n || cc == pc); } +static inline u32 +mlx5e_sq_queue_level(struct mlx5e_sq *sq) +{ + u16 cc; + u16 pc; + + if (sq == NULL) + return (0); + + cc = sq->cc; + pc = sq->pc; + + return (((sq->wq.sz_m1 & (pc - cc)) * + IF_SND_QUEUE_LEVEL_MAX) / sq->wq.sz_m1); +} + struct mlx5e_channel { /* data path */ struct mlx5e_rq rq; + struct mlx5e_snd_tag tag; struct mlx5e_sq sq[MLX5E_MAX_TX_NUM_TC]; - struct ifnet *ifp; u32 mkey_be; u8 num_tc; @@ -770,6 +791,7 @@ struct mlx5e_priv { u32 pdn; u32 tdn; struct mlx5_core_mr mr; + volatile unsigned int channel_refs; u32 tisn[MLX5E_MAX_TX_NUM_TC]; u32 rqtn; @@ -907,6 +929,24 @@ mlx5e_cq_arm(struct mlx5e_cq *cq, spinlock_t *dblock) mcq = >mcq; mlx5_cq_arm(mcq, MLX5_CQ_DB_REQ_NOT, mcq->uar->map, dblock, cq->wq.cc); +} + +static inline void +mlx5e_ref_channel(struct mlx5e_priv *priv) +{ + + KASSERT(priv->channel_refs < INT_MAX, + ("Channel refs will overflow")); + atomic_fetchadd_int(>channel_refs, 1); +} + +static inline void +mlx5e_unref_channel(struct mlx5e_priv *priv) +{ + + KASSERT(priv->channel_refs > 0, + ("Channel refs is not greater than zero")); + atomic_fetchadd_int(>channel_refs, -1); } extern const struct ethtool_ops mlx5e_ethtool_ops; Modified: stable/12/sys/dev/mlx5/mlx5_en/en_rl.h == --- stable/12/sys/dev/mlx5/mlx5_en/en_rl.h Wed Dec 12 13:14:41 2018 (r341984) +++ stable/12/sys/dev/mlx5/mlx5_en/en_rl.h Wed Dec 12 13:16:39 2018 (r341985) @@ -129,7 +129,7 @@ struct mlx5e_rl_channel_param { }; struct mlx5e_rl_channel { - struct m_snd_tag m_snd_tag; + struct mlx5e_snd_tag tag; STAILQ_ENTRY(mlx5e_rl_channel) entry; struct mlx5e_sq * volatile sq; struct mlx5e_rl_worker *worker; Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:14:41 2018(r341984) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:16:39 2018(r341985) @@ -884,7 +884,7 @@ mlx5e_create_rq(struct mlx5e_channel *c, wq_sz = mlx5_wq_ll_get_size(>wq); - err = -tcp_lro_init_args(>lro, c->ifp, TCP_LRO_ENTRIES, wq_sz); + err = -tcp_lro_init_args(>lro, c->tag.m_snd_tag.ifp, TCP_LRO_ENTRIES, wq_sz); if (err) goto err_rq_wq_destroy; @@ -914,7 +914,7 @@ mlx5e_create_rq(struct mlx5e_channel *c, #endif } - rq->ifp = c->ifp; + rq->ifp = c->tag.m_snd_tag.ifp; rq->channel = c; rq->ix = c->ix;
svn commit: r341983 - stable/11/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Dec 12 13:13:50 2018 New Revision: 341983 URL: https://svnweb.freebsd.org/changeset/base/341983 Log: MFC r341585: mlx5en: Improve configuration of HW LRO. In order to enable HW LRO, both the "hw_lro" sysctl in the mlx5en(4) config space must be set, and the ifconfig(8) LRO capability must be set. Any other settings will disable HW LRO. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 13:13:39 2018(r341982) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 13:13:50 2018(r341983) @@ -669,21 +669,24 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_close_locked(priv->ifp); /* import HW LRO mode */ - if (priv->params_ethtool.hw_lro != 0) { - if ((priv->ifp->if_capenable & IFCAP_LRO) && - MLX5_CAP_ETH(priv->mdev, lro_cap)) { - priv->params.hw_lro_en = 1; - priv->params_ethtool.hw_lro = 1; + if (priv->params_ethtool.hw_lro != 0 && + MLX5_CAP_ETH(priv->mdev, lro_cap)) { + priv->params_ethtool.hw_lro = 1; + /* check if feature should actually be enabled */ + if (priv->ifp->if_capenable & IFCAP_LRO) { + priv->params.hw_lro_en = true; } else { - priv->params.hw_lro_en = 0; - priv->params_ethtool.hw_lro = 0; - error = EINVAL; + priv->params.hw_lro_en = false; - if_printf(priv->ifp, "Can't enable HW LRO: " - "The HW or SW LRO feature is disabled\n"); + if_printf(priv->ifp, "To enable HW LRO " + "please also enable LRO via ifconfig(8).\n"); } } else { - priv->params.hw_lro_en = 0; + /* return an error if HW does not support this feature */ + if (priv->params_ethtool.hw_lro != 0) + error = EINVAL; + priv->params.hw_lro_en = false; + priv->params_ethtool.hw_lro = 0; } /* restart network interface, if any */ if (was_opened) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:13:39 2018(r341982) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:13:50 2018(r341983) @@ -2788,12 +2788,18 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t bool need_restart = false; ifp->if_capenable ^= IFCAP_LRO; + + /* figure out if updating HW LRO is needed */ if (!(ifp->if_capenable & IFCAP_LRO)) { if (priv->params.hw_lro_en) { priv->params.hw_lro_en = false; need_restart = true; - /* Not sure this is the correct way */ - priv->params_ethtool.hw_lro = priv->params.hw_lro_en; + } + } else { + if (priv->params.hw_lro_en == false && + priv->params_ethtool.hw_lro != 0) { + priv->params.hw_lro_en = true; + need_restart = true; } } if (was_opened && need_restart) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341984 - stable/10/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Dec 12 13:14:41 2018 New Revision: 341984 URL: https://svnweb.freebsd.org/changeset/base/341984 Log: MFC r341585: mlx5en: Improve configuration of HW LRO. In order to enable HW LRO, both the "hw_lro" sysctl in the mlx5en(4) config space must be set, and the ifconfig(8) LRO capability must be set. Any other settings will disable HW LRO. Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 13:13:50 2018(r341983) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 13:14:41 2018(r341984) @@ -330,21 +330,24 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_close_locked(priv->ifp); /* import HW LRO mode */ - if (priv->params_ethtool.hw_lro != 0) { - if ((priv->ifp->if_capenable & IFCAP_LRO) && - MLX5_CAP_ETH(priv->mdev, lro_cap)) { - priv->params.hw_lro_en = 1; - priv->params_ethtool.hw_lro = 1; + if (priv->params_ethtool.hw_lro != 0 && + MLX5_CAP_ETH(priv->mdev, lro_cap)) { + priv->params_ethtool.hw_lro = 1; + /* check if feature should actually be enabled */ + if (priv->ifp->if_capenable & IFCAP_LRO) { + priv->params.hw_lro_en = true; } else { - priv->params.hw_lro_en = 0; - priv->params_ethtool.hw_lro = 0; - error = EINVAL; + priv->params.hw_lro_en = false; - if_printf(priv->ifp, "Can't enable HW LRO: " - "The HW or SW LRO feature is disabled\n"); + if_printf(priv->ifp, "To enable HW LRO " + "please also enable LRO via ifconfig(8).\n"); } } else { - priv->params.hw_lro_en = 0; + /* return an error if HW does not support this feature */ + if (priv->params_ethtool.hw_lro != 0) + error = EINVAL; + priv->params.hw_lro_en = false; + priv->params_ethtool.hw_lro = 0; } /* restart network interface, if any */ if (was_opened) Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:13:50 2018(r341983) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:14:41 2018(r341984) @@ -2751,12 +2751,18 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t bool need_restart = false; ifp->if_capenable ^= IFCAP_LRO; + + /* figure out if updating HW LRO is needed */ if (!(ifp->if_capenable & IFCAP_LRO)) { if (priv->params.hw_lro_en) { priv->params.hw_lro_en = false; need_restart = true; - /* Not sure this is the correct way */ - priv->params_ethtool.hw_lro = priv->params.hw_lro_en; + } + } else { + if (priv->params.hw_lro_en == false && + priv->params_ethtool.hw_lro != 0) { + priv->params.hw_lro_en = true; + need_restart = true; } } if (was_opened && need_restart) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341982 - stable/12/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Dec 12 13:13:39 2018 New Revision: 341982 URL: https://svnweb.freebsd.org/changeset/base/341982 Log: MFC r341585: mlx5en: Improve configuration of HW LRO. In order to enable HW LRO, both the "hw_lro" sysctl in the mlx5en(4) config space must be set, and the ifconfig(8) LRO capability must be set. Any other settings will disable HW LRO. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 13:12:30 2018(r341981) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 13:13:39 2018(r341982) @@ -669,21 +669,24 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_close_locked(priv->ifp); /* import HW LRO mode */ - if (priv->params_ethtool.hw_lro != 0) { - if ((priv->ifp->if_capenable & IFCAP_LRO) && - MLX5_CAP_ETH(priv->mdev, lro_cap)) { - priv->params.hw_lro_en = 1; - priv->params_ethtool.hw_lro = 1; + if (priv->params_ethtool.hw_lro != 0 && + MLX5_CAP_ETH(priv->mdev, lro_cap)) { + priv->params_ethtool.hw_lro = 1; + /* check if feature should actually be enabled */ + if (priv->ifp->if_capenable & IFCAP_LRO) { + priv->params.hw_lro_en = true; } else { - priv->params.hw_lro_en = 0; - priv->params_ethtool.hw_lro = 0; - error = EINVAL; + priv->params.hw_lro_en = false; - if_printf(priv->ifp, "Can't enable HW LRO: " - "The HW or SW LRO feature is disabled\n"); + if_printf(priv->ifp, "To enable HW LRO " + "please also enable LRO via ifconfig(8).\n"); } } else { - priv->params.hw_lro_en = 0; + /* return an error if HW does not support this feature */ + if (priv->params_ethtool.hw_lro != 0) + error = EINVAL; + priv->params.hw_lro_en = false; + priv->params_ethtool.hw_lro = 0; } /* restart network interface, if any */ if (was_opened) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:12:30 2018(r341981) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:13:39 2018(r341982) @@ -2891,12 +2891,18 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t bool need_restart = false; ifp->if_capenable ^= IFCAP_LRO; + + /* figure out if updating HW LRO is needed */ if (!(ifp->if_capenable & IFCAP_LRO)) { if (priv->params.hw_lro_en) { priv->params.hw_lro_en = false; need_restart = true; - /* Not sure this is the correct way */ - priv->params_ethtool.hw_lro = priv->params.hw_lro_en; + } + } else { + if (priv->params.hw_lro_en == false && + priv->params_ethtool.hw_lro != 0) { + priv->params.hw_lro_en = true; + need_restart = true; } } if (was_opened && need_restart) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341981 - stable/11/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Dec 12 13:12:30 2018 New Revision: 341981 URL: https://svnweb.freebsd.org/changeset/base/341981 Log: MFC r341584: mlx5en: Count all transmitted and received bytes. Add counter for all transmitted and received bytes. Currently only all transmitted and received packets were counted. Fix description of RX LRO counters while at it. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h == --- stable/11/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 13:12:10 2018 (r341980) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 13:12:30 2018 (r341981) @@ -378,9 +378,10 @@ struct mlx5e_port_stats_debug { #defineMLX5E_RQ_STATS(m) \ m(+1, u64 packets, "packets", "Received packets")\ + m(+1, u64 bytes, "bytes", "Received bytes") \ m(+1, u64 csum_none, "csum_none", "Received packets")\ - m(+1, u64 lro_packets, "lro_packets", "Received packets")\ - m(+1, u64 lro_bytes, "lro_bytes", "Received packets")\ + m(+1, u64 lro_packets, "lro_packets", "Received LRO packets")\ + m(+1, u64 lro_bytes, "lro_bytes", "Received LRO bytes") \ m(+1, u64 sw_lro_queued, "sw_lro_queued", "Packets queued for SW LRO") \ m(+1, u64 sw_lro_flushed, "sw_lro_flushed", "Packets flushed from SW LRO") \ m(+1, u64 wqe_err, "wqe_err", "Received packets") @@ -395,6 +396,7 @@ struct mlx5e_rq_stats { #defineMLX5E_SQ_STATS(m) \ m(+1, u64 packets, "packets", "Transmitted packets") \ + m(+1, u64 bytes, "bytes", "Transmitted bytes") \ m(+1, u64 tso_packets, "tso_packets", "Transmitted packets") \ m(+1, u64 tso_bytes, "tso_bytes", "Transmitted bytes") \ m(+1, u64 csum_offload_none, "csum_offload_none", "Transmitted packets") \ Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Wed Dec 12 13:12:10 2018 (r341980) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Wed Dec 12 13:12:30 2018 (r341981) @@ -437,6 +437,7 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget) } mlx5e_build_rx_mbuf(cqe, rq, mb, byte_cnt); + rq->stats.bytes += byte_cnt; rq->stats.packets++; #if !defined(HAVE_TCP_LRO_RX) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 12 13:12:10 2018 (r341980) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 12 13:12:30 2018 (r341981) @@ -453,7 +453,10 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp) sq->mbuf[pi].num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS); sq->pc += sq->mbuf[pi].num_wqebbs; + /* Count all traffic going out */ sq->stats.packets++; + sq->stats.bytes += sq->mbuf[pi].num_bytes; + *mbp = NULL;/* safety clear */ return (0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341980 - stable/12/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Dec 12 13:12:10 2018 New Revision: 341980 URL: https://svnweb.freebsd.org/changeset/base/341980 Log: MFC r341584: mlx5en: Count all transmitted and received bytes. Add counter for all transmitted and received bytes. Currently only all transmitted and received packets were counted. Fix description of RX LRO counters while at it. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h == --- stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 13:11:08 2018 (r341979) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 13:12:10 2018 (r341980) @@ -379,9 +379,10 @@ struct mlx5e_port_stats_debug { #defineMLX5E_RQ_STATS(m) \ m(+1, u64 packets, "packets", "Received packets")\ + m(+1, u64 bytes, "bytes", "Received bytes") \ m(+1, u64 csum_none, "csum_none", "Received packets")\ - m(+1, u64 lro_packets, "lro_packets", "Received packets")\ - m(+1, u64 lro_bytes, "lro_bytes", "Received packets")\ + m(+1, u64 lro_packets, "lro_packets", "Received LRO packets")\ + m(+1, u64 lro_bytes, "lro_bytes", "Received LRO bytes") \ m(+1, u64 sw_lro_queued, "sw_lro_queued", "Packets queued for SW LRO") \ m(+1, u64 sw_lro_flushed, "sw_lro_flushed", "Packets flushed from SW LRO") \ m(+1, u64 wqe_err, "wqe_err", "Received packets") @@ -396,6 +397,7 @@ struct mlx5e_rq_stats { #defineMLX5E_SQ_STATS(m) \ m(+1, u64 packets, "packets", "Transmitted packets") \ + m(+1, u64 bytes, "bytes", "Transmitted bytes") \ m(+1, u64 tso_packets, "tso_packets", "Transmitted packets") \ m(+1, u64 tso_bytes, "tso_bytes", "Transmitted bytes") \ m(+1, u64 csum_offload_none, "csum_offload_none", "Transmitted packets") \ Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Wed Dec 12 13:11:08 2018 (r341979) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Wed Dec 12 13:12:10 2018 (r341980) @@ -482,6 +482,7 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget) } mlx5e_build_rx_mbuf(cqe, rq, mb, byte_cnt); + rq->stats.bytes += byte_cnt; rq->stats.packets++; #if !defined(HAVE_TCP_LRO_RX) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 12 13:11:08 2018 (r341979) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 12 13:12:10 2018 (r341980) @@ -472,7 +472,10 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp) sq->mbuf[pi].num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS); sq->pc += sq->mbuf[pi].num_wqebbs; + /* Count all traffic going out */ sq->stats.packets++; + sq->stats.bytes += sq->mbuf[pi].num_bytes; + *mbp = NULL;/* safety clear */ return (0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341979 - stable/11/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Dec 12 13:11:08 2018 New Revision: 341979 URL: https://svnweb.freebsd.org/changeset/base/341979 Log: MFC r341583: mlx5en: Statically allocate and free the channel structure(s). By allocating the worst case size channel structure array at attach time we can eliminate various NULL checks in the fast path. And also reduce the chance for use-after-free issues in the transmit fast path. This change is also a requirement for implementing backpressure support. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h == --- stable/11/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 13:08:49 2018 (r341978) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 13:11:08 2018 (r341979) @@ -595,7 +595,7 @@ struct mlx5e_sq { #defineMLX5E_CEV_STATE_INITIAL 0 /* timer not started */ #defineMLX5E_CEV_STATE_SEND_NOPS 1 /* send NOPs */ #defineMLX5E_CEV_STATE_HOLD_NOPS 2 /* don't send NOPs yet */ - u16 stopped;/* set if SQ is stopped */ + u16 running;/* set if SQ is running */ struct callout cev_callout; union { u32 d32[2]; @@ -754,7 +754,6 @@ struct mlx5e_priv { u32 tdn; struct mlx5_core_mr mr; - struct mlx5e_channel *volatile *channel; u32 tisn[MLX5E_MAX_TX_NUM_TC]; u32 rqtn; u32 tirn[MLX5E_NUM_TT]; @@ -790,6 +789,8 @@ struct mlx5e_priv { int media_active_last; struct callout watchdog; + + struct mlx5e_channel channel[]; }; #defineMLX5E_NET_IP_ALIGN 2 Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 13:08:49 2018(r341978) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 13:11:08 2018(r341979) @@ -1035,7 +1035,7 @@ mlx5e_ethtool_debug_channel_info(SYSCTL_HANDLER_ARGS) if (test_bit(MLX5E_STATE_OPENED, >state) == 0) goto out; for (i = 0; i < priv->params.num_channels; i++) { - c = priv->channel[i]; + c = >channel[i]; rq = >rq; sbuf_printf(, "channel %d rq %d cq %d\n", c->ix, rq->rqn, rq->cq.mcq.cqn); Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:08:49 2018(r341978) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:11:08 2018(r341979) @@ -471,7 +471,6 @@ mlx5e_update_stats_work(struct work_struct *work) update_stats_work); struct mlx5_core_dev *mdev = priv->mdev; struct mlx5e_vport_stats *s = >stats.vport; - struct mlx5e_rq_stats *rq_stats; struct mlx5e_sq_stats *sq_stats; struct buf_ring *sq_br; #if (__FreeBSD_version < 110) @@ -505,10 +504,10 @@ mlx5e_update_stats_work(struct work_struct *work) /* Collect firts the SW counters and then HW for consistency */ for (i = 0; i < priv->params.num_channels; i++) { - struct mlx5e_rq *rq = >channel[i]->rq; + struct mlx5e_channel *pch = priv->channel + i; + struct mlx5e_rq *rq = >rq; + struct mlx5e_rq_stats *rq_stats = >rq.stats; - rq_stats = >channel[i]->rq.stats; - /* collect stats from LRO */ rq_stats->sw_lro_queued = rq->lro.lro_queued; rq_stats->sw_lro_flushed = rq->lro.lro_flushed; @@ -520,8 +519,8 @@ mlx5e_update_stats_work(struct work_struct *work) rx_wqe_err += rq_stats->wqe_err; for (j = 0; j < priv->num_tc; j++) { - sq_stats = >channel[i]->sq[j].stats; - sq_br = priv->channel[i]->sq[j].br; + sq_stats = >sq[j].stats; + sq_br = pch->sq[j].br; tso_packets += sq_stats->tso_packets; tso_bytes += sq_stats->tso_bytes; @@ -1097,7 +1096,7 @@ mlx5e_refresh_sq_inline(struct mlx5e_priv *priv) return; for (i = 0; i < priv->params.num_channels; i++) - mlx5e_refresh_sq_inline_sub(priv, priv->channel[i]); + mlx5e_refresh_sq_inline_sub(priv, >channel[i]); } static int @@ -1278,6 +1277,8 @@ mlx5e_open_sq(struct mlx5e_channel *c, if (err)
svn commit: r341978 - stable/12/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Dec 12 13:08:49 2018 New Revision: 341978 URL: https://svnweb.freebsd.org/changeset/base/341978 Log: MFC r341583: mlx5en: Statically allocate and free the channel structure(s). By allocating the worst case size channel structure array at attach time we can eliminate various NULL checks in the fast path. And also reduce the chance for use-after-free issues in the transmit fast path. This change is also a requirement for implementing backpressure support. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h == --- stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 13:05:45 2018 (r341977) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 13:08:49 2018 (r341978) @@ -596,7 +596,7 @@ struct mlx5e_sq { #defineMLX5E_CEV_STATE_INITIAL 0 /* timer not started */ #defineMLX5E_CEV_STATE_SEND_NOPS 1 /* send NOPs */ #defineMLX5E_CEV_STATE_HOLD_NOPS 2 /* don't send NOPs yet */ - u16 stopped;/* set if SQ is stopped */ + u16 running;/* set if SQ is running */ struct callout cev_callout; union { u32 d32[2]; @@ -769,7 +769,6 @@ struct mlx5e_priv { u32 tdn; struct mlx5_core_mr mr; - struct mlx5e_channel *volatile *channel; u32 tisn[MLX5E_MAX_TX_NUM_TC]; u32 rqtn; u32 tirn[MLX5E_NUM_TT]; @@ -814,6 +813,8 @@ struct mlx5e_priv { int clbr_curr; struct mlx5e_clbr_point clbr_points[2]; u_int clbr_gen; + + struct mlx5e_channel channel[]; }; #defineMLX5E_NET_IP_ALIGN 2 Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 13:05:45 2018(r341977) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 13:08:49 2018(r341978) @@ -1035,7 +1035,7 @@ mlx5e_ethtool_debug_channel_info(SYSCTL_HANDLER_ARGS) if (test_bit(MLX5E_STATE_OPENED, >state) == 0) goto out; for (i = 0; i < priv->params.num_channels; i++) { - c = priv->channel[i]; + c = >channel[i]; rq = >rq; sbuf_printf(, "channel %d rq %d cq %d\n", c->ix, rq->rqn, rq->cq.mcq.cqn); Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:05:45 2018(r341977) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:08:49 2018(r341978) @@ -471,7 +471,6 @@ mlx5e_update_stats_work(struct work_struct *work) update_stats_work); struct mlx5_core_dev *mdev = priv->mdev; struct mlx5e_vport_stats *s = >stats.vport; - struct mlx5e_rq_stats *rq_stats; struct mlx5e_sq_stats *sq_stats; struct buf_ring *sq_br; #if (__FreeBSD_version < 110) @@ -505,10 +504,10 @@ mlx5e_update_stats_work(struct work_struct *work) /* Collect firts the SW counters and then HW for consistency */ for (i = 0; i < priv->params.num_channels; i++) { - struct mlx5e_rq *rq = >channel[i]->rq; + struct mlx5e_channel *pch = priv->channel + i; + struct mlx5e_rq *rq = >rq; + struct mlx5e_rq_stats *rq_stats = >rq.stats; - rq_stats = >channel[i]->rq.stats; - /* collect stats from LRO */ rq_stats->sw_lro_queued = rq->lro.lro_queued; rq_stats->sw_lro_flushed = rq->lro.lro_flushed; @@ -520,8 +519,8 @@ mlx5e_update_stats_work(struct work_struct *work) rx_wqe_err += rq_stats->wqe_err; for (j = 0; j < priv->num_tc; j++) { - sq_stats = >channel[i]->sq[j].stats; - sq_br = priv->channel[i]->sq[j].br; + sq_stats = >sq[j].stats; + sq_br = pch->sq[j].br; tso_packets += sq_stats->tso_packets; tso_bytes += sq_stats->tso_bytes; @@ -1200,7 +1199,7 @@ mlx5e_refresh_sq_inline(struct mlx5e_priv *priv) return; for (i = 0; i < priv->params.num_channels; i++) - mlx5e_refresh_sq_inline_sub(priv, priv->channel[i]); + mlx5e_refresh_sq_inline_sub(priv, >channel[i]); } static int @@ -1381,6
svn commit: r341977 - stable/11/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Dec 12 13:05:45 2018 New Revision: 341977 URL: https://svnweb.freebsd.org/changeset/base/341977 Log: MFC r341582: mlx5en: Fix race in mlx5e_ethtool_debug_stats(). Writing to the debug stats variable must be locked, else serialization will be lost which might cause various kernel panics due to creating and destroying sysctls out of order. Make sure the sysctl context is initialized after freeing the sysctl nodes, else they can be freed twice. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h == --- stable/11/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 13:04:53 2018 (r341976) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 13:05:45 2018 (r341977) @@ -779,7 +779,6 @@ struct mlx5e_priv { struct sysctl_oid *sysctl_hw; int sysctl_debug; struct mlx5e_stats stats; - struct sysctl_ctx_list sysctl_ctx_channel_debug; int counter_set_id; struct workqueue_struct *wq; Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 13:04:53 2018(r341976) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 13:05:45 2018(r341977) @@ -1056,33 +1056,34 @@ static int mlx5e_ethtool_debug_stats(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; - int error, sys_debug; + int sys_debug; + int error; + PRIV_LOCK(priv); sys_debug = priv->sysctl_debug; - error = sysctl_handle_int(oidp, >sysctl_debug, 0, req); + error = sysctl_handle_int(oidp, _debug, 0, req); if (error != 0 || !req->newptr) - return (error); - priv->sysctl_debug = priv->sysctl_debug != 0; + goto done; + sys_debug = sys_debug ? 1 : 0; if (sys_debug == priv->sysctl_debug) - return (0); + goto done; - PRIV_LOCK(priv); - if (priv->sysctl_debug) { + if ((priv->sysctl_debug = sys_debug)) { mlx5e_create_stats(>stats.port_stats_debug.ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), "debug_stats", mlx5e_port_stats_debug_desc, MLX5E_PORT_STATS_DEBUG_NUM, priv->stats.port_stats_debug.arg); - SYSCTL_ADD_PROC(>sysctl_ctx_channel_debug, + SYSCTL_ADD_PROC(>stats.port_stats_debug.ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), OID_AUTO, "hw_ctx_debug", CTLFLAG_RD | CTLFLAG_MPSAFE | CTLTYPE_STRING, priv, 0, mlx5e_ethtool_debug_channel_info, "S", ""); } else { sysctl_ctx_free(>stats.port_stats_debug.ctx); - sysctl_ctx_free(>sysctl_ctx_channel_debug); } +done: PRIV_UNLOCK(priv); - return (0); + return (error); } static void Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:04:53 2018(r341976) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:05:45 2018(r341977) @@ -3512,8 +3512,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) ifp->if_hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); - sysctl_ctx_init(>sysctl_ctx_channel_debug); - /* ifnet sysctl tree */ sysctl_ctx_init(>sysctl_ctx); priv->sysctl_ifnet = SYSCTL_ADD_NODE(>sysctl_ctx, SYSCTL_STATIC_CHILDREN(_dev), @@ -3685,8 +3683,8 @@ err_free_wq: err_free_sysctl: sysctl_ctx_free(>sysctl_ctx); - sysctl_ctx_free(>sysctl_ctx_channel_debug); - + if (priv->sysctl_debug) + sysctl_ctx_free(>stats.port_stats_debug.ctx); if_free(ifp); err_free_priv: @@ -3726,13 +3724,11 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp if_free(ifp); /* destroy all remaining sysctl nodes */ - if (priv->sysctl_debug) { - sysctl_ctx_free(>sysctl_ctx_channel_debug); - sysctl_ctx_free(>stats.port_stats_debug.ctx); - } sysctl_ctx_free(>stats.vport.ctx); sysctl_ctx_free(>stats.pport.ctx); sysctl_ctx_free(>sysctl_ctx); + if (priv->sysctl_debug) + sysctl_ctx_free(>stats.port_stats_debug.ctx); mlx5_core_destroy_mkey(priv->mdev, >mr); mlx5_dealloc_transport_domain(priv->mdev, priv->tdn);
svn commit: r341976 - stable/12/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Dec 12 13:04:53 2018 New Revision: 341976 URL: https://svnweb.freebsd.org/changeset/base/341976 Log: MFC r341582: mlx5en: Fix race in mlx5e_ethtool_debug_stats(). Writing to the debug stats variable must be locked, else serialization will be lost which might cause various kernel panics due to creating and destroying sysctls out of order. Make sure the sysctl context is initialized after freeing the sysctl nodes, else they can be freed twice. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h == --- stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 13:03:51 2018 (r341975) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 13:04:53 2018 (r341976) @@ -794,7 +794,6 @@ struct mlx5e_priv { struct sysctl_oid *sysctl_hw; int sysctl_debug; struct mlx5e_stats stats; - struct sysctl_ctx_list sysctl_ctx_channel_debug; int counter_set_id; struct workqueue_struct *wq; Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 13:03:51 2018(r341975) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 13:04:53 2018(r341976) @@ -1056,33 +1056,34 @@ static int mlx5e_ethtool_debug_stats(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; - int error, sys_debug; + int sys_debug; + int error; + PRIV_LOCK(priv); sys_debug = priv->sysctl_debug; - error = sysctl_handle_int(oidp, >sysctl_debug, 0, req); + error = sysctl_handle_int(oidp, _debug, 0, req); if (error != 0 || !req->newptr) - return (error); - priv->sysctl_debug = priv->sysctl_debug != 0; + goto done; + sys_debug = sys_debug ? 1 : 0; if (sys_debug == priv->sysctl_debug) - return (0); + goto done; - PRIV_LOCK(priv); - if (priv->sysctl_debug) { + if ((priv->sysctl_debug = sys_debug)) { mlx5e_create_stats(>stats.port_stats_debug.ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), "debug_stats", mlx5e_port_stats_debug_desc, MLX5E_PORT_STATS_DEBUG_NUM, priv->stats.port_stats_debug.arg); - SYSCTL_ADD_PROC(>sysctl_ctx_channel_debug, + SYSCTL_ADD_PROC(>stats.port_stats_debug.ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), OID_AUTO, "hw_ctx_debug", CTLFLAG_RD | CTLFLAG_MPSAFE | CTLTYPE_STRING, priv, 0, mlx5e_ethtool_debug_channel_info, "S", ""); } else { sysctl_ctx_free(>stats.port_stats_debug.ctx); - sysctl_ctx_free(>sysctl_ctx_channel_debug); } +done: PRIV_UNLOCK(priv); - return (0); + return (error); } static void Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:03:51 2018(r341975) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:04:53 2018(r341976) @@ -3632,8 +3632,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) ifp->if_hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); - sysctl_ctx_init(>sysctl_ctx_channel_debug); - /* ifnet sysctl tree */ sysctl_ctx_init(>sysctl_ctx); priv->sysctl_ifnet = SYSCTL_ADD_NODE(>sysctl_ctx, SYSCTL_STATIC_CHILDREN(_dev), @@ -3824,8 +3822,8 @@ err_free_wq: err_free_sysctl: sysctl_ctx_free(>sysctl_ctx); - sysctl_ctx_free(>sysctl_ctx_channel_debug); - + if (priv->sysctl_debug) + sysctl_ctx_free(>stats.port_stats_debug.ctx); if_free(ifp); err_free_priv: @@ -3882,13 +3880,11 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp mlx5e_rl_cleanup(priv); #endif /* destroy all remaining sysctl nodes */ - if (priv->sysctl_debug) { - sysctl_ctx_free(>sysctl_ctx_channel_debug); - sysctl_ctx_free(>stats.port_stats_debug.ctx); - } sysctl_ctx_free(>stats.vport.ctx); sysctl_ctx_free(>stats.pport.ctx); sysctl_ctx_free(>sysctl_ctx); + if (priv->sysctl_debug) + sysctl_ctx_free(>stats.port_stats_debug.ctx); mlx5_core_destroy_mkey(priv->mdev, >mr); mlx5_dealloc_transport_domain(priv->mdev, priv->tdn);
svn commit: r341974 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en
Author: hselasky Date: Wed Dec 12 13:03:50 2018 New Revision: 341974 URL: https://svnweb.freebsd.org/changeset/base/341974 Log: MFC r341581: mlx5en: Add support for IFM_10G_LR and IFM_40G_ER4 media types. Inspect the ethernet compliance code to figure out actual cable type by reading the PDDR module info register. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_ifc.h stable/12/sys/dev/mlx5/port.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.cWed Dec 12 13:02:00 2018(r341973) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.cWed Dec 12 13:03:50 2018(r341974) @@ -1146,3 +1146,39 @@ out: kfree(out); return err; } + +int mlx5_query_pddr_range_info(struct mlx5_core_dev *mdev, u8 local_port, u8 *is_er_type) +{ + u32 pddr_reg[MLX5_ST_SZ_DW(pddr_reg)] = {}; + int sz = MLX5_ST_SZ_BYTES(pddr_reg); + int error; + u8 ecc; + u8 ci; + + MLX5_SET(pddr_reg, pddr_reg, local_port, local_port); + MLX5_SET(pddr_reg, pddr_reg, page_select, 3 /* module info page */); + + error = mlx5_core_access_reg(mdev, pddr_reg, sz, pddr_reg, sz, + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_PDDR, 0, 0); + if (error != 0) + return (error); + + ecc = MLX5_GET(pddr_reg, pddr_reg, page_data.pddr_module_info.ethernet_compliance_code); + ci = MLX5_GET(pddr_reg, pddr_reg, page_data.pddr_module_info.cable_identifier); + + switch (ci) { + case 0: /* QSFP28 */ + case 1: /* QSFP+ */ + *is_er_type = 0; + break; + case 2: /* SFP28/SFP+ */ + case 3: /* QSA (QSFP->SFP) */ + *is_er_type = ((ecc & (1 << 7)) != 0); + break; + default: + *is_er_type = 0; + break; + } + return (0); +} +EXPORT_SYMBOL_GPL(mlx5_query_pddr_range_info); Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:02:00 2018(r341973) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:03:50 2018(r341974) @@ -167,6 +167,7 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) u32 eth_proto_oper; int error; u8 port_state; + u8 is_er_type; u8 i; port_state = mlx5_query_vport_state(mdev, @@ -195,10 +196,33 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) if (mlx5e_mode_table[i].baudrate == 0) continue; if (MLX5E_PROT_MASK(i) & eth_proto_oper) { + u32 subtype = mlx5e_mode_table[i].subtype; + priv->ifp->if_baudrate = mlx5e_mode_table[i].baudrate; - priv->media_active_last = - mlx5e_mode_table[i].subtype | IFM_ETHER | IFM_FDX; + + switch (subtype) { + case IFM_10G_ER: + error = mlx5_query_pddr_range_info(mdev, 1, _er_type); + if (error != 0) { + if_printf(priv->ifp, "%s: query port pddr failed: %d\n", + __func__, error); + } + if (error != 0 || is_er_type == 0) + subtype = IFM_10G_LR; + break; + case IFM_40G_LR4: + error = mlx5_query_pddr_range_info(mdev, 1, _er_type); + if (error != 0) { + if_printf(priv->ifp, "%s: query port pddr failed: %d\n", + __func__, error); + } + if (error == 0 && is_er_type != 0) + subtype = IFM_40G_ER4; + break; + } + priv->media_active_last = subtype | IFM_ETHER | IFM_FDX; + break; } } if_link_state_change(priv->ifp, LINK_STATE_UP); @@ -222,6 +246,15 @@ mlx5e_find_link_mode(u32 subtype) u32 i; u32 link_mode = 0; + switch (subtype) { + case IFM_10G_LR: + subtype = IFM_10G_ER; + break; + case IFM_40G_ER4: + subtype = IFM_40G_LR4; + break; + } + for (i = 0; i < MLX5E_LINK_MODES_NUMBER;
svn commit: r341975 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en
Author: hselasky Date: Wed Dec 12 13:03:51 2018 New Revision: 341975 URL: https://svnweb.freebsd.org/changeset/base/341975 Log: MFC r341581: mlx5en: Add support for IFM_10G_LR and IFM_40G_ER4 media types. Inspect the ethernet compliance code to figure out actual cable type by reading the PDDR module info register. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_ifc.h stable/11/sys/dev/mlx5/port.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.cWed Dec 12 13:03:50 2018(r341974) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.cWed Dec 12 13:03:51 2018(r341975) @@ -1146,3 +1146,39 @@ out: kfree(out); return err; } + +int mlx5_query_pddr_range_info(struct mlx5_core_dev *mdev, u8 local_port, u8 *is_er_type) +{ + u32 pddr_reg[MLX5_ST_SZ_DW(pddr_reg)] = {}; + int sz = MLX5_ST_SZ_BYTES(pddr_reg); + int error; + u8 ecc; + u8 ci; + + MLX5_SET(pddr_reg, pddr_reg, local_port, local_port); + MLX5_SET(pddr_reg, pddr_reg, page_select, 3 /* module info page */); + + error = mlx5_core_access_reg(mdev, pddr_reg, sz, pddr_reg, sz, + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_PDDR, 0, 0); + if (error != 0) + return (error); + + ecc = MLX5_GET(pddr_reg, pddr_reg, page_data.pddr_module_info.ethernet_compliance_code); + ci = MLX5_GET(pddr_reg, pddr_reg, page_data.pddr_module_info.cable_identifier); + + switch (ci) { + case 0: /* QSFP28 */ + case 1: /* QSFP+ */ + *is_er_type = 0; + break; + case 2: /* SFP28/SFP+ */ + case 3: /* QSA (QSFP->SFP) */ + *is_er_type = ((ecc & (1 << 7)) != 0); + break; + default: + *is_er_type = 0; + break; + } + return (0); +} +EXPORT_SYMBOL_GPL(mlx5_query_pddr_range_info); Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:03:50 2018(r341974) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:03:51 2018(r341975) @@ -167,6 +167,7 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) u32 eth_proto_oper; int error; u8 port_state; + u8 is_er_type; u8 i; port_state = mlx5_query_vport_state(mdev, @@ -195,10 +196,33 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) if (mlx5e_mode_table[i].baudrate == 0) continue; if (MLX5E_PROT_MASK(i) & eth_proto_oper) { + u32 subtype = mlx5e_mode_table[i].subtype; + priv->ifp->if_baudrate = mlx5e_mode_table[i].baudrate; - priv->media_active_last = - mlx5e_mode_table[i].subtype | IFM_ETHER | IFM_FDX; + + switch (subtype) { + case IFM_10G_ER: + error = mlx5_query_pddr_range_info(mdev, 1, _er_type); + if (error != 0) { + if_printf(priv->ifp, "%s: query port pddr failed: %d\n", + __func__, error); + } + if (error != 0 || is_er_type == 0) + subtype = IFM_10G_LR; + break; + case IFM_40G_LR4: + error = mlx5_query_pddr_range_info(mdev, 1, _er_type); + if (error != 0) { + if_printf(priv->ifp, "%s: query port pddr failed: %d\n", + __func__, error); + } + if (error == 0 && is_er_type != 0) + subtype = IFM_40G_ER4; + break; + } + priv->media_active_last = subtype | IFM_ETHER | IFM_FDX; + break; } } if_link_state_change(priv->ifp, LINK_STATE_UP); @@ -222,6 +246,15 @@ mlx5e_find_link_mode(u32 subtype) u32 i; u32 link_mode = 0; + switch (subtype) { + case IFM_10G_LR: + subtype = IFM_10G_ER; + break; + case IFM_40G_ER4: + subtype = IFM_40G_LR4; + break; + } + for (i = 0; i < MLX5E_LINK_MODES_NUMBER;
svn commit: r341973 - stable/12/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Dec 12 13:02:00 2018 New Revision: 341973 URL: https://svnweb.freebsd.org/changeset/base/341973 Log: MFC r341580: mlx5en: Don't set rate on SQs when the SQ is already stopped. This can happen when connections are short lived and leads to a firmware error printout in dmesg, syndrome 0x51cfb0, because the SQ is in the wrong state. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 12 13:00:56 2018 (r341972) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 12 13:02:00 2018 (r341973) @@ -458,9 +458,9 @@ mlx5e_rlw_channel_set_rate_locked(struct mlx5e_rl_work howmany(rate, 1000), burst); } - /* set new rate */ + /* set new rate, if SQ is not stopped */ sq = channel->sq; - if (sq != NULL) { + if (sq != NULL && sq->stopped == 0) { error = mlx5e_rl_modify_sq(sq, index); if (error != 0) atomic_add_64(>priv->rl.stats.tx_modify_rate_failure, 1ULL); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341972 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en
Author: hselasky Date: Wed Dec 12 13:00:56 2018 New Revision: 341972 URL: https://svnweb.freebsd.org/changeset/base/341972 Log: MFC r341579: mlx5en: Fix for inlining issues in transmit path 1) Don't exceed the drivers own hardcoded TX inline limit. The blueflame register size can be much greater than the hardcoded limit for inlining. Make sure we don't exceed the drivers own limit, because this also means that the maximum number of TX fragments becomes invalid and then memory size assumptions in the TX path no longer hold up. 2) Make sure the mlx5_query_min_inline() function returns an error code. 3) Header inlining is required when using TSO. 4) Catch failure to compute inline header size for TSO. 5) Add support for UDP when computing inline header size. 6) Fix for inlining issues with regards to DSCP. Make sure we inline 4 bytes beyond the ethernet and/or VLAN header to workaround a hardware bug extracting the DSCP field from the IPv4/v6 header. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c stable/11/sys/dev/mlx5/vport.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c Wed Dec 12 12:59:57 2018(r341971) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c Wed Dec 12 13:00:56 2018(r341972) @@ -222,20 +222,28 @@ int mlx5_query_nic_vport_min_inline(struct mlx5_core_d } EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_min_inline); -void mlx5_query_min_inline(struct mlx5_core_dev *mdev, - u8 *min_inline_mode) +int mlx5_query_min_inline(struct mlx5_core_dev *mdev, + u8 *min_inline_mode) { + int err; + switch (MLX5_CAP_ETH(mdev, wqe_inline_mode)) { case MLX5_CAP_INLINE_MODE_L2: *min_inline_mode = MLX5_INLINE_MODE_L2; + err = 0; break; case MLX5_CAP_INLINE_MODE_VPORT_CONTEXT: - mlx5_query_nic_vport_min_inline(mdev, 0, min_inline_mode); + err = mlx5_query_nic_vport_min_inline(mdev, 0, min_inline_mode); break; case MLX5_CAP_INLINE_MODE_NOT_REQUIRED: *min_inline_mode = MLX5_INLINE_MODE_NONE; + err = 0; break; + default: + err = -EINVAL; + break; } + return err; } EXPORT_SYMBOL_GPL(mlx5_query_min_inline); Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h == --- stable/11/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 12:59:57 2018 (r341971) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 13:00:56 2018 (r341972) @@ -618,7 +618,9 @@ struct mlx5e_sq { u32 mkey_be; u16 max_inline; u8 min_inline_mode; - u8 vlan_inline_cap; + u8 min_insert_caps; +#defineMLX5E_INSERT_VLAN 1 +#defineMLX5E_INSERT_NON_VLAN 2 /* control path */ struct mlx5_wq_ctrl wq_ctrl; @@ -901,6 +903,7 @@ voidmlx5e_drain_sq(struct mlx5e_sq *); void mlx5e_modify_tx_dma(struct mlx5e_priv *priv, uint8_t value); void mlx5e_modify_rx_dma(struct mlx5e_priv *priv, uint8_t value); void mlx5e_resume_sq(struct mlx5e_sq *sq); -u8 mlx5e_params_calculate_tx_min_inline(struct mlx5_core_dev *mdev); +void mlx5e_update_sq_inline(struct mlx5e_sq *sq); +void mlx5e_refresh_sq_inline(struct mlx5e_priv *priv); #endif /* _MLX5_EN_H_ */ Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 12:59:57 2018(r341971) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 13:00:56 2018(r341972) @@ -374,6 +374,12 @@ mlx5e_trust_state_handler(SYSCTL_HANDLER_ARGS) goto done; priv->params_ethtool.trust_state = result; + + /* update inline mode */ + mlx5e_refresh_sq_inline(priv); +#ifdef RATELIMIT + mlx5e_rl_refresh_sq_inline(>rl); +#endif done: PRIV_UNLOCK(priv); return (err); Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:59:57 2018(r341971) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 13:00:56 2018(r341972) @@ -1021,6 +1021,52 @@ static const char
svn commit: r341971 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en
Author: hselasky Date: Wed Dec 12 12:59:57 2018 New Revision: 341971 URL: https://svnweb.freebsd.org/changeset/base/341971 Log: MFC r341579: mlx5en: Fix for inlining issues in transmit path 1) Don't exceed the drivers own hardcoded TX inline limit. The blueflame register size can be much greater than the hardcoded limit for inlining. Make sure we don't exceed the drivers own limit, because this also means that the maximum number of TX fragments becomes invalid and then memory size assumptions in the TX path no longer hold up. 2) Make sure the mlx5_query_min_inline() function returns an error code. 3) Header inlining is required when using TSO. 4) Catch failure to compute inline header size for TSO. 5) Add support for UDP when computing inline header size. 6) Fix for inlining issues with regards to DSCP. Make sure we inline 4 bytes beyond the ethernet and/or VLAN header to workaround a hardware bug extracting the DSCP field from the IPv4/v6 header. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_vport.c stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/en_rl.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c stable/12/sys/dev/mlx5/vport.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_vport.c == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_vport.c Wed Dec 12 12:58:05 2018(r341970) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_vport.c Wed Dec 12 12:59:57 2018(r341971) @@ -222,20 +222,28 @@ int mlx5_query_nic_vport_min_inline(struct mlx5_core_d } EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_min_inline); -void mlx5_query_min_inline(struct mlx5_core_dev *mdev, - u8 *min_inline_mode) +int mlx5_query_min_inline(struct mlx5_core_dev *mdev, + u8 *min_inline_mode) { + int err; + switch (MLX5_CAP_ETH(mdev, wqe_inline_mode)) { case MLX5_CAP_INLINE_MODE_L2: *min_inline_mode = MLX5_INLINE_MODE_L2; + err = 0; break; case MLX5_CAP_INLINE_MODE_VPORT_CONTEXT: - mlx5_query_nic_vport_min_inline(mdev, 0, min_inline_mode); + err = mlx5_query_nic_vport_min_inline(mdev, 0, min_inline_mode); break; case MLX5_CAP_INLINE_MODE_NOT_REQUIRED: *min_inline_mode = MLX5_INLINE_MODE_NONE; + err = 0; break; + default: + err = -EINVAL; + break; } + return err; } EXPORT_SYMBOL_GPL(mlx5_query_min_inline); Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h == --- stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 12:58:05 2018 (r341970) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 12:59:57 2018 (r341971) @@ -619,7 +619,9 @@ struct mlx5e_sq { u32 mkey_be; u16 max_inline; u8 min_inline_mode; - u8 vlan_inline_cap; + u8 min_insert_caps; +#defineMLX5E_INSERT_VLAN 1 +#defineMLX5E_INSERT_NON_VLAN 2 /* control path */ struct mlx5_wq_ctrl wq_ctrl; @@ -925,6 +927,7 @@ voidmlx5e_drain_sq(struct mlx5e_sq *); void mlx5e_modify_tx_dma(struct mlx5e_priv *priv, uint8_t value); void mlx5e_modify_rx_dma(struct mlx5e_priv *priv, uint8_t value); void mlx5e_resume_sq(struct mlx5e_sq *sq); -u8 mlx5e_params_calculate_tx_min_inline(struct mlx5_core_dev *mdev); +void mlx5e_update_sq_inline(struct mlx5e_sq *sq); +void mlx5e_refresh_sq_inline(struct mlx5e_priv *priv); #endif /* _MLX5_EN_H_ */ Modified: stable/12/sys/dev/mlx5/mlx5_en/en_rl.h == --- stable/12/sys/dev/mlx5/mlx5_en/en_rl.h Wed Dec 12 12:58:05 2018 (r341970) +++ stable/12/sys/dev/mlx5/mlx5_en/en_rl.h Wed Dec 12 12:59:57 2018 (r341971) @@ -166,6 +166,7 @@ struct mlx5e_rl_priv_data { int mlx5e_rl_init(struct mlx5e_priv *priv); void mlx5e_rl_cleanup(struct mlx5e_priv *priv); +void mlx5e_rl_refresh_sq_inline(struct mlx5e_rl_priv_data *rl); if_snd_tag_alloc_t mlx5e_rl_snd_tag_alloc; if_snd_tag_modify_t mlx5e_rl_snd_tag_modify; if_snd_tag_query_t mlx5e_rl_snd_tag_query; Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 12:58:05 2018(r341970) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 12:59:57 2018
svn commit: r341970 - stable/11/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Dec 12 12:58:05 2018 New Revision: 341970 URL: https://svnweb.freebsd.org/changeset/base/341970 Log: MFC r341578 and r341655: mlx5en: Remove the DRBR and associated logic in the transmit path. The hardware queues are deep enough currently and using the DRBR and associated callbacks only leads to more task switching in the TX path. The is also a race setting the queue_state which can lead to hung TX rings. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h == --- stable/11/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 12:57:55 2018 (r341969) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 12:58:05 2018 (r341970) @@ -472,7 +472,6 @@ struct mlx5e_params { m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining tx packets") \ m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx packets to join") \ m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ - m(+1, u64 tx_bufring_disable, "tx_bufring_disable", "0: Enable bufring 1: Disable bufring") \ m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \ @@ -605,8 +604,6 @@ struct mlx5e_sq { struct mlx5e_sq_stats stats; struct mlx5e_cq cq; - struct task sq_task; - struct taskqueue *sq_tq; /* pointers to per packet info: write@xmit, read@completion */ struct mlx5e_sq_mbuf *mbuf; @@ -627,7 +624,6 @@ struct mlx5e_sq { struct mlx5_wq_ctrl wq_ctrl; struct mlx5e_priv *priv; int tc; - unsigned int queue_state; } __aligned(MLX5E_CACHELINE_SIZE); static inline bool @@ -833,7 +829,6 @@ voidmlx5e_cq_error_event(struct mlx5_core_cq *mcq, in void mlx5e_rx_cq_comp(struct mlx5_core_cq *); void mlx5e_tx_cq_comp(struct mlx5_core_cq *); struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq); -void mlx5e_tx_que(void *context, int pending); intmlx5e_open_flow_table(struct mlx5e_priv *priv); void mlx5e_close_flow_table(struct mlx5e_priv *priv); Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 12:57:55 2018(r341969) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 12:58:05 2018(r341970) @@ -703,18 +703,6 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_open_locked(priv->ifp); break; - case MLX5_PARAM_OFFSET(tx_bufring_disable): - /* rangecheck input value */ - priv->params_ethtool.tx_bufring_disable = - priv->params_ethtool.tx_bufring_disable ? 1 : 0; - - /* reconfigure the sendqueues, if any */ - if (was_opened) { - mlx5e_close_locked(priv->ifp); - mlx5e_open_locked(priv->ifp); - } - break; - case MLX5_PARAM_OFFSET(tx_completion_fact): /* network interface must be down */ if (was_opened) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:57:55 2018(r341969) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:58:05 2018(r341970) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1030,13 +1030,8 @@ mlx5e_create_sq(struct mlx5e_channel *c, struct mlx5e_priv *priv = c->priv; struct mlx5_core_dev *mdev = priv->mdev; char buffer[16]; - void *sqc = param->sqc; void *sqc_wq = MLX5_ADDR_OF(sqc, sqc, wq); -#ifdef RSS - cpuset_t cpu_mask; - int cpu_id; -#endif int err; /* Create DMA descriptor TAG */ @@ -1079,37 +1074,6 @@ mlx5e_create_sq(struct mlx5e_channel *c, sq->min_inline_mode = priv->params.tx_min_inline_mode; sq->vlan_inline_cap = MLX5_CAP_ETH(mdev, wqe_vlan_insert); - /* check if we should allocate a second packet buffer */ - if
svn commit: r341969 - stable/12/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Dec 12 12:57:55 2018 New Revision: 341969 URL: https://svnweb.freebsd.org/changeset/base/341969 Log: MFC r341578 and r341655: mlx5en: Remove the DRBR and associated logic in the transmit path. The hardware queues are deep enough currently and using the DRBR and associated callbacks only leads to more task switching in the TX path. The is also a race setting the queue_state which can lead to hung TX rings. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h == --- stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 12:55:53 2018 (r341968) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 12:57:55 2018 (r341969) @@ -473,7 +473,6 @@ struct mlx5e_params { m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining tx packets") \ m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx packets to join") \ m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ - m(+1, u64 tx_bufring_disable, "tx_bufring_disable", "0: Enable bufring 1: Disable bufring") \ m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \ @@ -606,8 +605,6 @@ struct mlx5e_sq { struct mlx5e_sq_stats stats; struct mlx5e_cq cq; - struct task sq_task; - struct taskqueue *sq_tq; /* pointers to per packet info: write@xmit, read@completion */ struct mlx5e_sq_mbuf *mbuf; @@ -628,7 +625,6 @@ struct mlx5e_sq { struct mlx5_wq_ctrl wq_ctrl; struct mlx5e_priv *priv; int tc; - unsigned int queue_state; } __aligned(MLX5E_CACHELINE_SIZE); static inline bool @@ -857,7 +853,6 @@ voidmlx5e_cq_error_event(struct mlx5_core_cq *mcq, in void mlx5e_rx_cq_comp(struct mlx5_core_cq *); void mlx5e_tx_cq_comp(struct mlx5_core_cq *); struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq); -void mlx5e_tx_que(void *context, int pending); intmlx5e_open_flow_table(struct mlx5e_priv *priv); void mlx5e_close_flow_table(struct mlx5e_priv *priv); Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 12:55:53 2018(r341968) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Dec 12 12:57:55 2018(r341969) @@ -703,18 +703,6 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_open_locked(priv->ifp); break; - case MLX5_PARAM_OFFSET(tx_bufring_disable): - /* rangecheck input value */ - priv->params_ethtool.tx_bufring_disable = - priv->params_ethtool.tx_bufring_disable ? 1 : 0; - - /* reconfigure the sendqueues, if any */ - if (was_opened) { - mlx5e_close_locked(priv->ifp); - mlx5e_open_locked(priv->ifp); - } - break; - case MLX5_PARAM_OFFSET(tx_completion_fact): /* network interface must be down */ if (was_opened) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:55:53 2018(r341968) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:57:55 2018(r341969) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1133,13 +1133,8 @@ mlx5e_create_sq(struct mlx5e_channel *c, struct mlx5e_priv *priv = c->priv; struct mlx5_core_dev *mdev = priv->mdev; char buffer[16]; - void *sqc = param->sqc; void *sqc_wq = MLX5_ADDR_OF(sqc, sqc, wq); -#ifdef RSS - cpuset_t cpu_mask; - int cpu_id; -#endif int err; /* Create DMA descriptor TAG */ @@ -1182,37 +1177,6 @@ mlx5e_create_sq(struct mlx5e_channel *c, sq->min_inline_mode = priv->params.tx_min_inline_mode; sq->vlan_inline_cap = MLX5_CAP_ETH(mdev, wqe_vlan_insert); - /* check if we should allocate a second packet buffer */ - if
svn commit: r341968 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en
Author: hselasky Date: Wed Dec 12 12:55:53 2018 New Revision: 341968 URL: https://svnweb.freebsd.org/changeset/base/341968 Log: MFC r341577: mlx5en: Implement support for bandwidth limiting in by ratio, ETS. Add support for setting the bandwidth limit as a ratio rather than in bits per second. The ratio must be an integer number between 1 and 100 inclusivly. Implement the needed firmware commands and SYSCTLs through mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/11/sys/dev/mlx5/port.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.cWed Dec 12 12:55:28 2018(r341967) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.cWed Dec 12 12:55:53 2018(r341968) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2018, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -931,6 +931,74 @@ int mlx5_set_port_prio_tc(struct mlx5_core_dev *mdev, return (err); } EXPORT_SYMBOL_GPL(mlx5_set_port_prio_tc); + +int mlx5_set_port_tc_group(struct mlx5_core_dev *mdev, const u8 *tc_group) +{ + u32 in[MLX5_ST_SZ_DW(qetc_reg)] = {}; + int i; + + for (i = 0; i <= mlx5_max_tc(mdev); i++) { + MLX5_SET(qetc_reg, in, tc_configuration[i].g, 1); + MLX5_SET(qetc_reg, in, tc_configuration[i].group, tc_group[i]); + } + + return mlx5_set_port_qetcr_reg(mdev, in, sizeof(in)); +} +EXPORT_SYMBOL_GPL(mlx5_set_port_tc_group); + +int mlx5_query_port_tc_group(struct mlx5_core_dev *mdev, +u8 tc, u8 *tc_group) +{ + u32 out[MLX5_ST_SZ_DW(qetc_reg)]; + void *ets_tcn_conf; + int err; + + err = mlx5_query_port_qetcr_reg(mdev, out, sizeof(out)); + if (err) + return err; + + ets_tcn_conf = MLX5_ADDR_OF(qetc_reg, out, + tc_configuration[tc]); + + *tc_group = MLX5_GET(ets_tcn_config_reg, ets_tcn_conf, +group); + + return 0; +} +EXPORT_SYMBOL_GPL(mlx5_query_port_tc_group); + +int mlx5_set_port_tc_bw_alloc(struct mlx5_core_dev *mdev, const u8 *tc_bw) +{ + u32 in[MLX5_ST_SZ_DW(qetc_reg)] = {}; + int i; + + for (i = 0; i <= mlx5_max_tc(mdev); i++) { + MLX5_SET(qetc_reg, in, tc_configuration[i].b, 1); + MLX5_SET(qetc_reg, in, tc_configuration[i].bw_allocation, tc_bw[i]); + } + + return mlx5_set_port_qetcr_reg(mdev, in, sizeof(in)); +} +EXPORT_SYMBOL_GPL(mlx5_set_port_tc_bw_alloc); + +int mlx5_query_port_tc_bw_alloc(struct mlx5_core_dev *mdev, u8 *bw_pct) +{ + u32 out[MLX5_ST_SZ_DW(qetc_reg)]; + void *ets_tcn_conf; + int err; + int i; + + err = mlx5_query_port_qetcr_reg(mdev, out, sizeof(out)); + if (err) + return err; + + for (i = 0; i <= mlx5_max_tc(mdev); i++) { + ets_tcn_conf = MLX5_ADDR_OF(qetc_reg, out, tc_configuration[i]); + bw_pct[i] = MLX5_GET(ets_tcn_config_reg, ets_tcn_conf, bw_allocation); + } + return 0; +} +EXPORT_SYMBOL_GPL(mlx5_query_port_tc_bw_alloc); int mlx5_modify_port_cong_params(struct mlx5_core_dev *mdev, void *in, int in_size) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h == --- stable/11/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 12:55:28 2018 (r341967) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 12:55:53 2018 (r341968) @@ -492,6 +492,7 @@ struct mlx5e_params_ethtool { u64 arg [0]; MLX5E_PARAMS(MLX5E_STATS_VAR) u64 max_bw_value[IEEE_8021QAZ_MAX_TCS]; + u8 max_bw_share[IEEE_8021QAZ_MAX_TCS]; u8 prio_tc[IEEE_8021QAZ_MAX_TCS]; u8 dscp2prio[MLX5_MAX_SUPPORTED_DSCP]; u8 trust_state; @@ -820,19 +821,6 @@ struct mlx5e_eeprom { int page_valid; u32 *data; }; - -/* - * This structure contains rate limit extension to the IEEE 802.1Qaz ETS - * managed object. - * Values are 64 bits long and specified in Kbps to enable usage over both - * slow and very fast networks. - * - * @tc_maxrate: maximal tc tx bandwidth indexed by traffic class - */ -struct ieee_maxrate { - __u64 tc_maxrate[IEEE_8021QAZ_MAX_TCS]; -}; - #defineMLX5E_FLD_MAX(typ, fld) ((1ULL << __mlx5_bit_sz(typ, fld)) - 1ULL) Modified:
svn commit: r341967 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en
Author: hselasky Date: Wed Dec 12 12:55:28 2018 New Revision: 341967 URL: https://svnweb.freebsd.org/changeset/base/341967 Log: MFC r341577: mlx5en: Implement support for bandwidth limiting in by ratio, ETS. Add support for setting the bandwidth limit as a ratio rather than in bits per second. The ratio must be an integer number between 1 and 100 inclusivly. Implement the needed firmware commands and SYSCTLs through mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/12/sys/dev/mlx5/port.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.cWed Dec 12 12:54:43 2018(r341966) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.cWed Dec 12 12:55:28 2018(r341967) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2018, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -931,6 +931,74 @@ int mlx5_set_port_prio_tc(struct mlx5_core_dev *mdev, return (err); } EXPORT_SYMBOL_GPL(mlx5_set_port_prio_tc); + +int mlx5_set_port_tc_group(struct mlx5_core_dev *mdev, const u8 *tc_group) +{ + u32 in[MLX5_ST_SZ_DW(qetc_reg)] = {}; + int i; + + for (i = 0; i <= mlx5_max_tc(mdev); i++) { + MLX5_SET(qetc_reg, in, tc_configuration[i].g, 1); + MLX5_SET(qetc_reg, in, tc_configuration[i].group, tc_group[i]); + } + + return mlx5_set_port_qetcr_reg(mdev, in, sizeof(in)); +} +EXPORT_SYMBOL_GPL(mlx5_set_port_tc_group); + +int mlx5_query_port_tc_group(struct mlx5_core_dev *mdev, +u8 tc, u8 *tc_group) +{ + u32 out[MLX5_ST_SZ_DW(qetc_reg)]; + void *ets_tcn_conf; + int err; + + err = mlx5_query_port_qetcr_reg(mdev, out, sizeof(out)); + if (err) + return err; + + ets_tcn_conf = MLX5_ADDR_OF(qetc_reg, out, + tc_configuration[tc]); + + *tc_group = MLX5_GET(ets_tcn_config_reg, ets_tcn_conf, +group); + + return 0; +} +EXPORT_SYMBOL_GPL(mlx5_query_port_tc_group); + +int mlx5_set_port_tc_bw_alloc(struct mlx5_core_dev *mdev, const u8 *tc_bw) +{ + u32 in[MLX5_ST_SZ_DW(qetc_reg)] = {}; + int i; + + for (i = 0; i <= mlx5_max_tc(mdev); i++) { + MLX5_SET(qetc_reg, in, tc_configuration[i].b, 1); + MLX5_SET(qetc_reg, in, tc_configuration[i].bw_allocation, tc_bw[i]); + } + + return mlx5_set_port_qetcr_reg(mdev, in, sizeof(in)); +} +EXPORT_SYMBOL_GPL(mlx5_set_port_tc_bw_alloc); + +int mlx5_query_port_tc_bw_alloc(struct mlx5_core_dev *mdev, u8 *bw_pct) +{ + u32 out[MLX5_ST_SZ_DW(qetc_reg)]; + void *ets_tcn_conf; + int err; + int i; + + err = mlx5_query_port_qetcr_reg(mdev, out, sizeof(out)); + if (err) + return err; + + for (i = 0; i <= mlx5_max_tc(mdev); i++) { + ets_tcn_conf = MLX5_ADDR_OF(qetc_reg, out, tc_configuration[i]); + bw_pct[i] = MLX5_GET(ets_tcn_config_reg, ets_tcn_conf, bw_allocation); + } + return 0; +} +EXPORT_SYMBOL_GPL(mlx5_query_port_tc_bw_alloc); int mlx5_modify_port_cong_params(struct mlx5_core_dev *mdev, void *in, int in_size) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h == --- stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 12:54:43 2018 (r341966) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 12:55:28 2018 (r341967) @@ -493,6 +493,7 @@ struct mlx5e_params_ethtool { u64 arg [0]; MLX5E_PARAMS(MLX5E_STATS_VAR) u64 max_bw_value[IEEE_8021QAZ_MAX_TCS]; + u8 max_bw_share[IEEE_8021QAZ_MAX_TCS]; u8 prio_tc[IEEE_8021QAZ_MAX_TCS]; u8 dscp2prio[MLX5_MAX_SUPPORTED_DSCP]; u8 trust_state; @@ -844,19 +845,6 @@ struct mlx5e_eeprom { int page_valid; u32 *data; }; - -/* - * This structure contains rate limit extension to the IEEE 802.1Qaz ETS - * managed object. - * Values are 64 bits long and specified in Kbps to enable usage over both - * slow and very fast networks. - * - * @tc_maxrate: maximal tc tx bandwidth indexed by traffic class - */ -struct ieee_maxrate { - __u64 tc_maxrate[IEEE_8021QAZ_MAX_TCS]; -}; - #defineMLX5E_FLD_MAX(typ, fld) ((1ULL << __mlx5_bit_sz(typ, fld)) - 1ULL) Modified:
svn commit: r341966 - in stable/11/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools
Author: hselasky Date: Wed Dec 12 12:54:43 2018 New Revision: 341966 URL: https://svnweb.freebsd.org/changeset/base/341966 Log: MFC r341576: mlx5fpga: Add set and query connect/disconnect FPGA Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_fpga/cmd.h stable/11/sys/dev/mlx5/mlx5_fpga/core.h stable/11/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c stable/11/sys/dev/mlx5/mlx5_fpga/sdk.h stable/11/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c stable/11/sys/dev/mlx5/mlx5io.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_fpga/cmd.h == --- stable/11/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 12 12:54:21 2018 (r341965) +++ stable/11/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 12 12:54:43 2018 (r341966) @@ -69,6 +69,8 @@ int mlx5_fpga_sbu_caps(struct mlx5_core_dev *dev, void int mlx5_fpga_load(struct mlx5_core_dev *dev, enum mlx5_fpga_image image); int mlx5_fpga_image_select(struct mlx5_core_dev *dev, enum mlx5_fpga_image image); +int mlx5_fpga_ctrl_connect(struct mlx5_core_dev *dev, + enum mlx5_fpga_connect *connect); int mlx5_fpga_shell_counters(struct mlx5_core_dev *dev, bool clear, struct mlx5_fpga_shell_counters *data); Modified: stable/11/sys/dev/mlx5/mlx5_fpga/core.h == --- stable/11/sys/dev/mlx5/mlx5_fpga/core.h Wed Dec 12 12:54:21 2018 (r341965) +++ stable/11/sys/dev/mlx5/mlx5_fpga/core.h Wed Dec 12 12:54:43 2018 (r341966) @@ -52,6 +52,7 @@ enum mlx5_fdev_state { MLX5_FDEV_STATE_SUCCESS = 0, MLX5_FDEV_STATE_FAILURE = 1, MLX5_FDEV_STATE_IN_PROGRESS = 2, + MLX5_FDEV_STATE_DISCONNECTED = 3, MLX5_FDEV_STATE_NONE = 0x, }; Modified: stable/11/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h == --- stable/11/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.hWed Dec 12 12:54:21 2018(r341965) +++ stable/11/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.hWed Dec 12 12:54:43 2018(r341966) @@ -133,6 +133,8 @@ enum { MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_ON = 0x4, MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_OFF = 0x5, MLX5_FPGA_CTRL_OPERATION_RESET_SANDBOX = 0x6, + MLX5_FPGA_CTRL_OPERATION_DISCONNECT = 0x9, + MLX5_FPGA_CTRL_OPERATION_CONNECT = 0xA, }; struct mlx5_ifc_fpga_ctrl_bits { Modified: stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c == --- stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 12 12:54:21 2018(r341965) +++ stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 12 12:54:43 2018(r341966) @@ -37,6 +37,7 @@ #include #include #include +#include #define MLX5_FPGA_ACCESS_REG_SZ (MLX5_ST_SZ_DW(fpga_access_reg) + \ MLX5_FPGA_ACCESS_REG_SIZE_MAX) @@ -162,6 +163,33 @@ int mlx5_fpga_query(struct mlx5_core_dev *dev, struct query->admin_image = MLX5_GET(fpga_ctrl, out, flash_select_admin); query->oper_image = MLX5_GET(fpga_ctrl, out, flash_select_oper); return 0; +} + +int mlx5_fpga_ctrl_connect(struct mlx5_core_dev *dev, + enum mlx5_fpga_connect *connect) +{ + u32 in[MLX5_ST_SZ_DW(fpga_ctrl)] = {0}; + u32 out[MLX5_ST_SZ_DW(fpga_ctrl)]; + int status; + int err; + + if (*connect == MLX5_FPGA_CONNECT_QUERY) { + err = mlx5_core_access_reg(dev, in, sizeof(in), out, + sizeof(out), MLX5_REG_FPGA_CTRL, + 0, false); + if (err) + return err; + status = MLX5_GET(fpga_ctrl, out, status); + *connect = (status == MLX5_FDEV_STATE_DISCONNECTED) ? + MLX5_FPGA_CONNECT_DISCONNECT : + MLX5_FPGA_CONNECT_CONNECT; + } else { + MLX5_SET(fpga_ctrl, in, operation, *connect); + err = mlx5_core_access_reg(dev, in, sizeof(in), out, + sizeof(out), MLX5_REG_FPGA_CTRL, + 0, true); + } + return err; } int mlx5_fpga_query_mtmp(struct mlx5_core_dev *dev, Modified: stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c == --- stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Wed Dec 12 12:54:21 2018(r341965) +++
svn commit: r341963 - in stable/12/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools
Author: hselasky Date: Wed Dec 12 12:53:23 2018 New Revision: 341963 URL: https://svnweb.freebsd.org/changeset/base/341963 Log: MFC r341575: mlx5fpga: IOCTL for FPGA temperature measurement Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_fpga/cmd.h stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c stable/12/sys/dev/mlx5/mlx5_fpga/sdk.h stable/12/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c stable/12/sys/dev/mlx5/mlx5_ifc.h stable/12/sys/dev/mlx5/mlx5io.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h == --- stable/12/sys/dev/mlx5/driver.h Wed Dec 12 12:52:30 2018 (r341962) +++ stable/12/sys/dev/mlx5/driver.h Wed Dec 12 12:53:23 2018 (r341963) @@ -151,6 +151,7 @@ enum { MLX5_REG_PMLP= 0x5002, MLX5_REG_NODE_DESC = 0x6001, MLX5_REG_HOST_ENDIANNESS = 0x7004, + MLX5_REG_MTMP= 0x900a, MLX5_REG_MCIA= 0x9014, MLX5_REG_MPCNT = 0x9051, }; Modified: stable/12/sys/dev/mlx5/mlx5_fpga/cmd.h == --- stable/12/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 12 12:52:30 2018 (r341962) +++ stable/12/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 12 12:53:23 2018 (r341963) @@ -60,6 +60,8 @@ struct mlx5_fpga_shell_counters { int mlx5_fpga_caps(struct mlx5_core_dev *dev); int mlx5_fpga_query(struct mlx5_core_dev *dev, struct mlx5_fpga_query *query); +int mlx5_fpga_query_mtmp(struct mlx5_core_dev *dev, +struct mlx5_fpga_temperature *temp); int mlx5_fpga_ctrl_op(struct mlx5_core_dev *dev, u8 op); int mlx5_fpga_access_reg(struct mlx5_core_dev *dev, u8 size, u64 addr, void *buf, bool write); Modified: stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c == --- stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 12 12:52:30 2018(r341962) +++ stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 12 12:53:23 2018(r341963) @@ -164,6 +164,38 @@ int mlx5_fpga_query(struct mlx5_core_dev *dev, struct return 0; } +int mlx5_fpga_query_mtmp(struct mlx5_core_dev *dev, +struct mlx5_fpga_temperature *temp) +{ + u32 in[MLX5_ST_SZ_DW(mtmp_reg)] = {0}; + u32 out[MLX5_ST_SZ_DW(mtmp_reg)] = {0}; + int err; + + MLX5_SET(mtmp_reg, in, sensor_index, temp->index); + MLX5_SET(mtmp_reg, in, i, +((temp->index < MLX5_FPGA_INTERNAL_SENSORS_LOW) || +(temp->index > MLX5_FPGA_INTERNAL_SENSORS_HIGH)) ? 1 : 0); + + err = mlx5_core_access_reg(dev, in, sizeof(in), out, sizeof(out), + MLX5_REG_MTMP, 0, false); + if (err) + return err; + + temp->index = MLX5_GET(mtmp_reg, out, sensor_index); + temp->temperature = MLX5_GET(mtmp_reg, out, temperature); + temp->mte = MLX5_GET(mtmp_reg, out, mte); + temp->max_temperature = MLX5_GET(mtmp_reg, out, max_temperature); + temp->tee = MLX5_GET(mtmp_reg, out, tee); + temp->temperature_threshold_hi = MLX5_GET(mtmp_reg, out, + temperature_threshold_hi); + temp->temperature_threshold_lo = MLX5_GET(mtmp_reg, out, + temperature_threshold_lo); + memcpy(temp->sensor_name, MLX5_ADDR_OF(mtmp_reg, out, sensor_name), + MLX5_FLD_SZ_BYTES(mtmp_reg, sensor_name)); + + return 0; +} + int mlx5_fpga_create_qp(struct mlx5_core_dev *dev, void *fpga_qpc, u32 *fpga_qpn) { Modified: stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c == --- stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Wed Dec 12 12:52:30 2018(r341962) +++ stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Wed Dec 12 12:53:23 2018(r341963) @@ -442,6 +442,13 @@ int mlx5_fpga_flash_select(struct mlx5_fpga_device *fd } EXPORT_SYMBOL(mlx5_fpga_flash_select); +int mlx5_fpga_temperature(struct mlx5_fpga_device *fdev, + struct mlx5_fpga_temperature *temp) +{ + return mlx5_fpga_query_mtmp(fdev->mdev, temp); +} +EXPORT_SYMBOL(mlx5_fpga_temperature); + struct device *mlx5_fpga_dev(struct mlx5_fpga_device *fdev) { return >mdev->pdev->dev; Modified: stable/12/sys/dev/mlx5/mlx5_fpga/sdk.h == --- stable/12/sys/dev/mlx5/mlx5_fpga/sdk.h Wed Dec 12 12:52:30 2018 (r341962) +++ stable/12/sys/dev/mlx5/mlx5_fpga/sdk.h Wed Dec 12 12:53:23 2018 (r341963)
svn commit: r341964 - in stable/11/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools
Author: hselasky Date: Wed Dec 12 12:53:31 2018 New Revision: 341964 URL: https://svnweb.freebsd.org/changeset/base/341964 Log: MFC r341575: mlx5fpga: IOCTL for FPGA temperature measurement Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_fpga/cmd.h stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c stable/11/sys/dev/mlx5/mlx5_fpga/sdk.h stable/11/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c stable/11/sys/dev/mlx5/mlx5_ifc.h stable/11/sys/dev/mlx5/mlx5io.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h == --- stable/11/sys/dev/mlx5/driver.h Wed Dec 12 12:53:23 2018 (r341963) +++ stable/11/sys/dev/mlx5/driver.h Wed Dec 12 12:53:31 2018 (r341964) @@ -149,6 +149,7 @@ enum { MLX5_REG_PMLP= 0x5002, MLX5_REG_NODE_DESC = 0x6001, MLX5_REG_HOST_ENDIANNESS = 0x7004, + MLX5_REG_MTMP= 0x900a, MLX5_REG_MCIA= 0x9014, MLX5_REG_MPCNT = 0x9051, }; Modified: stable/11/sys/dev/mlx5/mlx5_fpga/cmd.h == --- stable/11/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 12 12:53:23 2018 (r341963) +++ stable/11/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 12 12:53:31 2018 (r341964) @@ -60,6 +60,8 @@ struct mlx5_fpga_shell_counters { int mlx5_fpga_caps(struct mlx5_core_dev *dev); int mlx5_fpga_query(struct mlx5_core_dev *dev, struct mlx5_fpga_query *query); +int mlx5_fpga_query_mtmp(struct mlx5_core_dev *dev, +struct mlx5_fpga_temperature *temp); int mlx5_fpga_ctrl_op(struct mlx5_core_dev *dev, u8 op); int mlx5_fpga_access_reg(struct mlx5_core_dev *dev, u8 size, u64 addr, void *buf, bool write); Modified: stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c == --- stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 12 12:53:23 2018(r341963) +++ stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 12 12:53:31 2018(r341964) @@ -164,6 +164,38 @@ int mlx5_fpga_query(struct mlx5_core_dev *dev, struct return 0; } +int mlx5_fpga_query_mtmp(struct mlx5_core_dev *dev, +struct mlx5_fpga_temperature *temp) +{ + u32 in[MLX5_ST_SZ_DW(mtmp_reg)] = {0}; + u32 out[MLX5_ST_SZ_DW(mtmp_reg)] = {0}; + int err; + + MLX5_SET(mtmp_reg, in, sensor_index, temp->index); + MLX5_SET(mtmp_reg, in, i, +((temp->index < MLX5_FPGA_INTERNAL_SENSORS_LOW) || +(temp->index > MLX5_FPGA_INTERNAL_SENSORS_HIGH)) ? 1 : 0); + + err = mlx5_core_access_reg(dev, in, sizeof(in), out, sizeof(out), + MLX5_REG_MTMP, 0, false); + if (err) + return err; + + temp->index = MLX5_GET(mtmp_reg, out, sensor_index); + temp->temperature = MLX5_GET(mtmp_reg, out, temperature); + temp->mte = MLX5_GET(mtmp_reg, out, mte); + temp->max_temperature = MLX5_GET(mtmp_reg, out, max_temperature); + temp->tee = MLX5_GET(mtmp_reg, out, tee); + temp->temperature_threshold_hi = MLX5_GET(mtmp_reg, out, + temperature_threshold_hi); + temp->temperature_threshold_lo = MLX5_GET(mtmp_reg, out, + temperature_threshold_lo); + memcpy(temp->sensor_name, MLX5_ADDR_OF(mtmp_reg, out, sensor_name), + MLX5_FLD_SZ_BYTES(mtmp_reg, sensor_name)); + + return 0; +} + int mlx5_fpga_create_qp(struct mlx5_core_dev *dev, void *fpga_qpc, u32 *fpga_qpn) { Modified: stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c == --- stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Wed Dec 12 12:53:23 2018(r341963) +++ stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Wed Dec 12 12:53:31 2018(r341964) @@ -442,6 +442,13 @@ int mlx5_fpga_flash_select(struct mlx5_fpga_device *fd } EXPORT_SYMBOL(mlx5_fpga_flash_select); +int mlx5_fpga_temperature(struct mlx5_fpga_device *fdev, + struct mlx5_fpga_temperature *temp) +{ + return mlx5_fpga_query_mtmp(fdev->mdev, temp); +} +EXPORT_SYMBOL(mlx5_fpga_temperature); + struct device *mlx5_fpga_dev(struct mlx5_fpga_device *fdev) { return >mdev->pdev->dev; Modified: stable/11/sys/dev/mlx5/mlx5_fpga/sdk.h == --- stable/11/sys/dev/mlx5/mlx5_fpga/sdk.h Wed Dec 12 12:53:23 2018 (r341963) +++ stable/11/sys/dev/mlx5/mlx5_fpga/sdk.h Wed Dec 12 12:53:31 2018 (r341964)
svn commit: r341965 - in stable/12/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools
Author: hselasky Date: Wed Dec 12 12:54:21 2018 New Revision: 341965 URL: https://svnweb.freebsd.org/changeset/base/341965 Log: MFC r341576: mlx5fpga: Add set and query connect/disconnect FPGA Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_fpga/cmd.h stable/12/sys/dev/mlx5/mlx5_fpga/core.h stable/12/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c stable/12/sys/dev/mlx5/mlx5_fpga/sdk.h stable/12/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c stable/12/sys/dev/mlx5/mlx5io.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_fpga/cmd.h == --- stable/12/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 12 12:53:31 2018 (r341964) +++ stable/12/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 12 12:54:21 2018 (r341965) @@ -69,6 +69,8 @@ int mlx5_fpga_sbu_caps(struct mlx5_core_dev *dev, void int mlx5_fpga_load(struct mlx5_core_dev *dev, enum mlx5_fpga_image image); int mlx5_fpga_image_select(struct mlx5_core_dev *dev, enum mlx5_fpga_image image); +int mlx5_fpga_ctrl_connect(struct mlx5_core_dev *dev, + enum mlx5_fpga_connect *connect); int mlx5_fpga_shell_counters(struct mlx5_core_dev *dev, bool clear, struct mlx5_fpga_shell_counters *data); Modified: stable/12/sys/dev/mlx5/mlx5_fpga/core.h == --- stable/12/sys/dev/mlx5/mlx5_fpga/core.h Wed Dec 12 12:53:31 2018 (r341964) +++ stable/12/sys/dev/mlx5/mlx5_fpga/core.h Wed Dec 12 12:54:21 2018 (r341965) @@ -52,6 +52,7 @@ enum mlx5_fdev_state { MLX5_FDEV_STATE_SUCCESS = 0, MLX5_FDEV_STATE_FAILURE = 1, MLX5_FDEV_STATE_IN_PROGRESS = 2, + MLX5_FDEV_STATE_DISCONNECTED = 3, MLX5_FDEV_STATE_NONE = 0x, }; Modified: stable/12/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h == --- stable/12/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.hWed Dec 12 12:53:31 2018(r341964) +++ stable/12/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.hWed Dec 12 12:54:21 2018(r341965) @@ -133,6 +133,8 @@ enum { MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_ON = 0x4, MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_OFF = 0x5, MLX5_FPGA_CTRL_OPERATION_RESET_SANDBOX = 0x6, + MLX5_FPGA_CTRL_OPERATION_DISCONNECT = 0x9, + MLX5_FPGA_CTRL_OPERATION_CONNECT = 0xA, }; struct mlx5_ifc_fpga_ctrl_bits { Modified: stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c == --- stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 12 12:53:31 2018(r341964) +++ stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 12 12:54:21 2018(r341965) @@ -37,6 +37,7 @@ #include #include #include +#include #define MLX5_FPGA_ACCESS_REG_SZ (MLX5_ST_SZ_DW(fpga_access_reg) + \ MLX5_FPGA_ACCESS_REG_SIZE_MAX) @@ -162,6 +163,33 @@ int mlx5_fpga_query(struct mlx5_core_dev *dev, struct query->admin_image = MLX5_GET(fpga_ctrl, out, flash_select_admin); query->oper_image = MLX5_GET(fpga_ctrl, out, flash_select_oper); return 0; +} + +int mlx5_fpga_ctrl_connect(struct mlx5_core_dev *dev, + enum mlx5_fpga_connect *connect) +{ + u32 in[MLX5_ST_SZ_DW(fpga_ctrl)] = {0}; + u32 out[MLX5_ST_SZ_DW(fpga_ctrl)]; + int status; + int err; + + if (*connect == MLX5_FPGA_CONNECT_QUERY) { + err = mlx5_core_access_reg(dev, in, sizeof(in), out, + sizeof(out), MLX5_REG_FPGA_CTRL, + 0, false); + if (err) + return err; + status = MLX5_GET(fpga_ctrl, out, status); + *connect = (status == MLX5_FDEV_STATE_DISCONNECTED) ? + MLX5_FPGA_CONNECT_DISCONNECT : + MLX5_FPGA_CONNECT_CONNECT; + } else { + MLX5_SET(fpga_ctrl, in, operation, *connect); + err = mlx5_core_access_reg(dev, in, sizeof(in), out, + sizeof(out), MLX5_REG_FPGA_CTRL, + 0, true); + } + return err; } int mlx5_fpga_query_mtmp(struct mlx5_core_dev *dev, Modified: stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c == --- stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Wed Dec 12 12:53:31 2018(r341964) +++
svn commit: r341962 - in stable/11/sys/dev/mlx5: . mlx5_fpga
Author: hselasky Date: Wed Dec 12 12:52:30 2018 New Revision: 341962 URL: https://svnweb.freebsd.org/changeset/base/341962 Log: MFC r341574: mlx5fpga: Support MorseQ board Added and supported new enum "morseQ = 4" for fpga_id field Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c stable/11/sys/dev/mlx5/mlx5io.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c == --- stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.cWed Dec 12 12:52:10 2018(r341961) +++ stable/11/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.cWed Dec 12 12:52:30 2018(r341962) @@ -138,6 +138,8 @@ static const char *mlx5_fpga_name(u32 fpga_id) return "Edison"; case MLX5_FPGA_MORSE: return "Morse"; + case MLX5_FPGA_MORSEQ: + return "MorseQ"; } snprintf(ret, sizeof(ret), "Unknown %d", fpga_id); @@ -148,6 +150,7 @@ static int mlx5_fpga_device_load_check(struct mlx5_fpg { struct mlx5_fpga_query query; int err; + u32 fpga_id; err = mlx5_fpga_query(fdev->mdev, ); if (err) { @@ -162,8 +165,9 @@ static int mlx5_fpga_device_load_check(struct mlx5_fpg mlx5_fpga_info(fdev, "Status %u; Admin image %u; Oper image %u\n", query.image_status, query.admin_image, query.oper_image); - /* For Morse project FPGA has no influence to network functionality */ - if (MLX5_CAP_FPGA(fdev->mdev, fpga_id) == MLX5_FPGA_MORSE) + /* For Morse projects FPGA has no influence to network functionality */ + fpga_id = MLX5_CAP_FPGA(fdev->mdev, fpga_id); + if (fpga_id == MLX5_FPGA_MORSE || fpga_id == MLX5_FPGA_MORSEQ) return 0; if (query.image_status != MLX5_FPGA_STATUS_SUCCESS) { @@ -226,7 +230,7 @@ int mlx5_fpga_device_start(struct mlx5_core_dev *mdev) fpga_id = MLX5_CAP_FPGA(fdev->mdev, fpga_id); mlx5_fpga_info(fdev, "FPGA card %s\n", mlx5_fpga_name(fpga_id)); - if (fpga_id == MLX5_FPGA_MORSE) + if (fpga_id == MLX5_FPGA_MORSE || fpga_id == MLX5_FPGA_MORSEQ) goto out; mlx5_fpga_info(fdev, "%s(%d) image, version %u; SBU %06x:%04x version %d\n", @@ -361,13 +365,16 @@ void mlx5_fpga_device_stop(struct mlx5_core_dev *mdev) unsigned int max_num_qps; unsigned long flags; int err; + u32 fpga_id; if (!fdev) return; - spin_lock_irqsave(>state_lock, flags); - if (MLX5_CAP_FPGA(mdev, fpga_id) == MLX5_FPGA_MORSE) + fpga_id = MLX5_CAP_FPGA(mdev, fpga_id); + if (fpga_id == MLX5_FPGA_MORSE || fpga_id == MLX5_FPGA_MORSEQ) return; + + spin_lock_irqsave(>state_lock, flags); if (fdev->fdev_state != MLX5_FDEV_STATE_SUCCESS) { spin_unlock_irqrestore(>state_lock, flags); Modified: stable/11/sys/dev/mlx5/mlx5io.h == --- stable/11/sys/dev/mlx5/mlx5io.h Wed Dec 12 12:52:10 2018 (r341961) +++ stable/11/sys/dev/mlx5/mlx5io.h Wed Dec 12 12:52:30 2018 (r341962) @@ -61,6 +61,7 @@ enum mlx5_fpga_id { MLX5_FPGA_NEWTON = 0, MLX5_FPGA_EDISON = 1, MLX5_FPGA_MORSE = 2, + MLX5_FPGA_MORSEQ = 3, }; enum mlx5_fpga_image { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341961 - in stable/12/sys/dev/mlx5: . mlx5_fpga
Author: hselasky Date: Wed Dec 12 12:52:10 2018 New Revision: 341961 URL: https://svnweb.freebsd.org/changeset/base/341961 Log: MFC r341574: mlx5fpga: Support MorseQ board Added and supported new enum "morseQ = 4" for fpga_id field Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c stable/12/sys/dev/mlx5/mlx5io.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c == --- stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.cWed Dec 12 12:50:23 2018(r341960) +++ stable/12/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.cWed Dec 12 12:52:10 2018(r341961) @@ -138,6 +138,8 @@ static const char *mlx5_fpga_name(u32 fpga_id) return "Edison"; case MLX5_FPGA_MORSE: return "Morse"; + case MLX5_FPGA_MORSEQ: + return "MorseQ"; } snprintf(ret, sizeof(ret), "Unknown %d", fpga_id); @@ -148,6 +150,7 @@ static int mlx5_fpga_device_load_check(struct mlx5_fpg { struct mlx5_fpga_query query; int err; + u32 fpga_id; err = mlx5_fpga_query(fdev->mdev, ); if (err) { @@ -162,8 +165,9 @@ static int mlx5_fpga_device_load_check(struct mlx5_fpg mlx5_fpga_info(fdev, "Status %u; Admin image %u; Oper image %u\n", query.image_status, query.admin_image, query.oper_image); - /* For Morse project FPGA has no influence to network functionality */ - if (MLX5_CAP_FPGA(fdev->mdev, fpga_id) == MLX5_FPGA_MORSE) + /* For Morse projects FPGA has no influence to network functionality */ + fpga_id = MLX5_CAP_FPGA(fdev->mdev, fpga_id); + if (fpga_id == MLX5_FPGA_MORSE || fpga_id == MLX5_FPGA_MORSEQ) return 0; if (query.image_status != MLX5_FPGA_STATUS_SUCCESS) { @@ -226,7 +230,7 @@ int mlx5_fpga_device_start(struct mlx5_core_dev *mdev) fpga_id = MLX5_CAP_FPGA(fdev->mdev, fpga_id); mlx5_fpga_info(fdev, "FPGA card %s\n", mlx5_fpga_name(fpga_id)); - if (fpga_id == MLX5_FPGA_MORSE) + if (fpga_id == MLX5_FPGA_MORSE || fpga_id == MLX5_FPGA_MORSEQ) goto out; mlx5_fpga_info(fdev, "%s(%d) image, version %u; SBU %06x:%04x version %d\n", @@ -361,13 +365,16 @@ void mlx5_fpga_device_stop(struct mlx5_core_dev *mdev) unsigned int max_num_qps; unsigned long flags; int err; + u32 fpga_id; if (!fdev) return; - spin_lock_irqsave(>state_lock, flags); - if (MLX5_CAP_FPGA(mdev, fpga_id) == MLX5_FPGA_MORSE) + fpga_id = MLX5_CAP_FPGA(mdev, fpga_id); + if (fpga_id == MLX5_FPGA_MORSE || fpga_id == MLX5_FPGA_MORSEQ) return; + + spin_lock_irqsave(>state_lock, flags); if (fdev->fdev_state != MLX5_FDEV_STATE_SUCCESS) { spin_unlock_irqrestore(>state_lock, flags); Modified: stable/12/sys/dev/mlx5/mlx5io.h == --- stable/12/sys/dev/mlx5/mlx5io.h Wed Dec 12 12:50:23 2018 (r341960) +++ stable/12/sys/dev/mlx5/mlx5io.h Wed Dec 12 12:52:10 2018 (r341961) @@ -61,6 +61,7 @@ enum mlx5_fpga_id { MLX5_FPGA_NEWTON = 0, MLX5_FPGA_EDISON = 1, MLX5_FPGA_MORSE = 2, + MLX5_FPGA_MORSEQ = 3, }; enum mlx5_fpga_image { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341960 - in stable/11/sys: dev/mlx5 dev/mlx5/mlx5_fpga_tools modules/mlx5fpga_tools
Author: hselasky Date: Wed Dec 12 12:50:23 2018 New Revision: 341960 URL: https://svnweb.freebsd.org/changeset/base/341960 Log: MFC r341573 amd r341643: mlx5fpga_tools initial code import. Submitted by: kib@ Sponsored by: Mellanox Technologies Added: stable/11/sys/dev/mlx5/mlx5_fpga_tools/ - copied from r341573, head/sys/dev/mlx5/mlx5_fpga_tools/ stable/11/sys/modules/mlx5fpga_tools/ - copied from r341573, head/sys/modules/mlx5fpga_tools/ Modified: stable/11/sys/dev/mlx5/mlx5io.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5io.h == --- stable/11/sys/dev/mlx5/mlx5io.h Wed Dec 12 12:50:13 2018 (r341959) +++ stable/11/sys/dev/mlx5/mlx5io.h Wed Dec 12 12:50:23 2018 (r341960) @@ -97,4 +97,15 @@ enum mlx5_fpga_access_type { MLX5_FPGA_ACCESS_TYPE_MAX = MLX5_FPGA_ACCESS_TYPE_DONTCARE, }; +#defineMLX5_FPGA_CAP_ARR_SZ 0x40 + +#defineMLX5_FPGA_ACCESS_TYPE _IOWINT('m', 0x80) +#defineMLX5_FPGA_LOAD _IOWINT('m', 0x81) +#defineMLX5_FPGA_RESET _IO('m', 0x82) +#defineMLX5_FPGA_IMAGE_SEL _IOWINT('m', 0x83) +#defineMLX5_FPGA_QUERY _IOR('m', 0x84, struct mlx5_fpga_query) +#defineMLX5_FPGA_CAP _IOR('m', 0x85, uint32_t[MLX5_FPGA_CAP_ARR_SZ]) + +#defineMLX5_FPGA_TOOLS_NAME_SUFFIX "_mlx5_fpga_tools" + #endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341959 - in stable/12/sys: dev/mlx5 dev/mlx5/mlx5_fpga_tools modules/mlx5fpga_tools
Author: hselasky Date: Wed Dec 12 12:50:13 2018 New Revision: 341959 URL: https://svnweb.freebsd.org/changeset/base/341959 Log: MFC r341573 and r341643: mlx5fpga_tools initial code import. Submitted by: kib@ Sponsored by: Mellanox Technologies Added: stable/12/sys/dev/mlx5/mlx5_fpga_tools/ - copied from r341573, head/sys/dev/mlx5/mlx5_fpga_tools/ stable/12/sys/modules/mlx5fpga_tools/ - copied from r341573, head/sys/modules/mlx5fpga_tools/ Modified: stable/12/sys/dev/mlx5/mlx5io.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5io.h == --- stable/12/sys/dev/mlx5/mlx5io.h Wed Dec 12 12:46:12 2018 (r341958) +++ stable/12/sys/dev/mlx5/mlx5io.h Wed Dec 12 12:50:13 2018 (r341959) @@ -97,4 +97,15 @@ enum mlx5_fpga_access_type { MLX5_FPGA_ACCESS_TYPE_MAX = MLX5_FPGA_ACCESS_TYPE_DONTCARE, }; +#defineMLX5_FPGA_CAP_ARR_SZ 0x40 + +#defineMLX5_FPGA_ACCESS_TYPE _IOWINT('m', 0x80) +#defineMLX5_FPGA_LOAD _IOWINT('m', 0x81) +#defineMLX5_FPGA_RESET _IO('m', 0x82) +#defineMLX5_FPGA_IMAGE_SEL _IOWINT('m', 0x83) +#defineMLX5_FPGA_QUERY _IOR('m', 0x84, struct mlx5_fpga_query) +#defineMLX5_FPGA_CAP _IOR('m', 0x85, uint32_t[MLX5_FPGA_CAP_ARR_SZ]) + +#defineMLX5_FPGA_TOOLS_NAME_SUFFIX "_mlx5_fpga_tools" + #endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341958 - in stable/11/sys: conf dev/mlx5 dev/mlx5/mlx5_accel dev/mlx5/mlx5_core dev/mlx5/mlx5_fpga dev/mlx5/mlx5_lib modules/mlx5 modules/mlx5en modules/mlx5ib
Author: hselasky Date: Wed Dec 12 12:46:12 2018 New Revision: 341958 URL: https://svnweb.freebsd.org/changeset/base/341958 Log: MFC r341572 and r341590: mlx5fpga: Initial code import. Submitted by: kib@ Sponsored by: Mellanox Technologies Added: stable/11/sys/dev/mlx5/mlx5_accel/ - copied from r341572, head/sys/dev/mlx5/mlx5_accel/ stable/11/sys/dev/mlx5/mlx5_fpga/ - copied from r341572, head/sys/dev/mlx5/mlx5_fpga/ stable/11/sys/dev/mlx5/mlx5_lib/ - copied from r341572, head/sys/dev/mlx5/mlx5_lib/ Modified: stable/11/sys/conf/files stable/11/sys/dev/mlx5/device.h stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/11/sys/dev/mlx5/mlx5_core/wq.h stable/11/sys/dev/mlx5/mlx5_ifc.h stable/11/sys/dev/mlx5/mlx5io.h stable/11/sys/modules/mlx5/Makefile stable/11/sys/modules/mlx5en/Makefile stable/11/sys/modules/mlx5ib/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files == --- stable/11/sys/conf/filesWed Dec 12 12:46:11 2018(r341957) +++ stable/11/sys/conf/filesWed Dec 12 12:46:12 2018(r341958) @@ -4591,6 +4591,8 @@ dev/mlx5/mlx5_core/mlx5_vsc.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_wq.c optional mlx5 pci \ compile-with "${OFED_C}" +dev/mlx5/mlx5_lib/mlx5_gid.c optional mlx5 pci \ + compile-with "${OFED_C}" dev/mlx5/mlx5_en/mlx5_en_ethtool.c optional mlx5en pci inet inet6 \ compile-with "${OFED_C}" Modified: stable/11/sys/dev/mlx5/device.h == --- stable/11/sys/dev/mlx5/device.h Wed Dec 12 12:46:11 2018 (r341957) +++ stable/11/sys/dev/mlx5/device.h Wed Dec 12 12:46:12 2018 (r341958) @@ -1032,6 +1032,12 @@ enum mlx5_qcam_feature_groups { #defineMLX5_CAP_QCAM_FEATURE(mdev, fld) \ MLX5_GET(qcam_reg, (mdev)->caps.qcam, qos_feature_cap_mask.feature_cap.fld) +#define MLX5_CAP_FPGA(mdev, cap) \ + MLX5_GET(fpga_cap, (mdev)->caps.fpga, cap) + +#define MLX5_CAP64_FPGA(mdev, cap) \ + MLX5_GET64(fpga_cap, (mdev)->caps.fpga, cap) + enum { MLX5_CMD_STAT_OK= 0x0, MLX5_CMD_STAT_INT_ERR = 0x1, Modified: stable/11/sys/dev/mlx5/driver.h == --- stable/11/sys/dev/mlx5/driver.h Wed Dec 12 12:46:11 2018 (r341957) +++ stable/11/sys/dev/mlx5/driver.h Wed Dec 12 12:46:12 2018 (r341958) @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -129,6 +130,10 @@ enum { MLX5_REG_DCBX_PARAM = 0x4020, MLX5_REG_DCBX_APP= 0x4021, MLX5_REG_PCAP= 0x5001, + MLX5_REG_FPGA_CAP= 0x4022, + MLX5_REG_FPGA_CTRL = 0x4023, + MLX5_REG_FPGA_ACCESS_REG = 0x4024, + MLX5_REG_FPGA_SHELL_CNTR = 0x4025, MLX5_REG_PMTU= 0x5003, MLX5_REG_PTYS= 0x5004, MLX5_REG_PAOS= 0x5006, @@ -402,6 +407,13 @@ struct mlx5_buf { u8 load_done; }; +struct mlx5_frag_buf { + struct mlx5_buf_list*frags; + int npages; + int size; + u8 page_shift; +}; + struct mlx5_eq { struct mlx5_core_dev *dev; __be32 __iomem *doorbell; @@ -440,6 +452,20 @@ struct mlx5_core_sig_ctx { u32 sigerr_count; }; +enum { + MLX5_MKEY_MR = 1, + MLX5_MKEY_MW, + MLX5_MKEY_MR_USER, +}; + +struct mlx5_core_mkey { + u64 iova; + u64 size; + u32 key; + u32 pd; + u32 type; +}; + struct mlx5_core_mr { u64 iova; u64 size; @@ -619,6 +645,14 @@ enum mlx5_pci_status { MLX5_PCI_STATUS_ENABLED, }; +#defineMLX5_MAX_RESERVED_GIDS 8 + +struct mlx5_rsvd_gids { + unsigned int start; + unsigned int count; + struct ida ida; +}; + struct mlx5_special_contexts { int resd_lkey; }; @@ -637,6 +671,7 @@ struct mlx5_core_dev { u32 hca_caps_max[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)]; struct { u32 qcam[MLX5_ST_SZ_DW(qcam_reg)]; + u32 fpga[MLX5_ST_SZ_DW(fpga_cap)]; } caps; phys_addr_t iseg_base; struct mlx5_init_seg __iomem *iseg; @@ -665,6 +700,14 @@ struct mlx5_core_dev { struct sysctl_ctx_list sysctl_ctx; int
svn commit: r341957 - in stable/12/sys: conf dev/mlx5 dev/mlx5/mlx5_accel dev/mlx5/mlx5_core dev/mlx5/mlx5_fpga dev/mlx5/mlx5_lib modules/mlx5 modules/mlx5en modules/mlx5ib
Author: hselasky Date: Wed Dec 12 12:46:11 2018 New Revision: 341957 URL: https://svnweb.freebsd.org/changeset/base/341957 Log: MFC r341572 and r341590: mlx5fpga: Initial code import. Submitted by: kib@ Sponsored by: Mellanox Technologies Added: stable/12/sys/dev/mlx5/mlx5_accel/ - copied from r341572, head/sys/dev/mlx5/mlx5_accel/ stable/12/sys/dev/mlx5/mlx5_fpga/ - copied from r341572, head/sys/dev/mlx5/mlx5_fpga/ stable/12/sys/dev/mlx5/mlx5_lib/ - copied from r341572, head/sys/dev/mlx5/mlx5_lib/ Modified: stable/12/sys/conf/files stable/12/sys/dev/mlx5/device.h stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/12/sys/dev/mlx5/mlx5_core/wq.h stable/12/sys/dev/mlx5/mlx5_ifc.h stable/12/sys/dev/mlx5/mlx5io.h stable/12/sys/modules/mlx5/Makefile stable/12/sys/modules/mlx5en/Makefile stable/12/sys/modules/mlx5ib/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files == --- stable/12/sys/conf/filesWed Dec 12 12:35:51 2018(r341956) +++ stable/12/sys/conf/filesWed Dec 12 12:46:11 2018(r341957) @@ -4792,6 +4792,8 @@ dev/mlx5/mlx5_core/mlx5_vsc.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_wq.c optional mlx5 pci \ compile-with "${OFED_C}" +dev/mlx5/mlx5_lib/mlx5_gid.c optional mlx5 pci \ + compile-with "${OFED_C}" dev/mlx5/mlx5_en/mlx5_en_ethtool.c optional mlx5en pci inet inet6 \ compile-with "${OFED_C}" Modified: stable/12/sys/dev/mlx5/device.h == --- stable/12/sys/dev/mlx5/device.h Wed Dec 12 12:35:51 2018 (r341956) +++ stable/12/sys/dev/mlx5/device.h Wed Dec 12 12:46:11 2018 (r341957) @@ -1034,6 +1034,12 @@ enum mlx5_qcam_feature_groups { #defineMLX5_CAP_QCAM_FEATURE(mdev, fld) \ MLX5_GET(qcam_reg, (mdev)->caps.qcam, qos_feature_cap_mask.feature_cap.fld) +#define MLX5_CAP_FPGA(mdev, cap) \ + MLX5_GET(fpga_cap, (mdev)->caps.fpga, cap) + +#define MLX5_CAP64_FPGA(mdev, cap) \ + MLX5_GET64(fpga_cap, (mdev)->caps.fpga, cap) + enum { MLX5_CMD_STAT_OK= 0x0, MLX5_CMD_STAT_INT_ERR = 0x1, Modified: stable/12/sys/dev/mlx5/driver.h == --- stable/12/sys/dev/mlx5/driver.h Wed Dec 12 12:35:51 2018 (r341956) +++ stable/12/sys/dev/mlx5/driver.h Wed Dec 12 12:46:11 2018 (r341957) @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -131,6 +132,10 @@ enum { MLX5_REG_DCBX_PARAM = 0x4020, MLX5_REG_DCBX_APP= 0x4021, MLX5_REG_PCAP= 0x5001, + MLX5_REG_FPGA_CAP= 0x4022, + MLX5_REG_FPGA_CTRL = 0x4023, + MLX5_REG_FPGA_ACCESS_REG = 0x4024, + MLX5_REG_FPGA_SHELL_CNTR = 0x4025, MLX5_REG_PMTU= 0x5003, MLX5_REG_PTYS= 0x5004, MLX5_REG_PAOS= 0x5006, @@ -404,6 +409,13 @@ struct mlx5_buf { u8 load_done; }; +struct mlx5_frag_buf { + struct mlx5_buf_list*frags; + int npages; + int size; + u8 page_shift; +}; + struct mlx5_eq { struct mlx5_core_dev *dev; __be32 __iomem *doorbell; @@ -442,6 +454,20 @@ struct mlx5_core_sig_ctx { u32 sigerr_count; }; +enum { + MLX5_MKEY_MR = 1, + MLX5_MKEY_MW, + MLX5_MKEY_MR_USER, +}; + +struct mlx5_core_mkey { + u64 iova; + u64 size; + u32 key; + u32 pd; + u32 type; +}; + struct mlx5_core_mr { u64 iova; u64 size; @@ -645,6 +671,14 @@ enum mlx5_pci_status { MLX5_PCI_STATUS_ENABLED, }; +#defineMLX5_MAX_RESERVED_GIDS 8 + +struct mlx5_rsvd_gids { + unsigned int start; + unsigned int count; + struct ida ida; +}; + struct mlx5_special_contexts { int resd_lkey; }; @@ -663,6 +697,7 @@ struct mlx5_core_dev { u32 hca_caps_max[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)]; struct { u32 qcam[MLX5_ST_SZ_DW(qcam_reg)]; + u32 fpga[MLX5_ST_SZ_DW(fpga_cap)]; } caps; phys_addr_t iseg_base; struct mlx5_init_seg __iomem *iseg; @@ -691,6 +726,14 @@ struct mlx5_core_dev { struct sysctl_ctx_list sysctl_ctx; int
svn commit: r341955 - stable/12/sys/dev/mlx5/mlx5_ib
Author: hselasky Date: Wed Dec 12 12:35:33 2018 New Revision: 341955 URL: https://svnweb.freebsd.org/changeset/base/341955 Log: MFC r341571: mlx5ib: Set default active width and speed when querying port. Make sure the active width and speed is set in case the translate_eth_proto_oper() function doesn't recognize the current port operation mask. Linux commit: 7672ed33c4c15dbe9d56880683baaba4227cf940 Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c == --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 12:34:35 2018(r341954) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 12:35:33 2018(r341955) @@ -219,6 +219,8 @@ static int translate_eth_proto_oper(u32 eth_proto_oper *active_speed = IB_SPEED_EDR; break; default: + *active_width = IB_WIDTH_4X; + *active_speed = IB_SPEED_QDR; return -EINVAL; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341956 - stable/11/sys/dev/mlx5/mlx5_ib
Author: hselasky Date: Wed Dec 12 12:35:51 2018 New Revision: 341956 URL: https://svnweb.freebsd.org/changeset/base/341956 Log: MFC r341571: mlx5ib: Set default active width and speed when querying port. Make sure the active width and speed is set in case the translate_eth_proto_oper() function doesn't recognize the current port operation mask. Linux commit: 7672ed33c4c15dbe9d56880683baaba4227cf940 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c == --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 12:35:33 2018(r341955) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 12:35:51 2018(r341956) @@ -219,6 +219,8 @@ static int translate_eth_proto_oper(u32 eth_proto_oper *active_speed = IB_SPEED_EDR; break; default: + *active_width = IB_WIDTH_4X; + *active_speed = IB_SPEED_QDR; return -EINVAL; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341953 - stable/12/sys/dev/mlx5/mlx5_ib
Author: hselasky Date: Wed Dec 12 12:34:30 2018 New Revision: 341953 URL: https://svnweb.freebsd.org/changeset/base/341953 Log: MFC r341570: mlx5ib: Make sure the congestion work timer does not escape the drain procedure. If the mlx5_ib_read_cong_stats() function was running when mlx5ib was unloaded, because this function unconditionally restarts the timer, the timer can still be pending after the delayed work has been cancelled. To fix this simply loop on the delayed work cancel procedure as long as it returns non-zero. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c == --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c Wed Dec 12 12:33:17 2018(r341952) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c Wed Dec 12 12:34:30 2018(r341953) @@ -393,7 +393,8 @@ void mlx5_ib_cleanup_congestion(struct mlx5_ib_dev *dev) { - cancel_delayed_work_sync(>congestion.dwork); + while (cancel_delayed_work_sync(>congestion.dwork)) + ; sysctl_ctx_free(>congestion.ctx); sx_destroy(>congestion.lock); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341954 - stable/11/sys/dev/mlx5/mlx5_ib
Author: hselasky Date: Wed Dec 12 12:34:35 2018 New Revision: 341954 URL: https://svnweb.freebsd.org/changeset/base/341954 Log: MFC r341570: mlx5ib: Make sure the congestion work timer does not escape the drain procedure. If the mlx5_ib_read_cong_stats() function was running when mlx5ib was unloaded, because this function unconditionally restarts the timer, the timer can still be pending after the delayed work has been cancelled. To fix this simply loop on the delayed work cancel procedure as long as it returns non-zero. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c == --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c Wed Dec 12 12:34:30 2018(r341953) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c Wed Dec 12 12:34:35 2018(r341954) @@ -393,7 +393,8 @@ void mlx5_ib_cleanup_congestion(struct mlx5_ib_dev *dev) { - cancel_delayed_work_sync(>congestion.dwork); + while (cancel_delayed_work_sync(>congestion.dwork)) + ; sysctl_ctx_free(>congestion.ctx); sx_destroy(>congestion.lock); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341952 - stable/11/sys/dev/mlx5/mlx5_ib
Author: hselasky Date: Wed Dec 12 12:33:17 2018 New Revision: 341952 URL: https://svnweb.freebsd.org/changeset/base/341952 Log: MFC r341569: mlx5ib: Fix null pointer dereference in mlx5_ib_create_srq Although "create_srq_user" does overwrite "in.pas" on some paths, it also contains at least one feasible path which does not overwrite it. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c == --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.cWed Dec 12 12:33:12 2018(r341951) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.cWed Dec 12 12:33:17 2018(r341952) @@ -287,7 +287,7 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd, else err = create_srq_kernel(dev, srq, , buf_size); - if (err) { + if (err || !in.pas) { mlx5_ib_warn(dev, "create srq %s failed, err %d\n", pd->uobject ? "user" : "kernel", err); goto err_srq; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341951 - stable/12/sys/dev/mlx5/mlx5_ib
Author: hselasky Date: Wed Dec 12 12:33:12 2018 New Revision: 341951 URL: https://svnweb.freebsd.org/changeset/base/341951 Log: MFC r341569: mlx5ib: Fix null pointer dereference in mlx5_ib_create_srq Although "create_srq_user" does overwrite "in.pas" on some paths, it also contains at least one feasible path which does not overwrite it. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c == --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.cWed Dec 12 12:32:14 2018(r341950) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.cWed Dec 12 12:33:12 2018(r341951) @@ -287,7 +287,7 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd, else err = create_srq_kernel(dev, srq, , buf_size); - if (err) { + if (err || !in.pas) { mlx5_ib_warn(dev, "create srq %s failed, err %d\n", pd->uobject ? "user" : "kernel", err); goto err_srq; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341950 - stable/11/sys/dev/mlx5/mlx5_ib
Author: hselasky Date: Wed Dec 12 12:32:14 2018 New Revision: 341950 URL: https://svnweb.freebsd.org/changeset/base/341950 Log: MFC r341568: mlx5ib: Fix sign extension in mlx5_ib_query_device "fw_rev_min(dev->mdev)" with type "unsigned short" (16 bits, unsigned) is promoted in "fw_rev_min(dev->mdev) << 16" to type "int" (32 bits, signed), then sign-extended to type "unsigned long" (64 bits, unsigned). If "fw_rev_min(dev->mdev) << 16" is greater than 0x7FFF, the upper bits of the result will all be 1. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c == --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 12:31:57 2018(r341949) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 12:32:14 2018(r341950) @@ -605,7 +605,7 @@ static int mlx5_ib_query_device(struct ib_device *ibde return err; props->fw_ver = ((u64)fw_rev_maj(dev->mdev) << 32) | - (fw_rev_min(dev->mdev) << 16) | + ((u32)fw_rev_min(dev->mdev) << 16) | fw_rev_sub(dev->mdev); props->device_cap_flags= IB_DEVICE_CHANGE_PHY_PORT | IB_DEVICE_PORT_ACTIVE_EVENT | ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341949 - stable/12/sys/dev/mlx5/mlx5_ib
Author: hselasky Date: Wed Dec 12 12:31:57 2018 New Revision: 341949 URL: https://svnweb.freebsd.org/changeset/base/341949 Log: MFC r341568: mlx5ib: Fix sign extension in mlx5_ib_query_device "fw_rev_min(dev->mdev)" with type "unsigned short" (16 bits, unsigned) is promoted in "fw_rev_min(dev->mdev) << 16" to type "int" (32 bits, signed), then sign-extended to type "unsigned long" (64 bits, unsigned). If "fw_rev_min(dev->mdev) << 16" is greater than 0x7FFF, the upper bits of the result will all be 1. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c == --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 12:30:51 2018(r341948) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 12:31:57 2018(r341949) @@ -605,7 +605,7 @@ static int mlx5_ib_query_device(struct ib_device *ibde return err; props->fw_ver = ((u64)fw_rev_maj(dev->mdev) << 32) | - (fw_rev_min(dev->mdev) << 16) | + ((u32)fw_rev_min(dev->mdev) << 16) | fw_rev_sub(dev->mdev); props->device_cap_flags= IB_DEVICE_CHANGE_PHY_PORT | IB_DEVICE_PORT_ACTIVE_EVENT | ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341947 - in stable/12/sys: compat/linuxkpi/common/src dev/mlx5/mlx5_core dev/mlx5/mlx5_en dev/mlx5/mlx5_ib
Author: hselasky Date: Wed Dec 12 12:30:47 2018 New Revision: 341947 URL: https://svnweb.freebsd.org/changeset/base/341947 Log: MFC r341567: mlx5: Fix driver version location Driver description should be set by core and not by the Ethernet driver. Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/src/linux_pci.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/src/linux_pci.c == --- stable/12/sys/compat/linuxkpi/common/src/linux_pci.cWed Dec 12 12:29:28 2018(r341946) +++ stable/12/sys/compat/linuxkpi/common/src/linux_pci.cWed Dec 12 12:30:47 2018(r341947) @@ -199,6 +199,7 @@ linux_pci_detach(device_t dev) spin_lock(_lock); list_del(>links); spin_unlock(_lock); + device_set_desc(dev, NULL); put_device(>dev); return (0); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.cWed Dec 12 12:29:28 2018(r341946) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.cWed Dec 12 12:30:47 2018(r341947) @@ -44,6 +44,8 @@ #include "mlx5_core.h" #include "fs_core.h" +static const char mlx5_version[] = "Mellanox Core driver " + DRIVER_VERSION " (" DRIVER_RELDATE ")"; MODULE_AUTHOR("Eli Cohen "); MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 core driver"); MODULE_LICENSE("Dual BSD/GPL"); @@ -1219,6 +1221,9 @@ static int init_one(struct pci_dev *pdev, dev->profile = [prof_sel]; dev->pdev = pdev; dev->event = mlx5_core_event; + + /* Set desc */ + device_set_desc(bsddev, mlx5_version); sysctl_ctx_init(>sysctl_ctx); SYSCTL_ADD_INT(>sysctl_ctx, Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:29:28 2018(r341946) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:30:47 2018(r341947) @@ -34,8 +34,8 @@ #defineETH_DRIVER_VERSION "3.4.2" #endif -char mlx5e_version[] = "Mellanox Ethernet driver" -" (" ETH_DRIVER_VERSION ")"; +static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " + ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; static int mlx5e_get_wqe_sz(struct mlx5e_priv *priv, u32 *wqe_sz, u32 *nsegs); @@ -3685,9 +3685,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) /* set default MTU */ mlx5e_set_dev_port_mtu(ifp, ifp->if_mtu); - /* Set desc */ - device_set_desc(mdev->pdev->dev.bsddev, mlx5e_version); - /* Set default media status */ priv->media_status_last = IFM_AVALID; priv->media_active_last = IFM_ETHER | IFM_AUTO | @@ -3803,13 +3800,6 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp /* don't allow more IOCTLs */ priv->gone = 1; - /* -* Clear the device description to avoid use after free, -* because the bsddev is not destroyed when this module is -* unloaded: -*/ - device_set_desc(mdev->pdev->dev.bsddev, NULL); - /* XXX wait a bit to allow IOCTL handlers to complete */ pause("W", hz); @@ -3894,6 +3884,14 @@ mlx5e_cleanup(void) { mlx5_unregister_interface(_interface); } + +static void +mlx5e_show_version(void __unused *arg) +{ + + printf("%s", mlx5e_version); +} +SYSINIT(mlx5e_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5e_show_version, NULL); module_init_order(mlx5e_init, SI_ORDER_THIRD); module_exit_order(mlx5e_cleanup, SI_ORDER_THIRD); Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c == --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 12:29:28 2018(r341946) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 12:30:47 2018(r341947) @@ -50,7 +50,7 @@ #include #include "mlx5_ib.h" -#define DRIVER_NAME "mlx5_ib" +#define DRIVER_NAME "mlx5ib" #ifndef DRIVER_VERSION #define DRIVER_VERSION "3.4.2" #endif @@ -2963,8 +2963,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) if ((ll == IB_LINK_LAYER_ETHERNET) && !MLX5_CAP_GEN(mdev, roce)) return NULL; - printk_once(KERN_INFO "%s", mlx5_version); - dev = (struct mlx5_ib_dev *)ib_alloc_device(sizeof(*dev)); if (!dev) return NULL; @@ -3258,6 +3256,14 @@ static void __exit mlx5_ib_cleanup(void) mlx5_unregister_interface(_ib_interface);
svn commit: r341948 - in stable/11/sys: compat/linuxkpi/common/src dev/mlx5/mlx5_core dev/mlx5/mlx5_en dev/mlx5/mlx5_ib
Author: hselasky Date: Wed Dec 12 12:30:51 2018 New Revision: 341948 URL: https://svnweb.freebsd.org/changeset/base/341948 Log: MFC r341567: mlx5: Fix driver version location Driver description should be set by core and not by the Ethernet driver. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/src/linux_pci.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/src/linux_pci.c == --- stable/11/sys/compat/linuxkpi/common/src/linux_pci.cWed Dec 12 12:30:47 2018(r341947) +++ stable/11/sys/compat/linuxkpi/common/src/linux_pci.cWed Dec 12 12:30:51 2018(r341948) @@ -199,6 +199,7 @@ linux_pci_detach(device_t dev) spin_lock(_lock); list_del(>links); spin_unlock(_lock); + device_set_desc(dev, NULL); put_device(>dev); return (0); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.cWed Dec 12 12:30:47 2018(r341947) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.cWed Dec 12 12:30:51 2018(r341948) @@ -44,6 +44,8 @@ #include "mlx5_core.h" #include "fs_core.h" +static const char mlx5_version[] = "Mellanox Core driver " + DRIVER_VERSION " (" DRIVER_RELDATE ")"; MODULE_AUTHOR("Eli Cohen "); MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 core driver"); MODULE_LICENSE("Dual BSD/GPL"); @@ -1201,6 +1203,9 @@ static int init_one(struct pci_dev *pdev, dev->profile = [prof_sel]; dev->pdev = pdev; dev->event = mlx5_core_event; + + /* Set desc */ + device_set_desc(bsddev, mlx5_version); sysctl_ctx_init(>sysctl_ctx); SYSCTL_ADD_INT(>sysctl_ctx, Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:30:47 2018(r341947) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:30:51 2018(r341948) @@ -34,8 +34,8 @@ #defineETH_DRIVER_VERSION "3.4.2" #endif -char mlx5e_version[] = "Mellanox Ethernet driver" -" (" ETH_DRIVER_VERSION ")"; +static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " + ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; static int mlx5e_get_wqe_sz(struct mlx5e_priv *priv, u32 *wqe_sz, u32 *nsegs); @@ -3557,9 +3557,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) /* set default MTU */ mlx5e_set_dev_port_mtu(ifp, ifp->if_mtu); - /* Set desc */ - device_set_desc(mdev->pdev->dev.bsddev, mlx5e_version); - /* Set default media status */ priv->media_status_last = IFM_AVALID; priv->media_active_last = IFM_ETHER | IFM_AUTO | @@ -3664,13 +3661,6 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp /* don't allow more IOCTLs */ priv->gone = 1; - /* -* Clear the device description to avoid use after free, -* because the bsddev is not destroyed when this module is -* unloaded: -*/ - device_set_desc(mdev->pdev->dev.bsddev, NULL); - /* XXX wait a bit to allow IOCTL handlers to complete */ pause("W", hz); @@ -3738,6 +3728,14 @@ mlx5e_cleanup(void) { mlx5_unregister_interface(_interface); } + +static void +mlx5e_show_version(void __unused *arg) +{ + + printf("%s", mlx5e_version); +} +SYSINIT(mlx5e_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5e_show_version, NULL); module_init_order(mlx5e_init, SI_ORDER_THIRD); module_exit_order(mlx5e_cleanup, SI_ORDER_THIRD); Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c == --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 12:30:47 2018(r341947) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 12:30:51 2018(r341948) @@ -50,7 +50,7 @@ #include #include "mlx5_ib.h" -#define DRIVER_NAME "mlx5_ib" +#define DRIVER_NAME "mlx5ib" #ifndef DRIVER_VERSION #define DRIVER_VERSION "3.4.2" #endif @@ -2963,8 +2963,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) if ((ll == IB_LINK_LAYER_ETHERNET) && !MLX5_CAP_GEN(mdev, roce)) return NULL; - printk_once(KERN_INFO "%s", mlx5_version); - dev = (struct mlx5_ib_dev *)ib_alloc_device(sizeof(*dev)); if (!dev) return NULL; @@ -3259,6 +3257,14 @@ static void __exit mlx5_ib_cleanup(void) mlx5_unregister_interface(_ib_interface);
svn commit: r341945 - in stable/12/sys/dev/mlx5: . mlx5_core
Author: hselasky Date: Wed Dec 12 12:29:22 2018 New Revision: 341945 URL: https://svnweb.freebsd.org/changeset/base/341945 Log: MFC r341566: mlx5: Fixes to allow command polling mode to exist alongside event mode. A command is either polling or event driven and the mode cannot change during execution of a command. Make sure the event handler only handle commands which are not polled. This is done by checking the command mode in the command handler before completing commands. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h == --- stable/12/sys/dev/mlx5/driver.h Wed Dec 12 12:28:24 2018 (r341944) +++ stable/12/sys/dev/mlx5/driver.h Wed Dec 12 12:29:22 2018 (r341945) @@ -327,6 +327,11 @@ struct mlx5_traffic_counter { u64 octets; }; +enum mlx5_cmd_mode { + MLX5_CMD_MODE_POLLING, + MLX5_CMD_MODE_EVENTS +}; + struct mlx5_cmd_stats { u64 sum; u64 n; @@ -370,8 +375,9 @@ struct mlx5_cmd { struct workqueue_struct *wq; struct semaphore sem; struct semaphore pages_sem; - int mode; - struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS]; + enum mlx5_cmd_mode mode; + struct mlx5_cmd_work_ent * volatile ent_arr[MLX5_MAX_COMMANDS]; + volatile enum mlx5_cmd_mode ent_mode[MLX5_MAX_COMMANDS]; struct mlx5_cmd_debug dbg; struct cmd_msg_cache cache; int checksum_disabled; @@ -984,7 +990,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type); void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector); +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector, enum mlx5_cmd_mode mode); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, int nent, u64 mask, const char *name, struct mlx5_uar *uar); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 12 12:28:24 2018 (r341944) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 12 12:29:22 2018 (r341945) @@ -50,11 +50,6 @@ enum { }; enum { - CMD_MODE_POLLING, - CMD_MODE_EVENTS -}; - -enum { NUM_LONG_LISTS= 2, NUM_MED_LISTS = 64, LONG_LIST_SIZE= (2ULL * 1024 * 1024 * 1024 / PAGE_SIZE) * 8 + 16 + @@ -160,6 +155,8 @@ static int alloc_ent(struct mlx5_cmd_work_ent *ent) ent->busy = 1; ent->idx = ret; clear_bit(ent->idx, >bitmask); + cmd->ent_mode[ent->idx] = + ent->polling ? MLX5_CMD_MODE_POLLING : MLX5_CMD_MODE_EVENTS; cmd->ent_arr[ent->idx] = ent; } spin_unlock_irqrestore(>alloc_lock, flags); @@ -172,6 +169,8 @@ static void free_ent(struct mlx5_cmd *cmd, int idx) unsigned long flags; spin_lock_irqsave(>alloc_lock, flags); + cmd->ent_arr[idx] = NULL; /* safety clear */ + cmd->ent_mode[idx] = MLX5_CMD_MODE_POLLING; /* reset mode */ set_bit(idx, >bitmask); spin_unlock_irqrestore(>alloc_lock, flags); } @@ -786,7 +785,7 @@ static void cb_timeout_handler(struct work_struct *wor mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n", mlx5_command_str(msg_to_opcode(ent->in)), msg_to_opcode(ent->in)); -mlx5_cmd_comp_handler(dev, 1UL << ent->idx); +mlx5_cmd_comp_handler(dev, 1UL << ent->idx, MLX5_CMD_MODE_EVENTS); } static void complete_command(struct mlx5_cmd_work_ent *ent) @@ -897,11 +896,12 @@ static void cmd_work_handler(struct work_struct *work) mlx5_fwp_flush(cmd->cmd_page); iowrite32be(1 << ent->idx, >iseg->cmd_dbell); mmiowb(); - /* if not in polling don't use ent after this point*/ - if (cmd->mode == CMD_MODE_POLLING || poll_cmd) { + + /* if not in polling don't use ent after this point */ + if (poll_cmd) { poll_timeout(ent); /* make sure we read the descriptor after ownership is SW */ - mlx5_cmd_comp_handler(dev, 1U << ent->idx); + mlx5_cmd_comp_handler(dev, 1U << ent->idx, MLX5_CMD_MODE_POLLING);
svn commit: r341946 - in stable/11/sys/dev/mlx5: . mlx5_core
Author: hselasky Date: Wed Dec 12 12:29:28 2018 New Revision: 341946 URL: https://svnweb.freebsd.org/changeset/base/341946 Log: MFC r341566: mlx5: Fixes to allow command polling mode to exist alongside event mode. A command is either polling or event driven and the mode cannot change during execution of a command. Make sure the event handler only handle commands which are not polled. This is done by checking the command mode in the command handler before completing commands. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h == --- stable/11/sys/dev/mlx5/driver.h Wed Dec 12 12:29:22 2018 (r341945) +++ stable/11/sys/dev/mlx5/driver.h Wed Dec 12 12:29:28 2018 (r341946) @@ -325,6 +325,11 @@ struct mlx5_traffic_counter { u64 octets; }; +enum mlx5_cmd_mode { + MLX5_CMD_MODE_POLLING, + MLX5_CMD_MODE_EVENTS +}; + struct mlx5_cmd_stats { u64 sum; u64 n; @@ -368,8 +373,9 @@ struct mlx5_cmd { struct workqueue_struct *wq; struct semaphore sem; struct semaphore pages_sem; - int mode; - struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS]; + enum mlx5_cmd_mode mode; + struct mlx5_cmd_work_ent * volatile ent_arr[MLX5_MAX_COMMANDS]; + volatile enum mlx5_cmd_mode ent_mode[MLX5_MAX_COMMANDS]; struct mlx5_cmd_debug dbg; struct cmd_msg_cache cache; int checksum_disabled; @@ -958,7 +964,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type); void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector); +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector, enum mlx5_cmd_mode mode); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, int nent, u64 mask, const char *name, struct mlx5_uar *uar); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 12 12:29:22 2018 (r341945) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 12 12:29:28 2018 (r341946) @@ -50,11 +50,6 @@ enum { }; enum { - CMD_MODE_POLLING, - CMD_MODE_EVENTS -}; - -enum { NUM_LONG_LISTS= 2, NUM_MED_LISTS = 64, LONG_LIST_SIZE= (2ULL * 1024 * 1024 * 1024 / PAGE_SIZE) * 8 + 16 + @@ -160,6 +155,8 @@ static int alloc_ent(struct mlx5_cmd_work_ent *ent) ent->busy = 1; ent->idx = ret; clear_bit(ent->idx, >bitmask); + cmd->ent_mode[ent->idx] = + ent->polling ? MLX5_CMD_MODE_POLLING : MLX5_CMD_MODE_EVENTS; cmd->ent_arr[ent->idx] = ent; } spin_unlock_irqrestore(>alloc_lock, flags); @@ -172,6 +169,8 @@ static void free_ent(struct mlx5_cmd *cmd, int idx) unsigned long flags; spin_lock_irqsave(>alloc_lock, flags); + cmd->ent_arr[idx] = NULL; /* safety clear */ + cmd->ent_mode[idx] = MLX5_CMD_MODE_POLLING; /* reset mode */ set_bit(idx, >bitmask); spin_unlock_irqrestore(>alloc_lock, flags); } @@ -786,7 +785,7 @@ static void cb_timeout_handler(struct work_struct *wor mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n", mlx5_command_str(msg_to_opcode(ent->in)), msg_to_opcode(ent->in)); -mlx5_cmd_comp_handler(dev, 1UL << ent->idx); +mlx5_cmd_comp_handler(dev, 1UL << ent->idx, MLX5_CMD_MODE_EVENTS); } static void complete_command(struct mlx5_cmd_work_ent *ent) @@ -897,11 +896,12 @@ static void cmd_work_handler(struct work_struct *work) mlx5_fwp_flush(cmd->cmd_page); iowrite32be(1 << ent->idx, >iseg->cmd_dbell); mmiowb(); - /* if not in polling don't use ent after this point*/ - if (cmd->mode == CMD_MODE_POLLING || poll_cmd) { + + /* if not in polling don't use ent after this point */ + if (poll_cmd) { poll_timeout(ent); /* make sure we read the descriptor after ownership is SW */ - mlx5_cmd_comp_handler(dev, 1U << ent->idx); + mlx5_cmd_comp_handler(dev, 1U << ent->idx, MLX5_CMD_MODE_POLLING);
svn commit: r341943 - stable/12/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Dec 12 12:28:16 2018 New Revision: 341943 URL: https://svnweb.freebsd.org/changeset/base/341943 Log: MFC r341565: mlx5: Fix wrong size allocation for QoS ETC TC register The driver allocates wrong size (due to wrong struct name) when issuing a query/set request to NIC's register. Linux commit: d14fcb8d877caf1b8d6bd65d444bf62b21f2070c Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.cWed Dec 12 12:27:17 2018(r341942) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.cWed Dec 12 12:28:16 2018(r341943) @@ -810,7 +810,7 @@ int mlx5_query_port_cong_params(struct mlx5_core_dev * static int mlx5_query_port_qetcr_reg(struct mlx5_core_dev *mdev, u32 *out, int outlen) { - u32 in[MLX5_ST_SZ_DW(qtct_reg)]; + u32 in[MLX5_ST_SZ_DW(qetc_reg)]; if (!MLX5_CAP_GEN(mdev, ets)) return -ENOTSUPP; @@ -831,7 +831,7 @@ EXPORT_SYMBOL_GPL(mlx5_max_tc); static int mlx5_set_port_qetcr_reg(struct mlx5_core_dev *mdev, u32 *in, int inlen) { - u32 out[MLX5_ST_SZ_DW(qtct_reg)]; + u32 out[MLX5_ST_SZ_DW(qetc_reg)]; if (!MLX5_CAP_GEN(mdev, ets)) return -ENOTSUPP; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341944 - stable/11/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Dec 12 12:28:24 2018 New Revision: 341944 URL: https://svnweb.freebsd.org/changeset/base/341944 Log: MFC r341565: mlx5: Fix wrong size allocation for QoS ETC TC register The driver allocates wrong size (due to wrong struct name) when issuing a query/set request to NIC's register. Linux commit: d14fcb8d877caf1b8d6bd65d444bf62b21f2070c Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.cWed Dec 12 12:28:16 2018(r341943) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.cWed Dec 12 12:28:24 2018(r341944) @@ -810,7 +810,7 @@ int mlx5_query_port_cong_params(struct mlx5_core_dev * static int mlx5_query_port_qetcr_reg(struct mlx5_core_dev *mdev, u32 *out, int outlen) { - u32 in[MLX5_ST_SZ_DW(qtct_reg)]; + u32 in[MLX5_ST_SZ_DW(qetc_reg)]; if (!MLX5_CAP_GEN(mdev, ets)) return -ENOTSUPP; @@ -831,7 +831,7 @@ EXPORT_SYMBOL_GPL(mlx5_max_tc); static int mlx5_set_port_qetcr_reg(struct mlx5_core_dev *mdev, u32 *in, int inlen) { - u32 out[MLX5_ST_SZ_DW(qtct_reg)]; + u32 out[MLX5_ST_SZ_DW(qetc_reg)]; if (!MLX5_CAP_GEN(mdev, ets)) return -ENOTSUPP; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341941 - stable/12/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Dec 12 12:26:59 2018 New Revision: 341941 URL: https://svnweb.freebsd.org/changeset/base/341941 Log: MFC r341564: mlx5: Add software tx_jumbo_packets counter This counter will represent transmitted packets which has more than 1518 octets. The NIC has multiple hardware counters for counting transmitted packets larger than 1518 octets. Each counter counts the packets in specific range. We accumulate those counters to have a single counter. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h == --- stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 12:26:06 2018 (r341940) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 12:26:59 2018 (r341941) @@ -178,7 +178,8 @@ typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *); m(+1, u64 tx_csum_offload, "tx_csum_offload", "Transmit checksum offload packets") \ m(+1, u64 tx_queue_dropped, "tx_queue_dropped", "Transmit queue dropped") \ m(+1, u64 tx_defragged, "tx_defragged", "Transmit queue defragged") \ - m(+1, u64 rx_wqe_err, "rx_wqe_err", "Receive WQE errors") + m(+1, u64 rx_wqe_err, "rx_wqe_err", "Receive WQE errors") \ + m(+1, u64 tx_jumbo_packets, "tx_jumbo_packets", "TX packets greater than 1518 octets") #defineMLX5E_VPORT_STATS_NUM (0 MLX5E_VPORT_STATS(MLX5E_STATS_COUNT)) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:26:06 2018(r341940) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:26:59 2018(r341941) @@ -500,6 +500,12 @@ mlx5e_update_stats_work(struct work_struct *work) } } + s->tx_jumbo_packets = + priv->stats.port_stats_debug.p1519to2047octets + + priv->stats.port_stats_debug.p2048to4095octets + + priv->stats.port_stats_debug.p4096to8191octets + + priv->stats.port_stats_debug.p8192to10239octets; + /* update counters */ s->tso_packets = tso_packets; s->tso_bytes = tso_bytes; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341942 - stable/11/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Dec 12 12:27:17 2018 New Revision: 341942 URL: https://svnweb.freebsd.org/changeset/base/341942 Log: MFC r341564: mlx5: Add software tx_jumbo_packets counter This counter will represent transmitted packets which has more than 1518 octets. The NIC has multiple hardware counters for counting transmitted packets larger than 1518 octets. Each counter counts the packets in specific range. We accumulate those counters to have a single counter. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h == --- stable/11/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 12:26:59 2018 (r341941) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Wed Dec 12 12:27:17 2018 (r341942) @@ -177,7 +177,8 @@ typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *); m(+1, u64 tx_csum_offload, "tx_csum_offload", "Transmit checksum offload packets") \ m(+1, u64 tx_queue_dropped, "tx_queue_dropped", "Transmit queue dropped") \ m(+1, u64 tx_defragged, "tx_defragged", "Transmit queue defragged") \ - m(+1, u64 rx_wqe_err, "rx_wqe_err", "Receive WQE errors") + m(+1, u64 rx_wqe_err, "rx_wqe_err", "Receive WQE errors") \ + m(+1, u64 tx_jumbo_packets, "tx_jumbo_packets", "TX packets greater than 1518 octets") #defineMLX5E_VPORT_STATS_NUM (0 MLX5E_VPORT_STATS(MLX5E_STATS_COUNT)) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:26:59 2018(r341941) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:27:17 2018(r341942) @@ -500,6 +500,12 @@ mlx5e_update_stats_work(struct work_struct *work) } } + s->tx_jumbo_packets = + priv->stats.port_stats_debug.p1519to2047octets + + priv->stats.port_stats_debug.p2048to4095octets + + priv->stats.port_stats_debug.p4096to8191octets + + priv->stats.port_stats_debug.p8192to10239octets; + /* update counters */ s->tso_packets = tso_packets; s->tso_bytes = tso_bytes; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341939 - in stable/12/sys/dev/mlx5: . mlx5_core
Author: hselasky Date: Wed Dec 12 12:26:01 2018 New Revision: 341939 URL: https://svnweb.freebsd.org/changeset/base/341939 Log: MFC r341563: mlx5: Implement support for configuring PCIe packet write ordering via a sysctl. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_mr.c stable/12/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_mr.c == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_mr.c Wed Dec 12 12:25:07 2018 (r341938) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_mr.c Wed Dec 12 12:26:01 2018 (r341939) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2018, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,6 +30,11 @@ #include #include "mlx5_core.h" +static int mlx5_relaxed_ordering_write; +SYSCTL_INT(_hw_mlx5, OID_AUTO, relaxed_ordering_write, CTLFLAG_RWTUN, +_relaxed_ordering_write, 0, +"Set to enable relaxed ordering for PCIe writes"); + void mlx5_init_mr_table(struct mlx5_core_dev *dev) { struct mlx5_mr_table *table = >priv.mr_table; @@ -63,6 +68,14 @@ int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry); MLX5_SET(create_mkey_in, in, opcode, MLX5_CMD_OP_CREATE_MKEY); MLX5_SET(mkc, mkc, mkey_7_0, key); + + if (mlx5_relaxed_ordering_write != 0) { + if (MLX5_CAP_GEN(dev, relaxed_ordering_write)) + MLX5_SET(mkc, mkc, relaxed_ordering_write, 1); + else + return (-EPROTONOSUPPORT); + } + if (callback) return mlx5_cmd_exec_cb(dev, in, inlen, out, outlen, callback, context); Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h == --- stable/12/sys/dev/mlx5/mlx5_ifc.h Wed Dec 12 12:25:07 2018 (r341938) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Wed Dec 12 12:26:01 2018 (r341939) @@ -933,7 +933,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 log_max_cq[0x5]; u8 log_max_eq_sz[0x8]; - u8 reserved_6[0x2]; + u8 relaxed_ordering_write[1]; + u8 reserved_6[0x1]; u8 log_max_mkey[0x6]; u8 reserved_7[0xc]; u8 log_max_eq[0x4]; @@ -2424,9 +2425,13 @@ enum { }; struct mlx5_ifc_mkc_bits { - u8 reserved_0[0x1]; + u8 reserved_at_0[0x1]; u8 free[0x1]; - u8 reserved_1[0xd]; + u8 reserved_at_2[0x1]; + u8 access_mode_4_2[0x3]; + u8 reserved_at_6[0x7]; + u8 relaxed_ordering_write[0x1]; + u8 reserved_at_e[0x1]; u8 small_fence_on_rdma_read_response[0x1]; u8 umr_en[0x1]; u8 a[0x1]; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341940 - in stable/11/sys/dev/mlx5: . mlx5_core
Author: hselasky Date: Wed Dec 12 12:26:06 2018 New Revision: 341940 URL: https://svnweb.freebsd.org/changeset/base/341940 Log: MFC r341563: mlx5: Implement support for configuring PCIe packet write ordering via a sysctl. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_mr.c stable/11/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_mr.c == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_mr.c Wed Dec 12 12:26:01 2018 (r341939) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_mr.c Wed Dec 12 12:26:06 2018 (r341940) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2018, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,6 +30,11 @@ #include #include "mlx5_core.h" +static int mlx5_relaxed_ordering_write; +SYSCTL_INT(_hw_mlx5, OID_AUTO, relaxed_ordering_write, CTLFLAG_RWTUN, +_relaxed_ordering_write, 0, +"Set to enable relaxed ordering for PCIe writes"); + void mlx5_init_mr_table(struct mlx5_core_dev *dev) { struct mlx5_mr_table *table = >priv.mr_table; @@ -63,6 +68,14 @@ int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry); MLX5_SET(create_mkey_in, in, opcode, MLX5_CMD_OP_CREATE_MKEY); MLX5_SET(mkc, mkc, mkey_7_0, key); + + if (mlx5_relaxed_ordering_write != 0) { + if (MLX5_CAP_GEN(dev, relaxed_ordering_write)) + MLX5_SET(mkc, mkc, relaxed_ordering_write, 1); + else + return (-EPROTONOSUPPORT); + } + if (callback) return mlx5_cmd_exec_cb(dev, in, inlen, out, outlen, callback, context); Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h == --- stable/11/sys/dev/mlx5/mlx5_ifc.h Wed Dec 12 12:26:01 2018 (r341939) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Wed Dec 12 12:26:06 2018 (r341940) @@ -933,7 +933,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 log_max_cq[0x5]; u8 log_max_eq_sz[0x8]; - u8 reserved_6[0x2]; + u8 relaxed_ordering_write[1]; + u8 reserved_6[0x1]; u8 log_max_mkey[0x6]; u8 reserved_7[0xc]; u8 log_max_eq[0x4]; @@ -2424,9 +2425,13 @@ enum { }; struct mlx5_ifc_mkc_bits { - u8 reserved_0[0x1]; + u8 reserved_at_0[0x1]; u8 free[0x1]; - u8 reserved_1[0xd]; + u8 reserved_at_2[0x1]; + u8 access_mode_4_2[0x3]; + u8 reserved_at_6[0x7]; + u8 relaxed_ordering_write[0x1]; + u8 reserved_at_e[0x1]; u8 small_fence_on_rdma_read_response[0x1]; u8 umr_en[0x1]; u8 a[0x1]; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341938 - in stable/11/sys/dev/mlx5: . mlx5_core
Author: hselasky Date: Wed Dec 12 12:25:07 2018 New Revision: 341938 URL: https://svnweb.freebsd.org/changeset/base/341938 Log: MFC r341562: mlx5: Extend vector argument to u64. Else the MLX5_TRIGGERED_CMD_COMP flag will be masked away. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h == --- stable/11/sys/dev/mlx5/driver.h Wed Dec 12 12:25:00 2018 (r341937) +++ stable/11/sys/dev/mlx5/driver.h Wed Dec 12 12:25:07 2018 (r341938) @@ -958,7 +958,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type); void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector); +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, int nent, u64 mask, const char *name, struct mlx5_uar *uar); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 12 12:25:00 2018 (r341937) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 12 12:25:07 2018 (r341938) @@ -1179,10 +1179,12 @@ static void free_msg(struct mlx5_core_dev *dev, struct } } -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector) +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector_flags) { struct mlx5_cmd *cmd = >cmd; struct mlx5_cmd_work_ent *ent; + bool triggered = (vector_flags & MLX5_TRIGGERED_CMD_COMP) ? 1 : 0; + u32 vector = vector_flags; /* discard flags in the upper dword */ int i; /* make sure data gets read from RAM */ @@ -1206,7 +1208,7 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, else ent->ret = 0; ent->status = ent->lay->status_own >> 1; - if (vector & MLX5_TRIGGERED_CMD_COMP) + if (triggered) ent->status = MLX5_DRIVER_STATUS_ABORTED; else ent->status = ent->lay->status_own >> 1; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341937 - in stable/12/sys/dev/mlx5: . mlx5_core
Author: hselasky Date: Wed Dec 12 12:25:00 2018 New Revision: 341937 URL: https://svnweb.freebsd.org/changeset/base/341937 Log: MFC r341562: mlx5: Extend vector argument to u64. Else the MLX5_TRIGGERED_CMD_COMP flag will be masked away. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h == --- stable/12/sys/dev/mlx5/driver.h Wed Dec 12 12:23:56 2018 (r341936) +++ stable/12/sys/dev/mlx5/driver.h Wed Dec 12 12:25:00 2018 (r341937) @@ -984,7 +984,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type); void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector); +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, int nent, u64 mask, const char *name, struct mlx5_uar *uar); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 12 12:23:56 2018 (r341936) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 12 12:25:00 2018 (r341937) @@ -1179,10 +1179,12 @@ static void free_msg(struct mlx5_core_dev *dev, struct } } -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector) +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector_flags) { struct mlx5_cmd *cmd = >cmd; struct mlx5_cmd_work_ent *ent; + bool triggered = (vector_flags & MLX5_TRIGGERED_CMD_COMP) ? 1 : 0; + u32 vector = vector_flags; /* discard flags in the upper dword */ int i; /* make sure data gets read from RAM */ @@ -1206,7 +1208,7 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, else ent->ret = 0; ent->status = ent->lay->status_own >> 1; - if (vector & MLX5_TRIGGERED_CMD_COMP) + if (triggered) ent->status = MLX5_DRIVER_STATUS_ABORTED; else ent->status = ent->lay->status_own >> 1; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341936 - stable/11/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Dec 12 12:23:56 2018 New Revision: 341936 URL: https://svnweb.freebsd.org/changeset/base/341936 Log: MFC r341561: mlx5: Add global control to disable firmware reset, for all mlx5 devices. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 12 12:23:35 2018(r341935) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 12 12:23:56 2018(r341936) @@ -59,6 +59,11 @@ enum { MLX5_SENSOR_FW_SYND_RFR = 5, }; +static int mlx5_fw_reset_enable = 1; +SYSCTL_INT(_hw_mlx5, OID_AUTO, fw_reset_enable, CTLFLAG_RWTUN, +_fw_reset_enable, 0, +"Enable firmware reset"); + static int lock_sem_sw_reset(struct mlx5_core_dev *dev) { int ret; @@ -180,10 +185,13 @@ static u32 check_fatal_sensors(struct mlx5_core_dev *d static void reset_fw_if_needed(struct mlx5_core_dev *dev) { - bool supported = (ioread32be(>iseg->initializing) >> - MLX5_FW_RESET_SUPPORTED_OFFSET) & 1; + bool supported; u32 cmdq_addr, fatal_error; + if (!mlx5_fw_reset_enable) + return; + supported = (ioread32be(>iseg->initializing) >> + MLX5_FW_RESET_SUPPORTED_OFFSET) & 1; if (!supported) return; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341935 - stable/12/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Dec 12 12:23:35 2018 New Revision: 341935 URL: https://svnweb.freebsd.org/changeset/base/341935 Log: MFC r341561: mlx5: Add global control to disable firmware reset, for all mlx5 devices. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 12 12:22:40 2018(r341934) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 12 12:23:35 2018(r341935) @@ -59,6 +59,11 @@ enum { MLX5_SENSOR_FW_SYND_RFR = 5, }; +static int mlx5_fw_reset_enable = 1; +SYSCTL_INT(_hw_mlx5, OID_AUTO, fw_reset_enable, CTLFLAG_RWTUN, +_fw_reset_enable, 0, +"Enable firmware reset"); + static int lock_sem_sw_reset(struct mlx5_core_dev *dev) { int ret; @@ -180,10 +185,13 @@ static u32 check_fatal_sensors(struct mlx5_core_dev *d static void reset_fw_if_needed(struct mlx5_core_dev *dev) { - bool supported = (ioread32be(>iseg->initializing) >> - MLX5_FW_RESET_SUPPORTED_OFFSET) & 1; + bool supported; u32 cmdq_addr, fatal_error; + if (!mlx5_fw_reset_enable) + return; + supported = (ioread32be(>iseg->initializing) >> + MLX5_FW_RESET_SUPPORTED_OFFSET) & 1; if (!supported) return; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341934 - in stable/11/sys/dev/mlx5: . mlx5_core
Author: hselasky Date: Wed Dec 12 12:22:40 2018 New Revision: 341934 URL: https://svnweb.freebsd.org/changeset/base/341934 Log: MFC r341560: mlx5: Fix use-after-free in self-healing flow When the mlx5 health mechanism detects a problem while the driver is in the middle of init_one or remove_one, the driver needs to prevent the health mechanism from scheduling future work; if future work is scheduled, there is a problem with use-after-free: the system WQ tries to run the work item (which has been freed) at the scheduled future time. Prevent this by disabling work item scheduling in the health mechanism when the driver is in the middle of init_one() or remove_one(). Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h == --- stable/11/sys/dev/mlx5/driver.h Wed Dec 12 12:22:28 2018 (r341933) +++ stable/11/sys/dev/mlx5/driver.h Wed Dec 12 12:22:40 2018 (r341934) @@ -897,7 +897,7 @@ void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, s void mlx5_health_cleanup(struct mlx5_core_dev *dev); int mlx5_health_init(struct mlx5_core_dev *dev); void mlx5_start_health_poll(struct mlx5_core_dev *dev); -void mlx5_stop_health_poll(struct mlx5_core_dev *dev); +void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health); void mlx5_drain_health_wq(struct mlx5_core_dev *dev); void mlx5_drain_health_recovery(struct mlx5_core_dev *dev); void mlx5_trigger_health_work(struct mlx5_core_dev *dev); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 12 12:22:28 2018(r341933) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 12 12:22:40 2018(r341934) @@ -516,9 +516,17 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev) round_jiffies(jiffies + MLX5_HEALTH_POLL_INTERVAL)); } -void mlx5_stop_health_poll(struct mlx5_core_dev *dev) +void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health) { struct mlx5_core_health *health = >priv.health; + unsigned long flags; + + if (disable_health) { + spin_lock_irqsave(>wq_lock, flags); + set_bit(MLX5_DROP_NEW_HEALTH_WORK, >flags); + set_bit(MLX5_DROP_NEW_RECOVERY_WORK, >flags); + spin_unlock_irqrestore(>wq_lock, flags); + } del_timer_sync(>timer); } Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.cWed Dec 12 12:22:28 2018(r341933) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.cWed Dec 12 12:22:40 2018(r341934) @@ -1089,7 +1089,7 @@ err_cleanup_once: mlx5_cleanup_once(dev); err_stop_poll: - mlx5_stop_health_poll(dev); + mlx5_stop_health_poll(dev, boot); if (mlx5_cmd_teardown_hca(dev)) { device_printf((>pdev->dev)->bsddev, "ERR: ""tear_down_hca failed, skip cleanup\n"); goto out_err; @@ -1141,7 +1141,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, mlx5_disable_msix(dev); if (cleanup) mlx5_cleanup_once(dev); - mlx5_stop_health_poll(dev); + mlx5_stop_health_poll(dev, cleanup); err = mlx5_cmd_teardown_hca(dev); if (err) { device_printf((>pdev->dev)->bsddev, "ERR: ""tear_down_hca failed, skip cleanup\n"); @@ -1387,6 +1387,12 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev * mlx5_core_dbg(dev, "Device in internal error state, giving up\n"); return -EAGAIN; } + + /* Panic tear down fw command will stop the PCI bus communication +* with the HCA, so the health polll is no longer needed. +*/ + mlx5_drain_health_wq(dev); + mlx5_stop_health_poll(dev, false); err = mlx5_cmd_force_teardown_hca(dev); if (err) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341933 - in stable/12/sys/dev/mlx5: . mlx5_core
Author: hselasky Date: Wed Dec 12 12:22:28 2018 New Revision: 341933 URL: https://svnweb.freebsd.org/changeset/base/341933 Log: MFC r341560: mlx5: Fix use-after-free in self-healing flow When the mlx5 health mechanism detects a problem while the driver is in the middle of init_one or remove_one, the driver needs to prevent the health mechanism from scheduling future work; if future work is scheduled, there is a problem with use-after-free: the system WQ tries to run the work item (which has been freed) at the scheduled future time. Prevent this by disabling work item scheduling in the health mechanism when the driver is in the middle of init_one() or remove_one(). Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h == --- stable/12/sys/dev/mlx5/driver.h Wed Dec 12 12:19:49 2018 (r341932) +++ stable/12/sys/dev/mlx5/driver.h Wed Dec 12 12:22:28 2018 (r341933) @@ -923,7 +923,7 @@ void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, s void mlx5_health_cleanup(struct mlx5_core_dev *dev); int mlx5_health_init(struct mlx5_core_dev *dev); void mlx5_start_health_poll(struct mlx5_core_dev *dev); -void mlx5_stop_health_poll(struct mlx5_core_dev *dev); +void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health); void mlx5_drain_health_wq(struct mlx5_core_dev *dev); void mlx5_drain_health_recovery(struct mlx5_core_dev *dev); void mlx5_trigger_health_work(struct mlx5_core_dev *dev); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 12 12:19:49 2018(r341932) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 12 12:22:28 2018(r341933) @@ -516,9 +516,17 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev) round_jiffies(jiffies + MLX5_HEALTH_POLL_INTERVAL)); } -void mlx5_stop_health_poll(struct mlx5_core_dev *dev) +void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health) { struct mlx5_core_health *health = >priv.health; + unsigned long flags; + + if (disable_health) { + spin_lock_irqsave(>wq_lock, flags); + set_bit(MLX5_DROP_NEW_HEALTH_WORK, >flags); + set_bit(MLX5_DROP_NEW_RECOVERY_WORK, >flags); + spin_unlock_irqrestore(>wq_lock, flags); + } del_timer_sync(>timer); } Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.cWed Dec 12 12:19:49 2018(r341932) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.cWed Dec 12 12:22:28 2018(r341933) @@ -1107,7 +1107,7 @@ err_cleanup_once: mlx5_cleanup_once(dev); err_stop_poll: - mlx5_stop_health_poll(dev); + mlx5_stop_health_poll(dev, boot); if (mlx5_cmd_teardown_hca(dev)) { device_printf((>pdev->dev)->bsddev, "ERR: ""tear_down_hca failed, skip cleanup\n"); goto out_err; @@ -1159,7 +1159,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, mlx5_disable_msix(dev); if (cleanup) mlx5_cleanup_once(dev); - mlx5_stop_health_poll(dev); + mlx5_stop_health_poll(dev, cleanup); err = mlx5_cmd_teardown_hca(dev); if (err) { device_printf((>pdev->dev)->bsddev, "ERR: ""tear_down_hca failed, skip cleanup\n"); @@ -1405,6 +1405,12 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev * mlx5_core_dbg(dev, "Device in internal error state, giving up\n"); return -EAGAIN; } + + /* Panic tear down fw command will stop the PCI bus communication +* with the HCA, so the health polll is no longer needed. +*/ + mlx5_drain_health_wq(dev); + mlx5_stop_health_poll(dev, false); err = mlx5_cmd_force_teardown_hca(dev); if (err) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341931 - stable/11/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Dec 12 12:19:49 2018 New Revision: 341931 URL: https://svnweb.freebsd.org/changeset/base/341931 Log: MFC r341559 and r341645: mlx5: Move hw.mlx5 node definition to mlx5_core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.hWed Dec 12 12:08:49 2018(r341930) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.hWed Dec 12 12:19:49 2018(r341931) @@ -103,4 +103,6 @@ struct mlx5_crspace_regmap { extern struct pci_driver mlx5_core_driver; +SYSCTL_DECL(_hw_mlx5); + #endif /* __MLX5_CORE_H__ */ Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.cWed Dec 12 12:08:49 2018(r341930) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.cWed Dec 12 12:19:49 2018(r341931) @@ -61,6 +61,8 @@ static int prof_sel = MLX5_DEFAULT_PROF; module_param_named(prof_sel, prof_sel, int, 0444); MODULE_PARM_DESC(prof_sel, "profile selector. Valid range 0 - 2"); +SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "mlx5 HW controls"); + #define NUMA_NO_NODE -1 static LIST_HEAD(intf_list); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341932 - in stable/12/sys/dev/mlx5: mlx5_core mlx5_en
Author: hselasky Date: Wed Dec 12 12:19:49 2018 New Revision: 341932 URL: https://svnweb.freebsd.org/changeset/base/341932 Log: MFC r341559 and r341645: mlx5: Move hw.mlx5 node definition to mlx5_core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.hWed Dec 12 12:19:49 2018(r341931) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.hWed Dec 12 12:19:49 2018(r341932) @@ -103,4 +103,6 @@ struct mlx5_crspace_regmap { extern struct pci_driver mlx5_core_driver; +SYSCTL_DECL(_hw_mlx5); + #endif /* __MLX5_CORE_H__ */ Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.cWed Dec 12 12:19:49 2018(r341931) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.cWed Dec 12 12:19:49 2018(r341932) @@ -61,6 +61,8 @@ static int prof_sel = MLX5_DEFAULT_PROF; module_param_named(prof_sel, prof_sel, int, 0444); MODULE_PARM_DESC(prof_sel, "profile selector. Valid range 0 - 2"); +SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "mlx5 HW controls"); + #define NUMA_NO_NODE -1 static LIST_HEAD(intf_list); Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:19:49 2018(r341931) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:19:49 2018(r341932) @@ -159,8 +159,6 @@ static const struct { MALLOC_DEFINE(M_MLX5EN, "MLX5EN", "MLX5 Ethernet"); -static SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "MLX5 driver parameters"); - static void mlx5e_update_carrier(struct mlx5e_priv *priv) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"