Re: svn commit: r341266 - in releng/12.0: . sys/modules/iavf

2018-12-05 Thread Dima Panov

Hello!

Marius Strobl wrote on 30/11/2018 07:59:

Author: marius
Date: Thu Nov 29 21:59:09 2018
New Revision: 341266
URL: https://svnweb.freebsd.org/changeset/base/341266

Log:
   MFC: r341016, MF12: r341261
   
   - Add a belated UPDATING entry for the ixlv(4) -> iavf(4) rename in r339338.

   - Likewise, add ixlv.4.gz to OLD_FILES,
   - and link if_ixlv.ko to if_iavf.ko in order to aid a bit in the transition.
   

[cut]


Modified: releng/12.0/sys/modules/iavf/Makefile
==
--- releng/12.0/sys/modules/iavf/Makefile   Thu Nov 29 21:20:53 2018
(r341265)
+++ releng/12.0/sys/modules/iavf/Makefile   Thu Nov 29 21:59:09 2018
(r341266)
@@ -15,4 +15,6 @@ SRCS+= i40e_common.c i40e_nvm.c i40e_adminq.c
  # Enable asserts and other debugging facilities
  # CFLAGS += -DINVARIANTS -DINVARIANTS_SUPPORT -DWITNESS
  
+LINKS=	${KMODDIR}/${KMOD}.ko ${KMODDIR}/if_ixlv.ko

+
  .include 



And this broke poudriere jail upgrade due to missed kernel modules for 
build purpose


# poudriere jail -u -j fbsd12-test -t 12.0-RC3
[skip]
/usr/src/usr.sbin/newsyslog/newsyslog.c
To install the downloaded upgrades, run "/usr/sbin/freebsd-update.fixed 
install".
Installing updates...ln: ///boot/kernel/if_iavf.ko: No such file or 
directory

chflags: ///boot/kernel/if_ixlv.ko: No such file or directory
[00:20:27] Error: Fail to upgrade system
#


--
Dima Panov (flu...@freebsd.org)
(X11, KDE, Office)@FreeBSD team

Facebook: http://www.facebook.com/fluffy.khv
twitter: fluffy_khv | skype: dima.panov | telegram: @dima_panov
IRC: fluffy@EFNet, fluffykhv@FreeNode
___
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: r341620 - in head/sys/dev/cxgbe: . common

2018-12-05 Thread Navdeep Parhar
Author: np
Date: Thu Dec  6 06:18:21 2018
New Revision: 341620
URL: https://svnweb.freebsd.org/changeset/base/341620

Log:
  cxgbe(4): Fall back to a basic configuration in case of any error during
  card initialization.  This is an expanded version of r333682.
  
  Break up prep_firmware into simpler routines while here.  Load the
  firmware/config KLD only if needed.
  
  MFC after:1 month
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/common/common.h
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hThu Dec  6 05:06:14 2018
(r341619)
+++ head/sys/dev/cxgbe/adapter.hThu Dec  6 06:18:21 2018
(r341620)
@@ -174,6 +174,7 @@ enum {
DF_DUMP_MBOX= (1 << 0), /* Log all mbox cmd/rpl. */
DF_LOAD_FW_ANYTIME  = (1 << 1), /* Allow LOAD_FW after init */
DF_DISABLE_TCB_CACHE= (1 << 2), /* Disable TCB cache (T6+) */
+   DF_DISABLE_CFG_RETRY= (1 << 3), /* Disable fallback config */
 };
 
 #define IS_DOOMED(vi)  ((vi)->flags & DOOMED)

Modified: head/sys/dev/cxgbe/common/common.h
==
--- head/sys/dev/cxgbe/common/common.h  Thu Dec  6 05:06:14 2018
(r341619)
+++ head/sys/dev/cxgbe/common/common.h  Thu Dec  6 06:18:21 2018
(r341620)
@@ -605,6 +605,7 @@ int t4_flash_erase_sectors(struct adapter *adapter, in
 int t4_flash_cfg_addr(struct adapter *adapter);
 int t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int 
size);
 int t4_get_fw_version(struct adapter *adapter, u32 *vers);
+int t4_get_fw_hdr(struct adapter *adapter, struct fw_hdr *hdr);
 int t4_get_bs_version(struct adapter *adapter, u32 *vers);
 int t4_get_tp_version(struct adapter *adapter, u32 *vers);
 int t4_get_exprom_version(struct adapter *adapter, u32 *vers);
@@ -736,11 +737,9 @@ int t4_fw_hello(struct adapter *adap, unsigned int mbo
 int t4_fw_bye(struct adapter *adap, unsigned int mbox);
 int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset);
 int t4_fw_halt(struct adapter *adap, unsigned int mbox, int force);
-int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset);
+int t4_fw_restart(struct adapter *adap, unsigned int mbox);
 int t4_fw_upgrade(struct adapter *adap, unsigned int mbox,
  const u8 *fw_data, unsigned int size, int force);
-int t4_fw_forceinstall(struct adapter *adap, const u8 *fw_data,
-unsigned int size);
 int t4_fw_initialize(struct adapter *adap, unsigned int mbox);
 int t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf,
unsigned int vf, unsigned int nparams, const u32 *params,

Modified: head/sys/dev/cxgbe/common/t4_hw.c
==
--- head/sys/dev/cxgbe/common/t4_hw.c   Thu Dec  6 05:06:14 2018
(r341619)
+++ head/sys/dev/cxgbe/common/t4_hw.c   Thu Dec  6 06:18:21 2018
(r341620)
@@ -3321,6 +3321,19 @@ int t4_get_fw_version(struct adapter *adapter, u32 *ve
 }
 
 /**
+ * t4_get_fw_hdr - read the firmware header
+ * @adapter: the adapter
+ * @hdr: where to place the version
+ *
+ * Reads the FW header from flash into caller provided buffer.
+ */
+int t4_get_fw_hdr(struct adapter *adapter, struct fw_hdr *hdr)
+{
+   return t4_read_flash(adapter, FLASH_FW_START,
+   sizeof (*hdr) / sizeof (uint32_t), (uint32_t *)hdr, 1);
+}
+
+/**
  * t4_get_bs_version - read the firmware bootstrap version
  * @adapter: the adapter
  * @vers: where to place the version
@@ -6900,7 +6913,7 @@ int t4_fw_halt(struct adapter *adap, unsigned int mbox
 * If a legitimate mailbox is provided, issue a RESET command
 * with a HALT indication.
 */
-   if (mbox <= M_PCIE_FW_MASTER) {
+   if (adap->flags & FW_OK && mbox <= M_PCIE_FW_MASTER) {
struct fw_reset_cmd c;
 
memset(, 0, sizeof(c));
@@ -6939,64 +6952,24 @@ int t4_fw_halt(struct adapter *adap, unsigned int mbox
 /**
  * t4_fw_restart - restart the firmware by taking the uP out of RESET
  * @adap: the adapter
- * @reset: if we want to do a RESET to restart things
  *
  * Restart firmware previously halted by t4_fw_halt().  On successful
  * return the previous PF Master remains as the new PF Master and there
  * is no need to issue a new HELLO command, etc.
- *
- * We do this in two ways:
- *
- *  1. If we're dealing with newer firmware we'll simply want to take
- * the chip's microprocessor out of RESET.  This will cause the
- * firmware to start up from its start vector.  And then we'll loop
- * until the firmware indicates it's started again (PCIE_FW.HALT
- *   

svn commit: r341617 - head/sys/powerpc/powerpc

2018-12-05 Thread Justin Hibbits
Author: jhibbits
Date: Thu Dec  6 04:36:02 2018
New Revision: 341617
URL: https://svnweb.freebsd.org/changeset/base/341617

Log:
  powerpc: Set very low priority mode while waiting for AP unleash event
  
  The POWER9 does not recognize 'or 27,27,27' as a thread priority NOP.  On
  earlier POWER architectures, this NOP would note to the processor to give up
  resources if able, to improve performance of other threads.
  
  All processors that support the thread priority NOPs recognize the
  'or 31,31,31' NOP as very low priority, so use this to perform a similar
  function, and not burn cycles on POWER9.

Modified:
  head/sys/powerpc/powerpc/mp_machdep.c

Modified: head/sys/powerpc/powerpc/mp_machdep.c
==
--- head/sys/powerpc/powerpc/mp_machdep.c   Thu Dec  6 04:30:24 2018
(r341616)
+++ head/sys/powerpc/powerpc/mp_machdep.c   Thu Dec  6 04:36:02 2018
(r341617)
@@ -78,7 +78,7 @@ machdep_ap_bootstrap(void)
__asm __volatile("msync; isync");
 
while (ap_letgo == 0)
-   __asm __volatile("or 27,27,27");
+   __asm __volatile("or 31,31,31");
__asm __volatile("or 6,6,6");
 
/*
___
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: r341619 - vendor/wpa/2.7

2018-12-05 Thread Cy Schubert
Author: cy
Date: Thu Dec  6 05:06:14 2018
New Revision: 341619
URL: https://svnweb.freebsd.org/changeset/base/341619

Log:
  Tag wpa_supplicant/hostapd 2.7.

Added:
  vendor/wpa/2.7/
 - copied from r341618, vendor/wpa/dist/
___
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: r341618 - in vendor/wpa/dist: . hostapd hs20/client src/ap src/common src/crypto src/drivers src/eap_common src/eap_peer src/eap_server src/eapol_auth src/eapol_supp src/fst src/l2_pack...

2018-12-05 Thread Cy Schubert
Author: cy
Date: Thu Dec  6 05:04:28 2018
New Revision: 341618
URL: https://svnweb.freebsd.org/changeset/base/341618

Log:
  Import wpa_supplicant/hostapd 2.7

Added:
  vendor/wpa/dist/src/ap/dpp_hostapd.c   (contents, props changed)
  vendor/wpa/dist/src/ap/dpp_hostapd.h   (contents, props changed)
  vendor/wpa/dist/src/ap/eth_p_oui.c   (contents, props changed)
  vendor/wpa/dist/src/ap/eth_p_oui.h   (contents, props changed)
  vendor/wpa/dist/src/ap/fils_hlp.c   (contents, props changed)
  vendor/wpa/dist/src/ap/fils_hlp.h   (contents, props changed)
  vendor/wpa/dist/src/ap/gas_query_ap.c   (contents, props changed)
  vendor/wpa/dist/src/ap/gas_query_ap.h   (contents, props changed)
  vendor/wpa/dist/src/ap/ieee802_11_he.c   (contents, props changed)
  vendor/wpa/dist/src/common/dhcp.h   (contents, props changed)
  vendor/wpa/dist/src/common/dpp.c   (contents, props changed)
  vendor/wpa/dist/src/common/dpp.h   (contents, props changed)
  vendor/wpa/dist/src/common/gas_server.c   (contents, props changed)
  vendor/wpa/dist/src/common/gas_server.h   (contents, props changed)
  vendor/wpa/dist/src/crypto/crypto_linux.c   (contents, props changed)
  vendor/wpa/dist/src/crypto/crypto_nettle.c   (contents, props changed)
  vendor/wpa/dist/src/crypto/crypto_wolfssl.c   (contents, props changed)
  vendor/wpa/dist/src/crypto/fips_prf_wolfssl.c   (contents, props changed)
  vendor/wpa/dist/src/crypto/sha384-kdf.c   (contents, props changed)
  vendor/wpa/dist/src/crypto/sha384.c   (contents, props changed)
  vendor/wpa/dist/src/crypto/sha512-kdf.c   (contents, props changed)
  vendor/wpa/dist/src/crypto/sha512-prf.c   (contents, props changed)
  vendor/wpa/dist/src/crypto/sha512.h   (contents, props changed)
  vendor/wpa/dist/src/crypto/tls_wolfssl.c   (contents, props changed)
  vendor/wpa/dist/src/drivers/driver_macsec_linux.c   (contents, props changed)
  vendor/wpa/dist/src/drivers/driver_wired_common.c   (contents, props changed)
  vendor/wpa/dist/src/drivers/driver_wired_common.h   (contents, props changed)
  vendor/wpa/dist/src/utils/crc32.c   (contents, props changed)
  vendor/wpa/dist/src/utils/crc32.h   (contents, props changed)
  vendor/wpa/dist/src/utils/json.c   (contents, props changed)
  vendor/wpa/dist/src/utils/json.h   (contents, props changed)
  vendor/wpa/dist/wpa_supplicant/dpp_supplicant.c   (contents, props changed)
  vendor/wpa/dist/wpa_supplicant/dpp_supplicant.h   (contents, props changed)
  vendor/wpa/dist/wpa_supplicant/examples/dpp-qrcode.py   (contents, props 
changed)
  vendor/wpa/dist/wpa_supplicant/op_classes.c   (contents, props changed)
  vendor/wpa/dist/wpa_supplicant/rrm.c   (contents, props changed)
Deleted:
  vendor/wpa/dist/src/ap/peerkey_auth.c
  vendor/wpa/dist/src/rsn_supp/peerkey.c
  vendor/wpa/dist/src/rsn_supp/peerkey.h
Modified:
  vendor/wpa/dist/CONTRIBUTIONS
  vendor/wpa/dist/COPYING
  vendor/wpa/dist/README
  vendor/wpa/dist/hostapd/Android.mk
  vendor/wpa/dist/hostapd/ChangeLog
  vendor/wpa/dist/hostapd/Makefile
  vendor/wpa/dist/hostapd/README
  vendor/wpa/dist/hostapd/android.config
  vendor/wpa/dist/hostapd/config_file.c
  vendor/wpa/dist/hostapd/config_file.h
  vendor/wpa/dist/hostapd/ctrl_iface.c
  vendor/wpa/dist/hostapd/defconfig
  vendor/wpa/dist/hostapd/hlr_auc_gw.c
  vendor/wpa/dist/hostapd/hostapd.android.rc
  vendor/wpa/dist/hostapd/hostapd.conf
  vendor/wpa/dist/hostapd/hostapd.eap_user_sqlite
  vendor/wpa/dist/hostapd/hostapd_cli.c
  vendor/wpa/dist/hostapd/main.c
  vendor/wpa/dist/hs20/client/est.c
  vendor/wpa/dist/hs20/client/oma_dm_client.c
  vendor/wpa/dist/hs20/client/osu_client.c
  vendor/wpa/dist/hs20/client/osu_client.h
  vendor/wpa/dist/src/ap/Makefile
  vendor/wpa/dist/src/ap/acs.c
  vendor/wpa/dist/src/ap/acs.h
  vendor/wpa/dist/src/ap/ap_config.c
  vendor/wpa/dist/src/ap/ap_config.h
  vendor/wpa/dist/src/ap/ap_drv_ops.c
  vendor/wpa/dist/src/ap/ap_drv_ops.h
  vendor/wpa/dist/src/ap/ap_mlme.c
  vendor/wpa/dist/src/ap/authsrv.c
  vendor/wpa/dist/src/ap/beacon.c
  vendor/wpa/dist/src/ap/beacon.h
  vendor/wpa/dist/src/ap/bss_load.c
  vendor/wpa/dist/src/ap/ctrl_iface_ap.c
  vendor/wpa/dist/src/ap/ctrl_iface_ap.h
  vendor/wpa/dist/src/ap/dfs.c
  vendor/wpa/dist/src/ap/dfs.h
  vendor/wpa/dist/src/ap/dhcp_snoop.c
  vendor/wpa/dist/src/ap/drv_callbacks.c
  vendor/wpa/dist/src/ap/eap_user_db.c
  vendor/wpa/dist/src/ap/gas_serv.c
  vendor/wpa/dist/src/ap/gas_serv.h
  vendor/wpa/dist/src/ap/hostapd.c
  vendor/wpa/dist/src/ap/hostapd.h
  vendor/wpa/dist/src/ap/hs20.c
  vendor/wpa/dist/src/ap/hs20.h
  vendor/wpa/dist/src/ap/hw_features.c
  vendor/wpa/dist/src/ap/ieee802_11.c
  vendor/wpa/dist/src/ap/ieee802_11.h
  vendor/wpa/dist/src/ap/ieee802_11_auth.c
  vendor/wpa/dist/src/ap/ieee802_11_auth.h
  vendor/wpa/dist/src/ap/ieee802_11_ht.c
  vendor/wpa/dist/src/ap/ieee802_11_shared.c
  vendor/wpa/dist/src/ap/ieee802_11_vht.c
  vendor/wpa/dist/src/ap/ieee802_1x.c
  vendor/wpa/dist/src/ap/ieee802_1x.h
  vendor/wpa/dist/src/ap/ndisc_snoop.c
  

svn commit: r341615 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet

2018-12-05 Thread Cy Schubert
Author: cy
Date: Thu Dec  6 04:28:39 2018
New Revision: 341615
URL: https://svnweb.freebsd.org/changeset/base/341615

Log:
  MFC r341265:
  
  Remove an old comment/code and replace with a comment that
  directly references a NetBSD commit.

Modified:
  stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
  stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
Directory Properties:
  stable/11/   (props changed)
  stable/12/   (props changed)

Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==
--- stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Dec  6 
04:25:12 2018(r341614)
+++ stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Dec  6 
04:28:39 2018(r341615)
@@ -537,12 +537,7 @@ ipf_send_icmp_err(type, fin, dst)
 
code = fin->fin_icode;
 #ifdef USE_INET6
-#if 0
-   /* XXX Fix an off by one error: s/>/>=/
-was:
-if ((code < 0) || (code > sizeof(icmptoicmp6unreach)/sizeof(int)))
-Fix obtained from NetBSD ip_fil_netbsd.c r1.4: */
-#endif
+   /* See NetBSD ip_fil_netbsd.c r1.4: */
if ((code < 0) || (code >= sizeof(icmptoicmp6unreach)/sizeof(int)))
return -1;
 #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: r341615 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet

2018-12-05 Thread Cy Schubert
Author: cy
Date: Thu Dec  6 04:28:39 2018
New Revision: 341615
URL: https://svnweb.freebsd.org/changeset/base/341615

Log:
  MFC r341265:
  
  Remove an old comment/code and replace with a comment that
  directly references a NetBSD commit.

Modified:
  stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
  stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
Directory Properties:
  stable/10/   (props changed)
  stable/11/   (props changed)

Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==
--- stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Dec  6 
04:25:12 2018(r341614)
+++ stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Dec  6 
04:28:39 2018(r341615)
@@ -542,12 +542,7 @@ ipf_send_icmp_err(type, fin, dst)
 
code = fin->fin_icode;
 #ifdef USE_INET6
-#if 0
-   /* XXX Fix an off by one error: s/>/>=/
-was:
-if ((code < 0) || (code > sizeof(icmptoicmp6unreach)/sizeof(int)))
-Fix obtained from NetBSD ip_fil_netbsd.c r1.4: */
-#endif
+   /* See NetBSD ip_fil_netbsd.c r1.4: */
if ((code < 0) || (code >= sizeof(icmptoicmp6unreach)/sizeof(int)))
return -1;
 #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: r341616 - head/sys/powerpc/powerpc

2018-12-05 Thread Justin Hibbits
Author: jhibbits
Date: Thu Dec  6 04:30:24 2018
New Revision: 341616
URL: https://svnweb.freebsd.org/changeset/base/341616

Log:
  powerpc: Fix ELFv2 JMP_SLOT relocation fixup
  
  The jump slot is a function pointer, not a descriptor pointer, in ELFv2.  Just
  write the pointer itself over, not the contents of the pointer, which would be
  the first instruction of the function.

Modified:
  head/sys/powerpc/powerpc/elf64_machdep.c

Modified: head/sys/powerpc/powerpc/elf64_machdep.c
==
--- head/sys/powerpc/powerpc/elf64_machdep.cThu Dec  6 04:28:39 2018
(r341615)
+++ head/sys/powerpc/powerpc/elf64_machdep.cThu Dec  6 04:30:24 2018
(r341616)
@@ -332,7 +332,7 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas
 #if !defined(_CALL_ELF) || _CALL_ELF == 1
memcpy(where, (Elf_Addr *)addr, 3*sizeof(Elf_Addr));
 #else
-   memcpy(where, (Elf_Addr *)addr, sizeof(Elf_Addr));
+   *where = addr;
 #endif
__asm __volatile("dcbst 0,%0; sync" :: "r"(where) : "memory");
break;
___
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: r341614 - head/sys/powerpc/powermac

2018-12-05 Thread Justin Hibbits
Author: jhibbits
Date: Thu Dec  6 04:25:12 2018
New Revision: 341614
URL: https://svnweb.freebsd.org/changeset/base/341614

Log:
  powerpc/powermac: Fix macgpio(4) child interrupt resource handling
  
  The 'interrupts' property is actually 2 words, not one, on macgpio child
  nodes.  Open Firmware's getprop function might be returning the value
  copied, not the total size of the property, but FDT's returns the total
  size.  Prior to this patch, this would cause the SYS_RES_IRQ resource list
  to not be populated when running with the 'usefdt' loader variable set, to
  convert the OFW device tree to a FDT.  Since the property is always 2 words,
  read both words, and ignore the second.
  
  Tested by:Dennis Clarke (previous attempt)
  MFC after:2 weeks

Modified:
  head/sys/powerpc/powermac/macgpio.c

Modified: head/sys/powerpc/powermac/macgpio.c
==
--- head/sys/powerpc/powermac/macgpio.c Thu Dec  6 02:38:42 2018
(r341613)
+++ head/sys/powerpc/powermac/macgpio.c Thu Dec  6 04:25:12 2018
(r341614)
@@ -160,7 +160,7 @@ macgpio_attach(device_t dev)
 struct macgpio_devinfo *dinfo;
 phandle_t root, child, iparent;
 device_t cdev;
-   uint32_t irq;
+   uint32_t irq[2];
 
sc = device_get_softc(dev);
root = sc->sc_node = ofw_bus_get_node(dev);
@@ -193,13 +193,13 @@ macgpio_attach(device_t dev)
 
resource_list_init(>mdi_resources);
 
-   if (OF_getencprop(child, "interrupts", , sizeof(irq)) == 
+   if (OF_getencprop(child, "interrupts", irq, sizeof(irq)) == 
sizeof(irq)) {
OF_searchencprop(child, "interrupt-parent", ,
sizeof(iparent));
resource_list_add(>mdi_resources, SYS_RES_IRQ,
-   0, MAP_IRQ(iparent, irq), MAP_IRQ(iparent, irq),
-   1);
+   0, MAP_IRQ(iparent, irq[0]),
+   MAP_IRQ(iparent, irq[0]), 1);
}
 
/* Fix messed-up offsets */
___
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: r341613 - stable/12/sbin/mount_fusefs

2018-12-05 Thread Alan Somers
Author: asomers
Date: Thu Dec  6 02:38:42 2018
New Revision: 341613
URL: https://svnweb.freebsd.org/changeset/base/341613

Log:
  MFC r340525:
  
  mount_fusefs.8: expand HISTORY section
  
  Note that fuse was available from ports long before joining the base system.
  Also, update the upstream URL.

Modified:
  stable/12/sbin/mount_fusefs/mount_fusefs.8

Modified: stable/12/sbin/mount_fusefs/mount_fusefs.8
==
--- stable/12/sbin/mount_fusefs/mount_fusefs.8  Thu Dec  6 02:37:34 2018
(r341612)
+++ stable/12/sbin/mount_fusefs/mount_fusefs.8  Thu Dec  6 02:38:42 2018
(r341613)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 3, 2016
+.Dd November 17, 2018
 .Dt MOUNT_FUSEFS 8
 .Os
 .Sh NAME
@@ -339,12 +339,16 @@ does not call any external utility and also provides a
 .Xr umount 8
 .Sh HISTORY
 .Nm
-appeared in
-.Fx 10.0
-as the part of the
+was written as the part of the
 .Fx
-implementation of the Fuse userspace filesystem
-framework (see http://fuse.sourceforge.net).
+implementation of the Fuse userspace filesystem framework (see
+.Xr https://github.com/libfuse/libfuse )
+and first appeared in the
+.Pa sysutils/fusefs-kmod
+port, supporting
+.Fx 6.0 .
+It was added to the base system in
+.Fx 10.0 .
 .Sh CAVEATS
 This user interface is
 .Fx
___
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: r341615 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet

2018-12-05 Thread Cy Schubert
Author: cy
Date: Thu Dec  6 04:28:39 2018
New Revision: 341615
URL: https://svnweb.freebsd.org/changeset/base/341615

Log:
  MFC r341265:
  
  Remove an old comment/code and replace with a comment that
  directly references a NetBSD commit.

Modified:
  stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
  stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
Directory Properties:
  stable/10/   (props changed)
  stable/12/   (props changed)

Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==
--- stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Dec  6 
04:25:12 2018(r341614)
+++ stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Dec  6 
04:28:39 2018(r341615)
@@ -542,12 +542,7 @@ ipf_send_icmp_err(type, fin, dst)
 
code = fin->fin_icode;
 #ifdef USE_INET6
-#if 0
-   /* XXX Fix an off by one error: s/>/>=/
-was:
-if ((code < 0) || (code > sizeof(icmptoicmp6unreach)/sizeof(int)))
-Fix obtained from NetBSD ip_fil_netbsd.c r1.4: */
-#endif
+   /* See NetBSD ip_fil_netbsd.c r1.4: */
if ((code < 0) || (code >= sizeof(icmptoicmp6unreach)/sizeof(int)))
return -1;
 #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: r341612 - stable/12/lib/libc/sys

2018-12-05 Thread Alan Somers
Author: asomers
Date: Thu Dec  6 02:37:34 2018
New Revision: 341612
URL: https://svnweb.freebsd.org/changeset/base/341612

Log:
  MFC r340455:
  
  fcntl.2: document an additional error condition

Modified:
  stable/12/lib/libc/sys/fcntl.2
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/sys/fcntl.2
==
--- stable/12/lib/libc/sys/fcntl.2  Thu Dec  6 01:04:56 2018
(r341611)
+++ stable/12/lib/libc/sys/fcntl.2  Thu Dec  6 02:37:34 2018
(r341612)
@@ -28,7 +28,7 @@
 .\" @(#)fcntl.28.2 (Berkeley) 1/12/94
 .\" $FreeBSD$
 .\"
-.Dd May 2, 2018
+.Dd Nov 15, 2018
 .Dt FCNTL 2
 .Os
 .Sh NAME
@@ -562,6 +562,10 @@ or
 and the data to which
 .Fa arg
 points is not valid.
+.Pp
+The argument
+.Fa cmd
+is invalid.
 .It Bq Er EMFILE
 The argument
 .Fa cmd
___
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: r341505 - head/share/man/man5

2018-12-05 Thread Pedro Giffuni



On 12/5/18 10:24 AM, Pedro Giffuni wrote:


On 12/5/18 12:06 AM, Kubilay Kocak wrote:

On 5/12/2018 9:51 am, Pedro F. Giffuni wrote:

Starting with FreeBSD 12 we fully support writing ext4 filesystems

...


Seems minor but I think worth it for discovery/pola/obviousness, and 
a good time (early in the 13.0 cycle).


We get a lot of user questions about ext*fs support on FreeBSD and 
pointing to an ext2fs man page also feels a bit weird.


This has to be "fixed" through documentation. I will admit that I 
haven't been working properly on the documentation, other than trying 
to remember some details in the Wiki page.



Happy to get/organise a !committer contributor to take care of this 
if no-one wants to pick it up.




I will be glad to review/commit manpage changes that make things 
clearer. We should probably even try to document the format, as I 
recall we do for FAT somewhere(?).



I had a first try at making the manpage more precise here:

https://reviews.freebsd.org/D18445

I realize other places like the handbook still needs more love but we 
have to start somewhere.


Pedro.
___
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: r341611 - head/sys/ufs/ffs

2018-12-05 Thread Kirk McKusick
Author: mckusick
Date: Thu Dec  6 01:04:56 2018
New Revision: 341611
URL: https://svnweb.freebsd.org/changeset/base/341611

Log:
  If the vfs.ffs.dotrimcons sysctl option is enabled while a file
  deletion is active, specifically after a call to ffs_blkrelease_start()
  but before the call to ffs_blkrelease_finish(), ffs_blkrelease_start()
  will have handed out SINGLETON_KEY rather than starting a collection
  sequence. Thus if we get a SINGLETON_KEY passed to ffs_blkrelease_finish(),
  we just return rather than trying to finish the nonexistent sequence.
  
  Reported by:  Warner Losh (imp@)
  Sponsored by: Netflix

Modified:
  head/sys/ufs/ffs/ffs_alloc.c

Modified: head/sys/ufs/ffs/ffs_alloc.c
==
--- head/sys/ufs/ffs/ffs_alloc.cThu Dec  6 00:13:51 2018
(r341610)
+++ head/sys/ufs/ffs/ffs_alloc.cThu Dec  6 01:04:56 2018
(r341611)
@@ -2537,6 +2537,23 @@ ffs_blkrelease_finish(ump, key)
if (((ump->um_flags & UM_CANDELETE) == 0) || dotrimcons == 0)
return;
/*
+* If the vfs.ffs.dotrimcons sysctl option is enabled while
+* a file deletion is active, specifically after a call
+* to ffs_blkrelease_start() but before the call to
+* ffs_blkrelease_finish(), ffs_blkrelease_start() will
+* have handed out SINGLETON_KEY rather than starting a
+* collection sequence. Thus if we get a SINGLETON_KEY
+* passed to ffs_blkrelease_finish(), we just return rather
+* than trying to finish the nonexistent sequence.
+*/
+   if (key == SINGLETON_KEY) {
+#ifdef INVARIANTS
+   printf("%s: vfs.ffs.dotrimcons enabled on active filesystem\n",
+   ump->um_mountp->mnt_stat.f_mntonname);
+#endif
+   return;
+   }
+   /*
 * We are done with sending blocks using this key. Look up the key
 * using the DONE alloctype (in tp) to request that it be unhashed
 * as we will not be adding to it. If the key has never been used,
___
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: r341610 - vendor/NetBSD/bmake/20180919

2018-12-05 Thread Simon J. Gerraty
Author: sjg
Date: Thu Dec  6 00:13:51 2018
New Revision: 341610
URL: https://svnweb.freebsd.org/changeset/base/341610

Log:
  tag bmake-20180919

Added:
  vendor/NetBSD/bmake/20180919/
 - copied from r341609, vendor/NetBSD/bmake/dist/
___
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: r341609 - in vendor/NetBSD/bmake/dist: . mk unit-tests

2018-12-05 Thread Simon J. Gerraty
Author: sjg
Date: Thu Dec  6 00:13:35 2018
New Revision: 341609
URL: https://svnweb.freebsd.org/changeset/base/341609

Log:
  Import bmake-20180919

Added:
  vendor/NetBSD/bmake/dist/unit-tests/varquote.exp
  vendor/NetBSD/bmake/dist/unit-tests/varquote.mk   (contents, props changed)
Modified:
  vendor/NetBSD/bmake/dist/ChangeLog
  vendor/NetBSD/bmake/dist/FILES
  vendor/NetBSD/bmake/dist/Makefile.config.in
  vendor/NetBSD/bmake/dist/VERSION
  vendor/NetBSD/bmake/dist/bmake.1
  vendor/NetBSD/bmake/dist/dir.c
  vendor/NetBSD/bmake/dist/make.1
  vendor/NetBSD/bmake/dist/mk/ChangeLog
  vendor/NetBSD/bmake/dist/mk/dirdeps-options.mk
  vendor/NetBSD/bmake/dist/mk/dirdeps.mk
  vendor/NetBSD/bmake/dist/mk/gendirdeps.mk
  vendor/NetBSD/bmake/dist/mk/install-mk
  vendor/NetBSD/bmake/dist/mk/meta.autodep.mk
  vendor/NetBSD/bmake/dist/mk/meta.stage.mk
  vendor/NetBSD/bmake/dist/unit-tests/Makefile.in
  vendor/NetBSD/bmake/dist/var.c

Modified: vendor/NetBSD/bmake/dist/ChangeLog
==
--- vendor/NetBSD/bmake/dist/ChangeLog  Thu Dec  6 00:09:39 2018
(r341608)
+++ vendor/NetBSD/bmake/dist/ChangeLog  Thu Dec  6 00:13:35 2018
(r341609)
@@ -1,3 +1,14 @@
+2018-09-21  Simon J. Gerraty  
+
+   * VERSION: 20180919
+ Merge with NetBSD make, pick up
+ o var.c: add :q
+ o dir.c: cleanup caching of stats
+
+2018-09-21  Simon J Gerraty  
+
+   * Makefile.config.in: use += where it makes sense.
+
 2018-05-12  Simon J. Gerraty  
 
* VERSION: 20180512

Modified: vendor/NetBSD/bmake/dist/FILES
==
--- vendor/NetBSD/bmake/dist/FILES  Thu Dec  6 00:09:39 2018
(r341608)
+++ vendor/NetBSD/bmake/dist/FILES  Thu Dec  6 00:13:35 2018
(r341609)
@@ -163,6 +163,8 @@ unit-tests/varcmd.exp
 unit-tests/varcmd.mk
 unit-tests/varmisc.exp
 unit-tests/varmisc.mk
+unit-tests/varquote.exp
+unit-tests/varquote.mk
 unit-tests/varshell.exp
 unit-tests/varshell.mk
 util.c

Modified: vendor/NetBSD/bmake/dist/Makefile.config.in
==
--- vendor/NetBSD/bmake/dist/Makefile.config.in Thu Dec  6 00:09:39 2018
(r341608)
+++ vendor/NetBSD/bmake/dist/Makefile.config.in Thu Dec  6 00:13:35 2018
(r341609)
@@ -1,6 +1,6 @@
 # things set by configure
 
-_MAKE_VERSION=@_MAKE_VERSION@
+_MAKE_VERSION?=@_MAKE_VERSION@
 
 prefix?= @prefix@
 srcdir= @srcdir@
@@ -11,9 +11,9 @@ DEFAULT_SYS_PATH?= @default_sys_path@
 
 CPPFLAGS+= @CPPFLAGS@
 CFLAGS+= ${CPPFLAGS} @DEFS@
-LDFLAGS= @LDFLAGS@
-LIBOBJS= @LIBOBJS@
-LDADD= @LIBS@
+LDFLAGS+= @LDFLAGS@
+LIBOBJS+= @LIBOBJS@
+LDADD+= @LIBS@
 USE_META= @use_meta@
 FILEMON_H?= @filemon_h@
 BMAKE_PATH_MAX?= @bmake_path_max@

Modified: vendor/NetBSD/bmake/dist/VERSION
==
--- vendor/NetBSD/bmake/dist/VERSIONThu Dec  6 00:09:39 2018
(r341608)
+++ vendor/NetBSD/bmake/dist/VERSIONThu Dec  6 00:13:35 2018
(r341609)
@@ -1,2 +1,2 @@
 # keep this compatible with sh and make
-_MAKE_VERSION=20180512
+_MAKE_VERSION=20180919

Modified: vendor/NetBSD/bmake/dist/bmake.1
==
--- vendor/NetBSD/bmake/dist/bmake.1Thu Dec  6 00:09:39 2018
(r341608)
+++ vendor/NetBSD/bmake/dist/bmake.1Thu Dec  6 00:13:35 2018
(r341609)
@@ -1,4 +1,4 @@
-.\"$NetBSD: make.1,v 1.272 2018/04/02 04:26:17 dholland Exp $
+.\"$NetBSD: make.1,v 1.273 2018/05/27 01:14:51 christos Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"from: @(#)make.18.4 (Berkeley) 3/19/94
 .\"
-.Dd June 22, 2017
+.Dd May 26, 2018
 .Dt BMAKE 1
 .Os
 .Sh NAME
@@ -1227,8 +1227,15 @@ due uno quattro tre
 .Ed
 .It Cm \&:Q
 Quotes every shell meta-character in the variable, so that it can be passed
+safely to the shell.
+.It Cm \&:q
+Quotes every shell meta-character in the variable, and also doubles
+.Sq $
+characters so that it can be passed
 safely through recursive invocations of
 .Nm .
+This is equivalent to: 
+.Sq \&:S/\e\&$/&&/g:Q .
 .It Cm \&:R
 Replaces each word in the variable with everything but its suffix.
 .It Cm \&:range[=count]

Modified: vendor/NetBSD/bmake/dist/dir.c
==
--- vendor/NetBSD/bmake/dist/dir.c  Thu Dec  6 00:09:39 2018
(r341608)
+++ vendor/NetBSD/bmake/dist/dir.c  Thu Dec  6 00:13:35 2018
(r341609)
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $   */
+/* $NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 

svn commit: r341608 - in head: lib/libufs sbin/dump sbin/fsck_ffs sbin/fsirand sbin/growfs sbin/quotacheck stand/libsa sys/geom/journal sys/geom/label sys/ufs/ffs usr.sbin/fstyp usr.sbin/quot

2018-12-05 Thread Kirk McKusick
Author: mckusick
Date: Thu Dec  6 00:09:39 2018
New Revision: 341608
URL: https://svnweb.freebsd.org/changeset/base/341608

Log:
  Normally when an attempt is made to mount a UFS/FFS filesystem whose
  superblock has a check-hash error, an error message noting the
  superblock check-hash failure is printed and the mount fails. The
  administrator then runs fsck to repair the filesystem and when
  successful, the filesystem can once again be mounted.
  
  This approach fails if the filesystem in question is a root filesystem
  from which you are trying to boot. Here, the loader fails when trying
  to access the filesystem to get the kernel to boot. So it is necessary
  to allow the loader to ignore the superblock check-hash error and make
  a best effort to read the kernel. The filesystem may be suffiently
  corrupted that the read attempt fails, but there is no harm in trying
  since the loader makes no attempt to write to the filesystem.
  
  Once the kernel is loaded and starts to run, it attempts to mount its
  root filesystem. Once again, failure means that it breaks to its prompt
  to ask where to get its root filesystem. Unless you have an alternate
  root filesystem, you are stuck.
  
  Since the root filesystem is initially mounted read-only, it is
  safe to make an attempt to mount the root filesystem with the failed
  superblock check-hash. Thus, when asked to mount a root filesystem
  with a failed superblock check-hash, the kernel prints a warning
  message that the root filesystem superblock check-hash needs repair,
  but notes that it is ignoring the error and proceeding. It does
  mark the filesystem as needing an fsck which prevents it from being
  enabled for writing until fsck has been run on it. The net effect
  is that the reboot fails to single user, but at least at that point
  the administrator has the tools at hand to fix the problem.
  
  Reported by:Rick Macklem (rmacklem@)
  Discussed with: Warner Losh (imp@)
  Sponsored by:   Netflix

Modified:
  head/lib/libufs/libufs.h
  head/lib/libufs/sblock.c
  head/sbin/dump/main.c
  head/sbin/fsck_ffs/setup.c
  head/sbin/fsirand/fsirand.c
  head/sbin/growfs/growfs.c
  head/sbin/quotacheck/quotacheck.c
  head/stand/libsa/ufs.c
  head/sys/geom/journal/g_journal_ufs.c
  head/sys/geom/label/g_label_ufs.c
  head/sys/ufs/ffs/ffs_extern.h
  head/sys/ufs/ffs/ffs_subr.c
  head/sys/ufs/ffs/ffs_vfsops.c
  head/usr.sbin/fstyp/ufs.c
  head/usr.sbin/quot/quot.c

Modified: head/lib/libufs/libufs.h
==
--- head/lib/libufs/libufs.hWed Dec  5 21:51:39 2018(r341607)
+++ head/lib/libufs/libufs.hThu Dec  6 00:09:39 2018(r341608)
@@ -118,6 +118,12 @@ intffs_sbput(void *, struct fs *, off_t,
int (*)(void *, off_t, void *, int));
 
 /*
+ * Request standard superblock location in ffs_sbget
+ */
+#defineSTDSB   -1  /* Fail if check-hash is bad */
+#defineSTDSB_NOHASHFAIL-2  /* Ignore check-hash failure */
+
+/*
  * block.c
  */
 ssize_t bread(struct uufsd *, ufs2_daddr_t, void *, size_t);

Modified: head/lib/libufs/sblock.c
==
--- head/lib/libufs/sblock.cWed Dec  5 21:51:39 2018(r341607)
+++ head/lib/libufs/sblock.cThu Dec  6 00:09:39 2018(r341608)
@@ -54,7 +54,7 @@ sbread(struct uufsd *disk)
 
ERROR(disk, NULL);
 
-   if ((errno = sbget(disk->d_fd, , -1)) != 0) {
+   if ((errno = sbget(disk->d_fd, , STDSB)) != 0) {
switch (errno) {
case EIO:
ERROR(disk, "non-existent or truncated superblock");

Modified: head/sbin/dump/main.c
==
--- head/sbin/dump/main.c   Wed Dec  5 21:51:39 2018(r341607)
+++ head/sbin/dump/main.c   Thu Dec  6 00:09:39 2018(r341608)
@@ -433,7 +433,7 @@ main(int argc, char *argv[])
msgtail("to %s\n", tape);
 
sync();
-   if ((ret = sbget(diskfd, , -1)) != 0) {
+   if ((ret = sbget(diskfd, , STDSB)) != 0) {
switch (ret) {
case ENOENT:
warn("Cannot find file system superblock");

Modified: head/sbin/fsck_ffs/setup.c
==
--- head/sbin/fsck_ffs/setup.c  Wed Dec  5 21:51:39 2018(r341607)
+++ head/sbin/fsck_ffs/setup.c  Thu Dec  6 00:09:39 2018(r341608)
@@ -327,7 +327,7 @@ readsb(int listerr)
int bad, ret;
struct fs *fs;
 
-   super = bflag ? bflag * dev_bsize : -1;
+   super = bflag ? bflag * dev_bsize : STDSB;
readcnt[sblk.b_type]++;
if ((ret = sbget(fsreadfd, , super)) != 0) {
switch (ret) {

Modified: head/sbin/fsirand/fsirand.c

svn commit: r341607 - stable/10/usr.sbin/bhyve

2018-12-05 Thread Ed Maste
Author: emaste
Date: Wed Dec  5 21:51:39 2018
New Revision: 341607
URL: https://svnweb.freebsd.org/changeset/base/341607

Log:
  MFC r341484: Always treat firmware request and response sizes as unsigned.
  
  This fixes an incomplete bounds check on the guest-supplied request
  size where a very large request size could be interpreted as a negative
  value and not be caught by the bounds check.
  
  Submitted by: jhb
  Reported by:  Reno Robert
  Security: CVE-2018-17160

Modified:
  stable/10/usr.sbin/bhyve/fwctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/bhyve/fwctl.c
==
--- stable/10/usr.sbin/bhyve/fwctl.cWed Dec  5 21:49:39 2018
(r341606)
+++ stable/10/usr.sbin/bhyve/fwctl.cWed Dec  5 21:51:39 2018
(r341607)
@@ -77,8 +77,8 @@ static u_int ident_idx;
 
 struct op_info {
int op;
-   int  (*op_start)(int len);
-   void (*op_data)(uint32_t data, int len);
+   int  (*op_start)(uint32_t len);
+   void (*op_data)(uint32_t data, uint32_t len);
int  (*op_result)(struct iovec **data);
void (*op_done)(struct iovec *data);
 };
@@ -117,7 +117,7 @@ errop_set(int err)
 }
 
 static int
-errop_start(int len)
+errop_start(uint32_t len)
 {
errop_code = ENOENT;
 
@@ -126,7 +126,7 @@ errop_start(int len)
 }
 
 static void
-errop_data(uint32_t data, int len)
+errop_data(uint32_t data, uint32_t len)
 {
 
/* ignore */
@@ -186,7 +186,7 @@ static int fget_cnt;
 static size_t fget_size;
 
 static int
-fget_start(int len)
+fget_start(uint32_t len)
 {
 
if (len > FGET_STRSZ)
@@ -198,7 +198,7 @@ fget_start(int len)
 }
 
 static void
-fget_data(uint32_t data, int len)
+fget_data(uint32_t data, uint32_t len)
 {
 
*((uint32_t *) _str[fget_cnt]) = data;
@@ -283,8 +283,8 @@ static struct req_info {
struct op_info *req_op;
int  resp_error;
int  resp_count;
-   int  resp_size;
-   int  resp_off;
+   size_t   resp_size;
+   size_t   resp_off;
struct iovec *resp_biov;
 } rinfo;
 
@@ -344,13 +344,14 @@ fwctl_request_start(void)
 static int
 fwctl_request_data(uint32_t value)
 {
-   int remlen;
 
/* Make sure remaining size is >= 0 */
-   rinfo.req_size -= sizeof(uint32_t);
-   remlen = MAX(rinfo.req_size, 0);
+   if (rinfo.req_size <= sizeof(uint32_t))
+   rinfo.req_size = 0;
+   else
+   rinfo.req_size -= sizeof(uint32_t);
 
-   (*rinfo.req_op->op_data)(value, remlen);
+   (*rinfo.req_op->op_data)(value, rinfo.req_size);
 
if (rinfo.req_size < sizeof(uint32_t)) {
fwctl_request_done();
@@ -399,7 +400,7 @@ static int
 fwctl_response(uint32_t *retval)
 {
uint32_t *dp;
-   int remlen;
+   ssize_t remlen;
 
switch(rinfo.resp_count) {
case 0:
@@ -434,7 +435,7 @@ fwctl_response(uint32_t *retval)
}
 
if (rinfo.resp_count > 3 &&
-   rinfo.resp_size - rinfo.resp_off <= 0) {
+   rinfo.resp_off >= rinfo.resp_size) {
fwctl_response_done();
return (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: r341606 - stable/10/usr.sbin/bhyve

2018-12-05 Thread Ed Maste
Author: emaste
Date: Wed Dec  5 21:49:39 2018
New Revision: 341606
URL: https://svnweb.freebsd.org/changeset/base/341606

Log:
  MFC r298454 (araujo): Use MIN()/MAX() macros from sys/param.h.

Modified:
  stable/10/usr.sbin/bhyve/fwctl.c
  stable/10/usr.sbin/bhyve/pci_ahci.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/bhyve/fwctl.c
==
--- stable/10/usr.sbin/bhyve/fwctl.cWed Dec  5 19:53:09 2018
(r341605)
+++ stable/10/usr.sbin/bhyve/fwctl.cWed Dec  5 21:49:39 2018
(r341606)
@@ -348,7 +348,7 @@ fwctl_request_data(uint32_t value)
 
/* Make sure remaining size is >= 0 */
rinfo.req_size -= sizeof(uint32_t);
-   remlen = (rinfo.req_size > 0) ? rinfo.req_size: 0;
+   remlen = MAX(rinfo.req_size, 0);
 
(*rinfo.req_op->op_data)(value, remlen);
 

Modified: stable/10/usr.sbin/bhyve/pci_ahci.c
==
--- stable/10/usr.sbin/bhyve/pci_ahci.c Wed Dec  5 19:53:09 2018
(r341605)
+++ stable/10/usr.sbin/bhyve/pci_ahci.c Wed Dec  5 21:49:39 2018
(r341606)
@@ -798,7 +798,7 @@ read_prdt(struct ahci_port *p, int slot, uint8_t *cfis
 
dbcsz = (prdt->dbc & DBCMASK) + 1;
ptr = paddr_guest2host(ahci_ctx(p->pr_sc), prdt->dba, dbcsz);
-   sublen = len < dbcsz ? len : dbcsz;
+   sublen = MIN(len, dbcsz);
memcpy(to, ptr, sublen);
len -= sublen;
to += sublen;
@@ -912,7 +912,7 @@ write_prdt(struct ahci_port *p, int slot, uint8_t *cfi
 
dbcsz = (prdt->dbc & DBCMASK) + 1;
ptr = paddr_guest2host(ahci_ctx(p->pr_sc), prdt->dba, dbcsz);
-   sublen = len < dbcsz ? len : dbcsz;
+   sublen = MIN(len, dbcsz);
memcpy(ptr, from, sublen);
len -= sublen;
from += sublen;
___
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: r341375 - head/sys/vm

2018-12-05 Thread John Baldwin
On 12/1/18 8:50 AM, Konstantin Belousov wrote:
> Author: kib
> Date: Sat Dec  1 16:50:12 2018
> New Revision: 341375
> URL: https://svnweb.freebsd.org/changeset/base/341375
> 
> Log:
>   Allow to create swap zone larger than v_page_count / 2.
>   
>   If user configured the maxswapzone tunable, just take the literal
>   value for the initial zone sizing attempt.  Before, it was only
>   possible to reduce the zone by the tunable.

Thank you for fixing this.  A couple of times I've run into the issue where
the tunable can't raise the value which has been super annoying.

-- 
John Baldwin


___
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: r341598 - head/lib/libc/sys

2018-12-05 Thread Bruce Evans

On Thu, 6 Dec 2018, Bruce Evans wrote:


On Wed, 5 Dec 2018, Alan Somers wrote:


Log:
 stat(2): clarify which syscalls modify file timestamps
 ...


These fields shouldn't exist.  They are misimplemented compatibility cruft.
...
which I fixed in FreeBSD-5 using bit-fields.  Now the support for POSIX
before about 2007 is broken by declaring struct timespec undonditionally
and using it for st_atim, etc.  API compatibility with old versions of
FreeBSD is broken by renaming st_atimespec to st_atim, etc.


API compatibility with old versions of FreeBSD is actually preserved using
another macro hack (define st_atimespec as st_atime, etc.).  This uses a
correct visibility ifdef, but the man page says that it uses a different,
incorrect one.  The man page only attempts to document the ifdef tangles
for st_*tim*.


...


Bruce
___
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: r341598 - head/lib/libc/sys

2018-12-05 Thread Bruce Evans

On Wed, 5 Dec 2018, Alan Somers wrote:


Log:
 stat(2): clarify which syscalls modify file timestamps

 The list of syscalls that modify st_atim, st_mtim, and st_ctim was quite out
 of date and probably not accurate to begin with.  Update it, and make it
 clear that the list is open-ended.


These fields shouldn't exist.  They are misimplemented compatibility cruft.
They didn't exist in FreeBSD-4.  They were correctly implemented
compatibility cruft then.  The POSIX fields are still only time_t's with
names st_atime, etc., but these fields are timespecs with necessarily
different names.  In FreeBSD-4, they were named st_atimespec, etc. unless
POSIX_SOURCE is defined, which before about 2007 POSIX required struct
timespec to not be defined, so the fields were declared as 2 scalars
st_atime and st_atimensec, etc.  Padding of the scalars caused ABI problems
which I fixed in FreeBSD-5 using bit-fields.  Now the support for POSIX
before about 2007 is broken by declaring struct timespec undonditionally
and using it for st_atim, etc.  API compatibility with old versions of
FreeBSD is broken by renaming st_atimespec to st_atim, etc.

All versions that use timespecs use macro hacks of dubious standard
conformance to convert from timespecs to POSIX time_t's.  All names starting
with st_ are reserved if  is included.  This is what makes it
conforming for the implementation to use st_atim, etc.  It is less clear
if the macros conform because it would be non-conforming for a an application
to #undef st_atim or depend on st_atim not being a macro.


Modified: head/lib/libc/sys/stat.2
==
--- head/lib/libc/sys/stat.2Wed Dec  5 17:13:33 2018(r341597)
+++ head/lib/libc/sys/stat.2Wed Dec  5 17:28:40 2018(r341598)
...
@@ -193,45 +193,53 @@ are:
.Bl -tag -width ".Va st_birthtim"
.It Va st_atim
Time when file data was last accessed.
-Changed by the
-.Xr mknod 2 ,


Not changed by mknod, but set by it.  Still set by it.


-.Xr utimes 2 ,


Not really changed if the change is null, where a null change may be the
result of rounding to a representable value.  Permissions are still required
for making null changes.  Similarly for most operations.


+Changed implicitly by syscalls such as
.Xr read 2
and
-.Xr readv 2
-system calls.
+.Xr readv 2 ,


Not changed by reads if the file system is mounted -noatime and the file
system supports this (you can't tell if the file system supports this
by examining its MNT_NOATIME flag).  Not changed if granularity makes the
change null.


+and explicitly by
+.Xr utimes 2 .


The lists would be even longer if they mentioned utime, lutimes, futimes,
futimesat, futimens and futimnsat.


.It Va st_mtim
Time when file data was last modified.
-Changed by the
+Changed implicitly by syscalls such as
+.Xr truncate 2 ,
+.Xr write 2 ,
+and
+.Xr writev 2 ,
+and explicitly by
+.Xr utimes 2 .
+Also, any syscall which modifies directory content changes the
+.Va st_mtim
+for the affected directory.
+For instance,
+.Xr creat 2 ,


Usually spelled open with O_CREAT.


.Xr mkdir 2 ,


creat, open with O_CREAT, link, symlink, mkdir and all of the removed mk's
also set all times.


-.Xr mkfifo 2 ,
-.Xr mknod 2 ,
-.Xr utimes 2 ,
-.Xr write 2
+.Xr rename 2 ,
+.Xr link 2 ,


rename to a different directory changes 2 sets of directory times.

link is unsorted in this and another list.


...
+.Xr link 2 ,
and
-.Xr writev 2
-system calls.
+.Xr unlink 2 .
.It Va st_birthtim
Time when the inode was created.
.El


st_birthim should be named st_btime.

st_birthtim is set by all creation operations.  It is changed by changing
st_mtim to a value before the current st_birthtim.  This is done at the vfs
level, so it should work for all file systems that support birthtimes.

Changing st_birthtime forwards is not supported by any syscall.  There
are already about 10 times too many syscalls for setting times, but
none of them supports setting birthtimes or ctimes.  I use a sysctl
hack to set ctimes, as needed to back up and restore them, but don't
do anything special for birthtimes.

Bruce
___
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: r341605 - head/tests/sys/netpfil/pf

2018-12-05 Thread Kristof Provost
Author: kp
Date: Wed Dec  5 19:53:09 2018
New Revision: 341605
URL: https://svnweb.freebsd.org/changeset/base/341605

Log:
  pf tests: Add a defer mode test for pfsync
  
  Repeat the pfsync test, this time with the 'defer' option enabled. This
  exercises slightly different code paths.

Modified:
  head/tests/sys/netpfil/pf/pfsync.sh

Modified: head/tests/sys/netpfil/pf/pfsync.sh
==
--- head/tests/sys/netpfil/pf/pfsync.sh Wed Dec  5 19:18:16 2018
(r341604)
+++ head/tests/sys/netpfil/pf/pfsync.sh Wed Dec  5 19:53:09 2018
(r341605)
@@ -7,12 +7,16 @@ basic_head()
 {
atf_set descr 'Basic pfsync test'
atf_set require.user root
-
-   atf_set require.progs scapy
 }
 
 basic_body()
 {
+   common_body
+}
+
+common_body()
+{
+   defer=$1
pfsynct_init
 
epair_sync=$(pft_mkepair)
@@ -28,12 +32,14 @@ basic_body()
jexec one ifconfig pfsync0 \
syncdev ${epair_sync}a \
maxupd 1 \
+   $defer \
up
jexec two ifconfig ${epair_two}a 198.51.100.2/24 up
jexec two ifconfig ${epair_sync}b 192.0.2.2/24 up
jexec two ifconfig pfsync0 \
syncdev ${epair_sync}b \
maxupd 1 \
+   $defer \
up
 
# Enable pf!
@@ -64,7 +70,25 @@ basic_cleanup()
pfsynct_cleanup
 }
 
+atf_test_case "defer" "cleanup"
+defer_head()
+{
+   atf_set descr 'Defer mode pfsync test'
+   atf_set require.user root
+}
+
+defer_body()
+{
+   common_body defer
+}
+
+defer_cleanup()
+{
+   pfsynct_cleanup
+}
+
 atf_init_test_cases()
 {
atf_add_test_case "basic"
+   atf_add_test_case "defer"
 }
___
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: r341604 - head/sys/kern

2018-12-05 Thread Brooks Davis
Author: brooks
Date: Wed Dec  5 19:18:16 2018
New Revision: 341604
URL: https://svnweb.freebsd.org/changeset/base/341604

Log:
  Further simplify arguments to init.
  
  With the removal of BOOTCDROM and fastboot support, this code always
  passed "-s" or "--". The latter simply terminates getopt(3) processing
  in init so we only need to pass "-s" in the single user case, or nothing
  in other cases.
  
  The passing of "--" seems to have been done to ensure that the number of
  arguments passed to init was always the same and thus that argc was the
  same.
  
  Also GC the write-only variable pathlen (not in reviewed version).
  
  Reviewed by:  kib, jhb
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D18441

Modified:
  head/sys/kern/init_main.c

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Wed Dec  5 19:16:12 2018(r341603)
+++ head/sys/kern/init_main.c   Wed Dec  5 19:18:16 2018(r341604)
@@ -718,9 +718,7 @@ static void
 start_init(void *dummy)
 {
struct image_args args;
-   int options, error;
-   size_t pathlen;
-   char flags[8], *flagp;
+   int error;
char *var, *path;
char *free_init_path, *tmp_init_path;
struct thread *td;
@@ -744,7 +742,6 @@ start_init(void *dummy)
free_init_path = tmp_init_path = strdup(init_path, M_TEMP);

while ((path = strsep(_init_path, ":")) != NULL) {
-   pathlen = strlen(path) + 1;
if (bootverbose)
printf("start_init: trying %s\n", path);

@@ -757,23 +754,11 @@ start_init(void *dummy)
error = exec_args_add_fname(, path, UIO_SYSSPACE);
if (error != 0)
panic("%s: Can't add fname %d", __func__, error);
-
error = exec_args_add_arg(, path, UIO_SYSSPACE);
if (error != 0)
panic("%s: Can't add argv[0] %d", __func__, error);
-
-   options = 0;
-   flagp = [0];
-   *flagp++ = '-';
-   if (boothowto & RB_SINGLE) {
-   *flagp++ = 's';
-   options++;
-   }
-   if (options == 0)
-   *flagp++ = '-';
-   *flagp++ = 0;
-   KASSERT(flagp <= [0] + sizeof(flags), ("Overran flags"));
-   error = exec_args_add_arg(, flags, UIO_SYSSPACE);
+   if (boothowto & RB_SINGLE)
+   error = exec_args_add_arg(, "-s", UIO_SYSSPACE);
if (error != 0)
panic("%s: Can't add argv[0] %d", __func__, error);
 
___
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: r341603 - in releng/12.0: sbin/savecore sys/amd64/amd64 sys/amd64/ia32 sys/arm/arm sys/fs/procfs sys/i386/i386 sys/kern sys/sparc64/sparc64

2018-12-05 Thread Glen Barber
Author: gjb
Date: Wed Dec  5 19:16:12 2018
New Revision: 341603
URL: https://svnweb.freebsd.org/changeset/base/341603

Log:
  MFS12 r341490, r341493:
  
   r341490 (markj):
MFC r341442, r341443:
Plug memory disclosures via ptrace(2).
  
   r341493 (garga):
MFC r341464:
Restore /var/crash permissions to 0750, as declared in mtree file.
After r337337 it changed to 0755.
  
  As this would have otherwise been resolved as a post-release EN/SA
  from so@, this does not warrant adding RC4 to the 12.0 schedule.
  
  Approved by:  re (implicit), so
  Sponsored by: The FreeBSD Foundation

Modified:
  releng/12.0/sbin/savecore/Makefile
  releng/12.0/sys/amd64/amd64/machdep.c
  releng/12.0/sys/amd64/ia32/ia32_reg.c
  releng/12.0/sys/arm/arm/machdep_kdb.c
  releng/12.0/sys/fs/procfs/procfs_dbregs.c
  releng/12.0/sys/fs/procfs/procfs_fpregs.c
  releng/12.0/sys/fs/procfs/procfs_regs.c
  releng/12.0/sys/i386/i386/machdep.c
  releng/12.0/sys/kern/sys_process.c
  releng/12.0/sys/sparc64/sparc64/machdep.c
Directory Properties:
  releng/12.0/   (props changed)

Modified: releng/12.0/sbin/savecore/Makefile
==
--- releng/12.0/sbin/savecore/Makefile  Wed Dec  5 18:26:40 2018
(r341602)
+++ releng/12.0/sbin/savecore/Makefile  Wed Dec  5 19:16:12 2018
(r341603)
@@ -2,7 +2,9 @@
 
 PACKAGE=runtime
 CONFS= minfree
-CONFSDIR=  /var/crash
+VAR_CRASH= /var/crash
+VAR_CRASH_MODE=0750
+CONFSDIR=  VAR_CRASH
 PROG=  savecore
 LIBADD=z xo
 MAN=   savecore.8

Modified: releng/12.0/sys/amd64/amd64/machdep.c
==
--- releng/12.0/sys/amd64/amd64/machdep.c   Wed Dec  5 18:26:40 2018
(r341602)
+++ releng/12.0/sys/amd64/amd64/machdep.c   Wed Dec  5 19:16:12 2018
(r341603)
@@ -2043,6 +2043,7 @@ fill_regs(struct thread *td, struct reg *regs)
 int
 fill_frame_regs(struct trapframe *tp, struct reg *regs)
 {
+
regs->r_r15 = tp->tf_r15;
regs->r_r14 = tp->tf_r14;
regs->r_r13 = tp->tf_r13;
@@ -2074,6 +2075,8 @@ fill_frame_regs(struct trapframe *tp, struct reg *regs
regs->r_fs = 0;
regs->r_gs = 0;
}
+   regs->r_err = 0;
+   regs->r_trapno = 0;
return (0);
 }
 

Modified: releng/12.0/sys/amd64/ia32/ia32_reg.c
==
--- releng/12.0/sys/amd64/ia32/ia32_reg.c   Wed Dec  5 18:26:40 2018
(r341602)
+++ releng/12.0/sys/amd64/ia32/ia32_reg.c   Wed Dec  5 19:16:12 2018
(r341603)
@@ -105,6 +105,8 @@ fill_regs32(struct thread *td, struct reg32 *regs)
regs->r_eflags = tp->tf_rflags;
regs->r_esp = tp->tf_rsp;
regs->r_ss = tp->tf_ss;
+   regs->r_err = 0;
+   regs->r_trapno = 0;
return (0);
 }
 

Modified: releng/12.0/sys/arm/arm/machdep_kdb.c
==
--- releng/12.0/sys/arm/arm/machdep_kdb.c   Wed Dec  5 18:26:40 2018
(r341602)
+++ releng/12.0/sys/arm/arm/machdep_kdb.c   Wed Dec  5 19:16:12 2018
(r341603)
@@ -104,6 +104,7 @@ fill_regs(struct thread *td, struct reg *regs)
regs->r_cpsr = tf->tf_spsr;
return (0);
 }
+
 int
 fill_fpregs(struct thread *td, struct fpreg *regs)
 {
@@ -134,8 +135,11 @@ set_fpregs(struct thread *td, struct fpreg *regs)
 int
 fill_dbregs(struct thread *td, struct dbreg *regs)
 {
+
+   bzero(regs, sizeof(*regs));
return (0);
 }
+
 int
 set_dbregs(struct thread *td, struct dbreg *regs)
 {

Modified: releng/12.0/sys/fs/procfs/procfs_dbregs.c
==
--- releng/12.0/sys/fs/procfs/procfs_dbregs.c   Wed Dec  5 18:26:40 2018
(r341602)
+++ releng/12.0/sys/fs/procfs/procfs_dbregs.c   Wed Dec  5 19:16:12 2018
(r341603)
@@ -112,8 +112,10 @@ procfs_doprocdbregs(PFS_FILL_ARGS)
return (EINVAL);
}
wrap32 = 1;
-   }
+   memset(, 0, sizeof(r32));
+   } else
 #endif
+   memset(, 0, sizeof(r));
error = PROC(read, dbregs, td2, );
if (error == 0) {
PROC_UNLOCK(p);

Modified: releng/12.0/sys/fs/procfs/procfs_fpregs.c
==
--- releng/12.0/sys/fs/procfs/procfs_fpregs.c   Wed Dec  5 18:26:40 2018
(r341602)
+++ releng/12.0/sys/fs/procfs/procfs_fpregs.c   Wed Dec  5 19:16:12 2018
(r341603)
@@ -102,7 +102,6 @@ procfs_doprocfpregs(PFS_FILL_ARGS)
return (EBUSY);
}
 
-   /* XXXKSE: */
td2 = FIRST_THREAD_IN_PROC(p);
 #ifdef COMPAT_FREEBSD32
if (SV_CURPROC_FLAG(SV_ILP32)) {
@@ -111,8 +110,10 @@ procfs_doprocfpregs(PFS_FILL_ARGS)
return (EINVAL);
  

Re: svn commit: r341505 - head/share/man/man5

2018-12-05 Thread Conrad Meyer
On Wed, Dec 5, 2018 at 10:47 AM Pedro Giffuni  wrote:
> On 05/12/2018 12:41, Conrad Meyer wrote:
> > The Linux model is that the current incarnation of the ext2/3/4 driver
> > is named "ext4," and that's what Linux users expect.  You can mount
> > any ext2/3/4 filesystem with the Linux ext4 driver.  For ext4, it was
> > a result of wanting to keep ext3 stable while developing ext4 in-tree.
> > (For a while, it was called "ext4dev").  ext4 is long-since stabilized
> > and ext3 became fully redundant with ext4, so I guess they dropped it.
>
>  From a linux user/marketing perspective you are right.
>
> Are we sure there will never be an ext5fs? I would hate to start moving
> a filesystem in the tree every time a new release comes out.

While I think we can be reasonably confident ext4 is the last one,
it's somewhat irrelevant.  Linux isn't spawning new extN's at anything
like the frequency we do releases; ext3 was current from about 2001 to
2008, and ext4 from 2008 to present.  On top of that, there's no
particular reason the source code location in the tree has to be tied
to the name of the driver, or that mount(8) couldn't do the right
thing given any "-t ext[234]" or "-t ext[234]fs".

Best,
Conrad
___
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: r341505 - head/share/man/man5

2018-12-05 Thread Pedro Giffuni


On 05/12/2018 12:41, Conrad Meyer wrote:

On Wed, Dec 5, 2018 at 7:24 AM Pedro Giffuni  wrote:

On 12/5/18 12:06 AM, Kubilay Kocak wrote:

Can we remove '2' from the module/man/etc name if (since) it supports
multiple extXfs versions? Is there anything serious preventing it?

You can currently create plain ext2 filesystems on FreeBSD and add
ext3/4 features on top and it will work just fine. The distinction on
linux about ext2/3/4 is rather accidental: they didn't master Version
Control in time to branch instead of forking the implementation a couple
of times. It also seems like ext3 disappeared.

The Linux model is that the current incarnation of the ext2/3/4 driver
is named "ext4," and that's what Linux users expect.  You can mount
any ext2/3/4 filesystem with the Linux ext4 driver.  For ext4, it was
a result of wanting to keep ext3 stable while developing ext4 in-tree.
(For a while, it was called "ext4dev").  ext4 is long-since stabilized
and ext3 became fully redundant with ext4, so I guess they dropped it.


From a linux user/marketing perspective you are right.

Are we sure there will never be an ext5fs? I would hate to start moving 
a filesystem in the tree every time a new release comes out.



I think we should just follow that convention and rename ext2fs to
ext4fs.   We can mention support for the less-used ancient ext2/3 in a
COMPATIBILITY section or something, if we don't already, but ext4 has
been the go-to basic Linux filesystem for a decade.  (Seriously:  "On
11 October 2008, the patches that mark ext4 as stable code were merged
in the Linux 2.6.28.")  If we support ext4, call it ext4.


We do support enough of ext4 that we could call it ext4 ...

OTOH, the implementation is pretty much UFS1 plus ext2/3/4 extensions.

I like it as it is because people looking at the code will find out 
exactly where it all comes from: we are currently doing no effort keep 
up to date with what ext4 does and we are focusing on compatibility.  
For now I think adding a link in the documentation as others have 
suggested is enough.



My 2¢,
Conrad


Thanks! All feedback is appreciated.

Pedro.

___
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: r341602 - head/sys/kern

2018-12-05 Thread Alan Cox
Author: alc
Date: Wed Dec  5 18:26:40 2018
New Revision: 341602
URL: https://svnweb.freebsd.org/changeset/base/341602

Log:
  Terminate a blist_alloc search when a blst_meta_alloc call fails with
  cursor == 0.
  
  Every call to blst_meta_alloc but the one at the root is made only when the
  meta-node is known to include a free block, so that either the allocation
  will succeed, the node hint will be updated, or the last block of the meta-
  node range is, and remains, free.  But the call at the root is made without
  checking that there is a free block, so in the case that every block is
  allocated, there is no hint update to prevent the current code from looping
  forever.
  
  Submitted by: Doug Moore 
  Reported by:  pho
  Reviewed by:  pho
  Tested by:pho
  X-MFC with:   r340402
  Differential Revision:https://reviews.freebsd.org/D17999

Modified:
  head/sys/kern/subr_blist.c

Modified: head/sys/kern/subr_blist.c
==
--- head/sys/kern/subr_blist.c  Wed Dec  5 18:19:29 2018(r341601)
+++ head/sys/kern/subr_blist.c  Wed Dec  5 18:26:40 2018(r341602)
@@ -295,9 +295,9 @@ blist_alloc(blist_t bl, daddr_t count)
 * This loop iterates at most twice.  An allocation failure in the
 * first iteration leads to a second iteration only if the cursor was
 * non-zero.  When the cursor is zero, an allocation failure will
-* reduce the hint, stopping further iterations.
+* stop further iterations.
 */
-   while (count <= bl->bl_root->bm_bighint) {
+   for (;;) {
blk = blst_meta_alloc(bl->bl_root, bl->bl_cursor, count,
bl->bl_radix);
if (blk != SWAPBLK_NONE) {
@@ -306,10 +306,10 @@ blist_alloc(blist_t bl, daddr_t count)
if (bl->bl_cursor == bl->bl_blocks)
bl->bl_cursor = 0;
return (blk);
-   }
+   } else if (bl->bl_cursor == 0)
+   return (SWAPBLK_NONE);
bl->bl_cursor = 0;
}
-   return (SWAPBLK_NONE);
 }
 
 /*
___
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: r341601 - head/share/man/man4

2018-12-05 Thread Mark Johnston
Author: markj
Date: Wed Dec  5 18:19:29 2018
New Revision: 341601
URL: https://svnweb.freebsd.org/changeset/base/341601

Log:
  ixl(4) has netdump support via iflib.
  
  Reported by:  kbowling
  MFC after:3 days

Modified:
  head/share/man/man4/netdump.4

Modified: head/share/man/man4/netdump.4
==
--- head/share/man/man4/netdump.4   Wed Dec  5 17:35:15 2018
(r341600)
+++ head/share/man/man4/netdump.4   Wed Dec  5 18:19:29 2018
(r341601)
@@ -105,6 +105,7 @@ The following network drivers support netdump:
 .Xr em 4 ,
 .Xr igb 4 ,
 .Xr ix 4 ,
+.Xr ixl 4 ,
 .Xr mlx4en 4 ,
 .Xr re 4 ,
 .Xr vtnet 4 .
___
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: r341505 - head/share/man/man5

2018-12-05 Thread Conrad Meyer
On Wed, Dec 5, 2018 at 7:24 AM Pedro Giffuni  wrote:
> On 12/5/18 12:06 AM, Kubilay Kocak wrote:
> > Can we remove '2' from the module/man/etc name if (since) it supports
> > multiple extXfs versions? Is there anything serious preventing it?
>
> You can currently create plain ext2 filesystems on FreeBSD and add
> ext3/4 features on top and it will work just fine. The distinction on
> linux about ext2/3/4 is rather accidental: they didn't master Version
> Control in time to branch instead of forking the implementation a couple
> of times. It also seems like ext3 disappeared.

The Linux model is that the current incarnation of the ext2/3/4 driver
is named "ext4," and that's what Linux users expect.  You can mount
any ext2/3/4 filesystem with the Linux ext4 driver.  For ext4, it was
a result of wanting to keep ext3 stable while developing ext4 in-tree.
(For a while, it was called "ext4dev").  ext4 is long-since stabilized
and ext3 became fully redundant with ext4, so I guess they dropped it.

I think we should just follow that convention and rename ext2fs to
ext4fs.   We can mention support for the less-used ancient ext2/3 in a
COMPATIBILITY section or something, if we don't already, but ext4 has
been the go-to basic Linux filesystem for a decade.  (Seriously:  "On
11 October 2008, the patches that mark ext4 as stable code were merged
in the Linux 2.6.28.")  If we support ext4, call it ext4.

My 2¢,
Conrad
___
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: r341600 - head/sys/kern

2018-12-05 Thread Brooks Davis
Author: brooks
Date: Wed Dec  5 17:35:15 2018
New Revision: 341600
URL: https://svnweb.freebsd.org/changeset/base/341600

Log:
  Remove never enabled support for "fastboot".
  
  This has been ifdef notyet since the import of BSD 4.4 Lite Kernel
  Sources in r1541.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/kern/init_main.c

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Wed Dec  5 17:29:14 2018(r341599)
+++ head/sys/kern/init_main.c   Wed Dec  5 17:35:15 2018(r341600)
@@ -769,12 +769,6 @@ start_init(void *dummy)
*flagp++ = 's';
options++;
}
-#ifdef notyet
-if (boothowto & RB_FASTBOOT) {
-   *flagp++ = 'f';
-   options++;
-   }
-#endif
if (options == 0)
*flagp++ = '-';
*flagp++ = 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: r341599 - head/sys/kern

2018-12-05 Thread Brooks Davis
Author: brooks
Date: Wed Dec  5 17:29:14 2018
New Revision: 341599
URL: https://svnweb.freebsd.org/changeset/base/341599

Log:
  Remove ifdef BOOTCDROM option to start init.
  
  When BOOTCDROM is defined (via CFLAGS as there is no config option)
  it causes -C to be passed to init, but our init and the version of
  sysinstall I glanced at in 6.x don't support -C. The last plausibly
  related support was removed from the tree in 1995.
  
  Reviewed by:  kib
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D18431

Modified:
  head/sys/kern/init_main.c

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Wed Dec  5 17:28:40 2018(r341598)
+++ head/sys/kern/init_main.c   Wed Dec  5 17:29:14 2018(r341599)
@@ -775,10 +775,6 @@ start_init(void *dummy)
options++;
}
 #endif
-#ifdef BOOTCDROM
-   *flagp++ = 'C';
-   options++;
-#endif
if (options == 0)
*flagp++ = '-';
*flagp++ = 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: r341598 - head/lib/libc/sys

2018-12-05 Thread Alan Somers
Author: asomers
Date: Wed Dec  5 17:28:40 2018
New Revision: 341598
URL: https://svnweb.freebsd.org/changeset/base/341598

Log:
  stat(2): clarify which syscalls modify file timestamps
  
  The list of syscalls that modify st_atim, st_mtim, and st_ctim was quite out
  of date and probably not accurate to begin with.  Update it, and make it
  clear that the list is open-ended.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D18410

Modified:
  head/lib/libc/sys/stat.2

Modified: head/lib/libc/sys/stat.2
==
--- head/lib/libc/sys/stat.2Wed Dec  5 17:13:33 2018(r341597)
+++ head/lib/libc/sys/stat.2Wed Dec  5 17:28:40 2018(r341598)
@@ -28,7 +28,7 @@
 .\" @(#)stat.2 8.4 (Berkeley) 5/1/95
 .\" $FreeBSD$
 .\"
-.Dd November 11, 2018
+.Dd December 5, 2018
 .Dt STAT 2
 .Os
 .Sh NAME
@@ -193,45 +193,53 @@ are:
 .Bl -tag -width ".Va st_birthtim"
 .It Va st_atim
 Time when file data was last accessed.
-Changed by the
-.Xr mknod 2 ,
-.Xr utimes 2 ,
+Changed implicitly by syscalls such as
 .Xr read 2
 and
-.Xr readv 2
-system calls.
+.Xr readv 2 ,
+and explicitly by
+.Xr utimes 2 .
 .It Va st_mtim
 Time when file data was last modified.
-Changed by the
+Changed implicitly by syscalls such as
+.Xr truncate 2 ,
+.Xr write 2 ,
+and
+.Xr writev 2 ,
+and explicitly by
+.Xr utimes 2 .
+Also, any syscall which modifies directory content changes the
+.Va st_mtim
+for the affected directory.
+For instance,
+.Xr creat 2 ,
 .Xr mkdir 2 ,
-.Xr mkfifo 2 ,
-.Xr mknod 2 ,
-.Xr utimes 2 ,
-.Xr write 2
+.Xr rename 2 ,
+.Xr link 2 ,
 and
-.Xr writev 2
-system calls.
+.Xr unlink 2 .
 .It Va st_ctim
 Time when file status was last changed (inode data modification).
-Changed by the
+Changed implicitly by any syscall that affects file metadata, including
+.Va st_mtim ,
+such as
 .Xr chflags 2 ,
 .Xr chmod 2 ,
 .Xr chown 2 ,
+.Xr truncate 2 ,
+.Xr utimes 2 ,
+and
+.Xr write 2 .
+Also, any syscall which modifies directory content changes the
+.Va st_ctim
+for the affected directory.
+For instance,
 .Xr creat 2 ,
-.Xr link 2 ,
 .Xr mkdir 2 ,
-.Xr mkfifo 2 ,
-.Xr mknod 2 ,
 .Xr rename 2 ,
-.Xr rmdir 2 ,
-.Xr symlink 2 ,
-.Xr truncate 2 ,
-.Xr unlink 2 ,
-.Xr utimes 2 ,
-.Xr write 2
+.Xr link 2 ,
 and
-.Xr writev 2
-system calls.
+.Xr unlink 2 .
 .It Va st_birthtim
 Time when the inode was created.
 .El
___
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: r341597 - stable/12

2018-12-05 Thread Yuri Pankov
Author: yuripv
Date: Wed Dec  5 17:13:33 2018
New Revision: 341597
URL: https://svnweb.freebsd.org/changeset/base/341597

Log:
  Actually mark r341596 as MFC.

Modified:
Directory Properties:
  stable/12/   (props changed)
___
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: r341596 - stable/12/usr.bin/localedef

2018-12-05 Thread Yuri Pankov
Author: yuripv
Date: Wed Dec  5 17:10:06 2018
New Revision: 341596
URL: https://svnweb.freebsd.org/changeset/base/341596

Log:
  MFC r339827:
  localedef: define characters in "space" class also as "print", except
  for the known conflicts ("control" characters can't be "print"able).
  POSIX doesn't explicitly forbid this, and actually includes 
  character in "print".
  
  PR:   225692
  Reviewed by:  bapt, cem (previous version), pfg (previous version)
  Differential Revision:https://reviews.freebsd.org/D17467

Modified:
  stable/12/usr.bin/localedef/ctype.c

Modified: stable/12/usr.bin/localedef/ctype.c
==
--- stable/12/usr.bin/localedef/ctype.c Wed Dec  5 17:06:00 2018
(r341595)
+++ stable/12/usr.bin/localedef/ctype.c Wed Dec  5 17:10:06 2018
(r341596)
@@ -120,7 +120,13 @@ add_ctype_impl(ctype_node_t *ctn)
ctn->ctype |= (_ISDIGIT | _ISGRAPH | _ISPRINT | _ISXDIGIT | 
_E4);
break;
case T_ISSPACE:
-   ctn->ctype |= _ISSPACE;
+   /*
+* This can be troublesome as , ,
+* , , and  are defined both
+* as space and cntrl, and POSIX doesn't allow cntrl/print
+* combination.  We will take care of this in dump_ctype().
+*/
+   ctn->ctype |= (_ISSPACE | _ISPRINT);
break;
case T_ISCNTRL:
ctn->ctype |= _ISCNTRL;
@@ -378,9 +384,15 @@ dump_ctype(void)
ctn->ctype |= _ISPRINT;
 
/*
-* Finally, POSIX requires that certain combinations
-* are invalid.  We don't flag this as a fatal error,
-* but we will warn about.
+* POSIX requires that certain combinations are invalid.
+* Try fixing the cases we know about (see add_ctype_impl()).
+*/
+   if ((ctn->ctype & (_ISSPACE|_ISCNTRL)) == (_ISSPACE|_ISCNTRL))
+   ctn->ctype &= ~_ISPRINT;
+
+   /*
+* Finally, don't flag remaining cases as a fatal error,
+* and just warn about them.
 */
if ((ctn->ctype & _ISALPHA) &&
(ctn->ctype & (_ISPUNCT|_ISDIGIT)))
___
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: r341595 - in head/sys: netinet netinet6

2018-12-05 Thread Mark Johnston
Author: markj
Date: Wed Dec  5 17:06:00 2018
New Revision: 341595
URL: https://svnweb.freebsd.org/changeset/base/341595

Log:
  Clamp the INPCB port hash tables to IPPORT_MAX + 1 chains.
  
  Memory beyond that limit was previously unused, wasting roughly 1MB per
  8GB of RAM.  Also retire INP_PCBLBGROUP_PORTHASH, which was identical to
  INP_PCBPORTHASH.
  
  Reviewed by:  glebius
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D17803

Modified:
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet6/in6_pcb.c

Modified: head/sys/netinet/in_pcb.c
==
--- head/sys/netinet/in_pcb.c   Wed Dec  5 16:55:45 2018(r341594)
+++ head/sys/netinet/in_pcb.c   Wed Dec  5 17:06:00 2018(r341595)
@@ -339,8 +339,7 @@ in_pcbinslbgrouphash(struct inpcb *inp)
}
 #endif
 
-   idx = INP_PCBLBGROUP_PORTHASH(inp->inp_lport,
-   pcbinfo->ipi_lbgrouphashmask);
+   idx = INP_PCBPORTHASH(inp->inp_lport, pcbinfo->ipi_lbgrouphashmask);
hdr = >ipi_lbgrouphashbase[idx];
CK_LIST_FOREACH(grp, hdr, il_list) {
if (grp->il_vflag == inp->inp_vflag &&
@@ -397,9 +396,7 @@ in_pcbremlbgrouphash(struct inpcb *inp)
INP_HASH_WLOCK_ASSERT(pcbinfo);
 
hdr = >ipi_lbgrouphashbase[
-   INP_PCBLBGROUP_PORTHASH(inp->inp_lport,
-   pcbinfo->ipi_lbgrouphashmask)];
-
+   INP_PCBPORTHASH(inp->inp_lport, pcbinfo->ipi_lbgrouphashmask)];
CK_LIST_FOREACH(grp, hdr, il_list) {
for (i = 0; i < grp->il_inpcnt; ++i) {
if (grp->il_inp[i] != inp)
@@ -439,6 +436,8 @@ in_pcbinfo_init(struct inpcbinfo *pcbinfo, const char 
 char *inpcbzone_name, uma_init inpcbzone_init, u_int hashfields)
 {
 
+   porthash_nelements = imin(porthash_nelements, IPPORT_MAX + 1);
+
INP_INFO_LOCK_INIT(pcbinfo, name);
INP_HASH_LOCK_INIT(pcbinfo, "pcbinfohash"); /* XXXRW: argument? */
INP_LIST_LOCK_INIT(pcbinfo, "pcbinfolist");
@@ -452,7 +451,7 @@ in_pcbinfo_init(struct inpcbinfo *pcbinfo, const char 
>ipi_hashmask);
pcbinfo->ipi_porthashbase = hashinit(porthash_nelements, M_PCB,
>ipi_porthashmask);
-   pcbinfo->ipi_lbgrouphashbase = hashinit(hash_nelements, M_PCB,
+   pcbinfo->ipi_lbgrouphashbase = hashinit(porthash_nelements, M_PCB,
>ipi_lbgrouphashmask);
 #ifdef PCBGROUP
in_pcbgroup_init(pcbinfo, hashfields, hash_nelements);
@@ -1950,8 +1949,8 @@ in_pcblookup_lbgroup(const struct inpcbinfo *pcbinfo,
 
INP_HASH_LOCK_ASSERT(pcbinfo);
 
-   hdr = >ipi_lbgrouphashbase[INP_PCBLBGROUP_PORTHASH(lport,
-   pcbinfo->ipi_lbgrouphashmask)];
+   hdr = >ipi_lbgrouphashbase[
+   INP_PCBPORTHASH(lport, pcbinfo->ipi_lbgrouphashmask)];
 
/*
 * Order of socket selection:

Modified: head/sys/netinet/in_pcb.h
==
--- head/sys/netinet/in_pcb.h   Wed Dec  5 16:55:45 2018(r341594)
+++ head/sys/netinet/in_pcb.h   Wed Dec  5 17:06:00 2018(r341595)
@@ -688,8 +688,6 @@ int inp_so_options(const struct inpcb *inp);
(((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask))
 #define INP_PCBPORTHASH(lport, mask) \
(ntohs((lport)) & (mask))
-#defineINP_PCBLBGROUP_PORTHASH(lport, mask) \
-   (ntohs((lport)) & (mask))
 #defineINP_PCBLBGROUP_PKTHASH(faddr, lport, fport) \
((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport)))
 #defineINP6_PCBHASHKEY(faddr)  ((faddr)->s6_addr32[3])

Modified: head/sys/netinet6/in6_pcb.c
==
--- head/sys/netinet6/in6_pcb.c Wed Dec  5 16:55:45 2018(r341594)
+++ head/sys/netinet6/in6_pcb.c Wed Dec  5 17:06:00 2018(r341595)
@@ -880,8 +880,8 @@ in6_pcblookup_lbgroup(const struct inpcbinfo *pcbinfo,
 
INP_HASH_LOCK_ASSERT(pcbinfo);
 
-   hdr = >ipi_lbgrouphashbase[INP_PCBLBGROUP_PORTHASH(
-   lport, pcbinfo->ipi_lbgrouphashmask)];
+   hdr = >ipi_lbgrouphashbase[
+   INP_PCBPORTHASH(lport, pcbinfo->ipi_lbgrouphashmask)];
 
/*
 * Order of socket selection:
___
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: r341594 - head/share/man/man4

2018-12-05 Thread Mark Johnston
Author: markj
Date: Wed Dec  5 16:55:45 2018
New Revision: 341594
URL: https://svnweb.freebsd.org/changeset/base/341594

Log:
  Netdump support was added to mlx4en(4) in r341548.
  
  MFC with: r341548

Modified:
  head/share/man/man4/netdump.4

Modified: head/share/man/man4/netdump.4
==
--- head/share/man/man4/netdump.4   Wed Dec  5 16:43:03 2018
(r341593)
+++ head/share/man/man4/netdump.4   Wed Dec  5 16:55:45 2018
(r341594)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 29, 2018
+.Dd December 5, 2018
 .Dt NETDUMP 4
 .Os
 .Sh NAME
@@ -105,6 +105,7 @@ The following network drivers support netdump:
 .Xr em 4 ,
 .Xr igb 4 ,
 .Xr ix 4 ,
+.Xr mlx4en 4 ,
 .Xr re 4 ,
 .Xr vtnet 4 .
 .Sh SYSCTL VARIABLES
___
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: r341593 - in head/sys: contrib/vchiq/interface/compat kern sys

2018-12-05 Thread Mateusz Guzik
Author: mjg
Date: Wed Dec  5 16:43:03 2018
New Revision: 341593
URL: https://svnweb.freebsd.org/changeset/base/341593

Log:
  sx: retire SX_NOADAPTIVE
  
  The flag is not used by anything for years and supporting it requires an
  explicit read from the lock when entering slow path.
  
  Flag value is left unused on purpose.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/contrib/vchiq/interface/compat/vchi_bsd.h
  head/sys/kern/kern_sx.c
  head/sys/sys/sx.h

Modified: head/sys/contrib/vchiq/interface/compat/vchi_bsd.h
==
--- head/sys/contrib/vchiq/interface/compat/vchi_bsd.h  Wed Dec  5 15:56:44 
2018(r341592)
+++ head/sys/contrib/vchiq/interface/compat/vchi_bsd.h  Wed Dec  5 16:43:03 
2018(r341593)
@@ -162,10 +162,6 @@ struct mutex {
  */
 typedef struct rwlock rwlock_t;
 
-#if defined(SX_ADAPTIVESPIN) && !defined(SX_NOADAPTIVE)
-#define SX_NOADAPTIVE SX_ADAPTIVESPIN
-#endif
-
 #define DEFINE_RWLOCK(name)\
struct rwlock name; \
SX_SYSINIT(name, , #name)

Modified: head/sys/kern/kern_sx.c
==
--- head/sys/kern/kern_sx.c Wed Dec  5 15:56:44 2018(r341592)
+++ head/sys/kern/kern_sx.c Wed Dec  5 16:43:03 2018(r341593)
@@ -71,8 +71,6 @@ __FBSDID("$FreeBSD$");
 #defineADAPTIVE_SX
 #endif
 
-CTASSERT((SX_NOADAPTIVE & LO_CLASSFLAGS) == SX_NOADAPTIVE);
-
 #ifdef HWPMC_HOOKS
 #include 
 PMC_SOFT_DECLARE( , , lock, failed);
@@ -233,7 +231,7 @@ sx_init_flags(struct sx *sx, const char *description, 
int flags;
 
MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK |
-   SX_NOPROFILE | SX_NOADAPTIVE | SX_NEW)) == 0);
+   SX_NOPROFILE | SX_NEW)) == 0);
ASSERT_ATOMIC_LOAD_PTR(sx->sx_lock,
("%s: sx_lock not aligned for %s: %p", __func__, description,
>sx_lock));
@@ -252,7 +250,6 @@ sx_init_flags(struct sx *sx, const char *description, 
if (opts & SX_NEW)
flags |= LO_NEW;
 
-   flags |= opts & SX_NOADAPTIVE;
lock_init(>lock_object, _class_sx, description, NULL, flags);
sx->sx_lock = SX_LOCK_UNLOCKED;
sx->sx_recurse = 0;
@@ -572,7 +569,6 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO
volatile struct thread *owner;
u_int i, n, spintries = 0;
enum { READERS, WRITER } sleep_reason = READERS;
-   bool adaptive;
bool in_critical = false;
 #endif
 #ifdef LOCK_PROFILING
@@ -642,10 +638,6 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO
CTR5(KTR_LOCK, "%s: %s contested (lock=%p) at %s:%d", __func__,
sx->lock_object.lo_name, (void *)sx->sx_lock, file, line);
 
-#ifdef ADAPTIVE_SX
-   adaptive = ((sx->lock_object.lo_flags & SX_NOADAPTIVE) == 0);
-#endif
-
 #ifdef HWPMC_HOOKS
PMC_SOFT_CALL( , , lock, failed);
 #endif
@@ -669,8 +661,6 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO
lda.spin_cnt++;
 #endif
 #ifdef ADAPTIVE_SX
-   if (__predict_false(!adaptive))
-   goto sleepq;
/*
 * If the lock is write locked and the owner is
 * running on another CPU, spin until the owner stops
@@ -762,20 +752,18 @@ retry_sleepq:
 * chain lock.  If so, drop the sleep queue lock and try
 * again.
 */
-   if (adaptive) {
-   if (!(x & SX_LOCK_SHARED)) {
-   owner = (struct thread *)SX_OWNER(x);
-   if (TD_IS_RUNNING(owner)) {
-   sleepq_release(>lock_object);
-   sx_drop_critical(x, _critical,
-   _work);
-   continue;
-   }
-   } else if (SX_SHARERS(x) > 0 && sleep_reason == WRITER) 
{
+   if (!(x & SX_LOCK_SHARED)) {
+   owner = (struct thread *)SX_OWNER(x);
+   if (TD_IS_RUNNING(owner)) {
sleepq_release(>lock_object);
-   sx_drop_critical(x, _critical, _work);
+   sx_drop_critical(x, _critical,
+   _work);
continue;
}
+   } else if (SX_SHARERS(x) > 0 && sleep_reason == WRITER) {
+   sleepq_release(>lock_object);
+   sx_drop_critical(x, _critical, _work);
+   continue;
}
 #endif
 
@@ -1021,7 +1009,6 @@ _sx_slock_hard(struct sx *sx, int opts, uintptr_t x LO
 #ifdef ADAPTIVE_SX
volatile 

Re: svn commit: r341505 - head/share/man/man5

2018-12-05 Thread Rodney W. Grimes
> On 12/5/18 12:06 AM, Kubilay Kocak wrote:
> > On 5/12/2018 9:51 am, Pedro F. Giffuni wrote:
> >> Starting with FreeBSD 12 we fully support writing ext4 filesystems
> >
> > Can we remove '2' from the module/man/etc name if (since) it supports 
> > multiple extXfs versions? Is there anything serious preventing it?
> >
> Bad idea: neither us or linux support the old extfs format. It is a 
> common misconception that ext3 or ext4 are different filesystems: they 
> are both extensions over the ext2 format and they were always intended 
> to work like that.
> 
> You can currently create plain ext2 filesystems on FreeBSD and add 
> ext3/4 features on top and it will work just fine. The distinction on 
> linux about ext2/3/4 is rather accidental: they didn't master Version 
> Control in time to branch instead of forking the implementation a couple 
> of times. It also seems like ext3 disappeared.
> 
> 
> > Seems minor but I think worth it for discovery/pola/obviousness, and a 
> > good time (early in the 13.0 cycle).
> >
> > We get a lot of user questions about ext*fs support on FreeBSD and 
> > pointing to an ext2fs man page also feels a bit weird.
> >
> This has to be "fixed" through documentation. I will admit that I 
> haven't been working properly on the documentation, other than trying to 
> remember some details in the Wiki page.

One simple fix would be to add MLINKS for ext3fs and ext4fs so that
you could refer a user to ext4fs.  Then manual page itself already
has a proper NAME entry, so infact hum, these links should already
be in place, that appears to be an oversight.

--- share/man/man5/Makefile.prior   2017-07-20 23:42:14.0 +
+++ share/man/man5/Makefile 2018-12-05 16:23:02.923541000 +
@@ -69,6 +69,8 @@
tmpfs.5
 
 MLINKS=dir.5 dirent.5
+MLINKS+=ext2fs.5 ext3fs.5
+MLINKS+=ext2fs.5 ext4fs.5
 MLINKS+=fs.5 inode.5
 MLINKS+=hosts.equiv.5 rhosts.5
 MLINKS+=msdosfs.5 msdos.5

> > Happy to get/organise a !committer contributor to take care of this if 
> > no-one wants to pick it up.
> >
> 
> I will be glad to review/commit manpage changes that make things 
> clearer. We should probably even try to document the format, as I recall 
> we do for FAT somewhere(?).
> 
> Pedro.
> 
> 
> 
> 

-- 
Rod Grimes rgri...@freebsd.org
___
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: r341505 - head/share/man/man5

2018-12-05 Thread Ravi Pokala
> I will be glad to review/commit manpage changes that make things 
> clearer. We should probably even try to document the format, as I recall 
> we do for FAT somewhere(?).

In addition to updating the manpage, perhaps also create links to it as 
ext3fs.5 and ext4fs.5?

-Ravi (rpokala@)

-Original Message-
From:  on behalf of Pedro Giffuni 

Date: 2018-12-05, Wednesday at 07:24
To: , , 
, 
Subject: Re: svn commit: r341505 - head/share/man/man5

On 12/5/18 12:06 AM, Kubilay Kocak wrote:
>> On 5/12/2018 9:51 am, Pedro F. Giffuni wrote:
>>> Starting with FreeBSD 12 we fully support writing ext4 filesystems
>>
>> Can we remove '2' from the module/man/etc name if (since) it supports 
>> multiple extXfs versions? Is there anything serious preventing it?
>>
> Bad idea: neither us or linux support the old extfs format. It is a 
> common misconception that ext3 or ext4 are different filesystems: they 
> are both extensions over the ext2 format and they were always intended 
> to work like that.
> 
> You can currently create plain ext2 filesystems on FreeBSD and add 
> ext3/4 features on top and it will work just fine. The distinction on 
> linux about ext2/3/4 is rather accidental: they didn't master Version 
> Control in time to branch instead of forking the implementation a couple 
> of times. It also seems like ext3 disappeared.
> 
>> Seems minor but I think worth it for discovery/pola/obviousness, and a 
>> good time (early in the 13.0 cycle).
>>
>> We get a lot of user questions about ext*fs support on FreeBSD and 
>> pointing to an ext2fs man page also feels a bit weird.
>
> This has to be "fixed" through documentation. I will admit that I 
> haven't been working properly on the documentation, other than trying to 
> remember some details in the Wiki page.
> 
>> Happy to get/organise a !committer contributor to take care of this if 
>> no-one wants to pick it up.
>
> I will be glad to review/commit manpage changes that make things 
> clearer. We should probably even try to document the format, as I recall 
> we do for FAT somewhere(?).
> 
> Pedro.


___
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: r341592 - head/sys/compat/linuxkpi/common/include/linux

2018-12-05 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Dec  5 15:56:44 2018
New Revision: 341592
URL: https://svnweb.freebsd.org/changeset/base/341592

Log:
  Remove redundant declaration after r341517.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/idr.h

Modified: head/sys/compat/linuxkpi/common/include/linux/idr.h
==
--- head/sys/compat/linuxkpi/common/include/linux/idr.h Wed Dec  5 15:53:34 
2018(r341591)
+++ head/sys/compat/linuxkpi/common/include/linux/idr.h Wed Dec  5 15:56:44 
2018(r341592)
@@ -91,7 +91,6 @@ void  idr_init(struct idr *idp);
 intidr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t);
 intidr_alloc_cyclic(struct idr *idp, void *ptr, int start, int end, gfp_t);
 intidr_for_each(struct idr *idp, int (*fn)(int id, void *p, void *data), 
void *data);
-bool   idr_is_empty(struct idr *idp);
 
 #defineidr_for_each_entry(idp, entry, id)  \
for ((id) = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++(id))
___
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: r341591 - head/sys/compat/linuxkpi/common/include/asm

2018-12-05 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Dec  5 15:53:34 2018
New Revision: 341591
URL: https://svnweb.freebsd.org/changeset/base/341591

Log:
  Fix some build of LinuxKPI on some platforms after r341518.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/asm/atomic-long.h

Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h
==
--- head/sys/compat/linuxkpi/common/include/asm/atomic-long.h   Wed Dec  5 
15:42:31 2018(r341590)
+++ head/sys/compat/linuxkpi/common/include/asm/atomic-long.h   Wed Dec  5 
15:53:34 2018(r341591)
@@ -78,7 +78,15 @@ atomic_long_dec(atomic_long_t *v)
 static inline long
 atomic_long_xchg(atomic_long_t *v, long val)
 {
+#if defined(__i386__) || defined(__amd64__) || defined(__aarch64__)
return atomic_swap_long(>counter, val);
+#else
+   long ret = atomic_long_read(v);
+
+   while (!atomic_fcmpset_long(>counter, , val))
+   ;
+   return (ret);
+#endif
 }
 
 static inline long
___
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: r341590 - head/sys/conf

2018-12-05 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Dec  5 15:42:31 2018
New Revision: 341590
URL: https://svnweb.freebsd.org/changeset/base/341590

Log:
  Fix LINT build after r341572.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Wed Dec  5 15:38:52 2018(r341589)
+++ head/sys/conf/files Wed Dec  5 15:42:31 2018(r341590)
@@ -4772,6 +4772,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}"
___
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: r341589 - head/sys/net

2018-12-05 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Dec  5 15:38:52 2018
New Revision: 341589
URL: https://svnweb.freebsd.org/changeset/base/341589

Log:
  netmap.h: include stdatomic.h
  
  The stdatomic.h header exports atomic_thread_fence(), that
  can be used to implement the nm_stst_barrier() macro needed
  by netmap.
  
  MFC after:3 days

Modified:
  head/sys/net/netmap.h

Modified: head/sys/net/netmap.h
==
--- head/sys/net/netmap.h   Wed Dec  5 15:05:26 2018(r341588)
+++ head/sys/net/netmap.h   Wed Dec  5 15:38:52 2018(r341589)
@@ -784,9 +784,10 @@ static inline void nm_stst_barrier(void)
 #ifdef _KERNEL
 #define nm_stst_barrieratomic_thread_fence_rel
 #else  /* !_KERNEL */
+#include 
 static inline void nm_stst_barrier(void)
 {
-   __atomic_thread_fence(__ATOMIC_RELEASE);
+   atomic_thread_fence(memory_order_release);
 }
 #endif /* !_KERNEL */
 
___
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: r341505 - head/share/man/man5

2018-12-05 Thread Pedro Giffuni



On 12/5/18 12:06 AM, Kubilay Kocak wrote:

On 5/12/2018 9:51 am, Pedro F. Giffuni wrote:

Starting with FreeBSD 12 we fully support writing ext4 filesystems


Can we remove '2' from the module/man/etc name if (since) it supports 
multiple extXfs versions? Is there anything serious preventing it?


Bad idea: neither us or linux support the old extfs format. It is a 
common misconception that ext3 or ext4 are different filesystems: they 
are both extensions over the ext2 format and they were always intended 
to work like that.


You can currently create plain ext2 filesystems on FreeBSD and add 
ext3/4 features on top and it will work just fine. The distinction on 
linux about ext2/3/4 is rather accidental: they didn't master Version 
Control in time to branch instead of forking the implementation a couple 
of times. It also seems like ext3 disappeared.



Seems minor but I think worth it for discovery/pola/obviousness, and a 
good time (early in the 13.0 cycle).


We get a lot of user questions about ext*fs support on FreeBSD and 
pointing to an ext2fs man page also feels a bit weird.


This has to be "fixed" through documentation. I will admit that I 
haven't been working properly on the documentation, other than trying to 
remember some details in the Wiki page.



Happy to get/organise a !committer contributor to take care of this if 
no-one wants to pick it up.




I will be glad to review/commit manpage changes that make things 
clearer. We should probably even try to document the format, as I recall 
we do for FAT somewhere(?).


Pedro.


___
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: r341588 - stable/11/sys/modules/netmap

2018-12-05 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Dec  5 15:05:26 2018
New Revision: 341588
URL: https://svnweb.freebsd.org/changeset/base/341588

Log:
  netmap: fix module Makefile
  
  Reported by:  mav

Modified:
  stable/11/sys/modules/netmap/Makefile

Modified: stable/11/sys/modules/netmap/Makefile
==
--- stable/11/sys/modules/netmap/Makefile   Wed Dec  5 14:25:34 2018
(r341587)
+++ stable/11/sys/modules/netmap/Makefile   Wed Dec  5 15:05:26 2018
(r341588)
@@ -22,7 +22,6 @@ SRCS  += netmap_pipe.c
 SRCS   += netmap_monitor.c
 SRCS   += netmap_pt.c
 SRCS   += netmap_legacy.c
-SRCS   += if_ptnet.c
 SRCS   += opt_inet.h opt_inet6.h
 
 .include 
___
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: r341586 - head/sys/dev/mlx5/mlx5_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:25:03 2018
New Revision: 341586
URL: https://svnweb.freebsd.org/changeset/base/341586

Log:
  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.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/en_rl.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 14:24:33 2018
(r341585)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 14:25:03 2018
(r341586)
@@ -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: head/sys/dev/mlx5/mlx5_en/en_rl.h
==
--- head/sys/dev/mlx5/mlx5_en/en_rl.h   Wed Dec  5 14:24:33 2018
(r341585)
+++ head/sys/dev/mlx5/mlx5_en/en_rl.h   Wed Dec  5 14:25:03 2018
(r341586)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 14:24:33 2018
(r341585)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 14:25:03 2018
(r341586)
@@ -886,7 +886,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;
 
@@ -916,7 +916,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;
 
@@ -1778,7 +1778,9 @@ mlx5e_open_channel(struct 

svn commit: r341587 - in head/sys/dev: mlx4/mlx4_core mlx4/mlx4_ib mlx5/mlx5_core mlx5/mlx5_en mlx5/mlx5_ib

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:25:34 2018
New Revision: 341587
URL: https://svnweb.freebsd.org/changeset/base/341587

Log:
  mlx4/mlx5: Updated driver version to 3.5.0
  
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_core/mlx4.h
  head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
  head/sys/dev/mlx5/mlx5_core/mlx5_core.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c

Modified: head/sys/dev/mlx4/mlx4_core/mlx4.h
==
--- head/sys/dev/mlx4/mlx4_core/mlx4.h  Wed Dec  5 14:25:03 2018
(r341586)
+++ head/sys/dev/mlx4/mlx4_core/mlx4.h  Wed Dec  5 14:25:34 2018
(r341587)
@@ -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: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
==
--- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.cWed Dec  5 14:25:03 2018
(r341586)
+++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.cWed Dec  5 14:25:34 2018
(r341587)
@@ -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: head/sys/dev/mlx5/mlx5_core/mlx5_core.h
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Dec  5 14:25:03 2018
(r341586)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Dec  5 14:25:34 2018
(r341587)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 14:25:03 2018
(r341586)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 14:25:34 2018
(r341587)
@@ -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: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
==
--- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec  5 14:25:03 2018
(r341586)
+++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec  5 14:25:34 2018
(r341587)
@@ -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: r341584 - head/sys/dev/mlx5/mlx5_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:24:02 2018
New Revision: 341584
URL: https://svnweb.freebsd.org/changeset/base/341584

Log:
  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.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 14:23:31 2018
(r341583)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 14:24:02 2018
(r341584)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c  Wed Dec  5 14:23:31 2018
(r341583)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c  Wed Dec  5 14:24:02 2018
(r341584)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c  Wed Dec  5 14:23:31 2018
(r341583)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c  Wed Dec  5 14:24:02 2018
(r341584)
@@ -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: r341585 - head/sys/dev/mlx5/mlx5_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:24:33 2018
New Revision: 341585
URL: https://svnweb.freebsd.org/changeset/base/341585

Log:
  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.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec  5 14:24:02 2018
(r341584)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec  5 14:24:33 2018
(r341585)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 14:24:02 2018
(r341584)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 14:24:33 2018
(r341585)
@@ -2898,12 +2898,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: r341583 - head/sys/dev/mlx5/mlx5_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:23:31 2018
New Revision: 341583
URL: https://svnweb.freebsd.org/changeset/base/341583

Log:
  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.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 14:23:01 2018
(r341582)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 14:23:31 2018
(r341583)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec  5 14:23:01 2018
(r341582)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec  5 14:23:31 2018
(r341583)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 14:23:01 2018
(r341582)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 14:23:31 2018
(r341583)
@@ -473,7 +473,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)
@@ -507,10 +506,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;
@@ -522,8 +521,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;
@@ -1202,7 +1201,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
@@ -1388,6 +1387,8 @@ mlx5e_open_sq(struct mlx5e_channel *c,

svn commit: r341582 - head/sys/dev/mlx5/mlx5_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:23:01 2018
New Revision: 341582
URL: https://svnweb.freebsd.org/changeset/base/341582

Log:
  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.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 14:22:30 2018
(r341581)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 14:23:01 2018
(r341582)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec  5 14:22:30 2018
(r341581)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec  5 14:23:01 2018
(r341582)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 14:22:30 2018
(r341581)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 14:23:01 2018
(r341582)
@@ -3639,8 +3639,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),
@@ -3831,8 +3829,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:
@@ -3889,13 +3887,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: r341581 - in head/sys/dev/mlx5: . mlx5_core mlx5_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:22:30 2018
New Revision: 341581
URL: https://svnweb.freebsd.org/changeset/base/341581

Log:
  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.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_port.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_ifc.h
  head/sys/dev/mlx5/port.h

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec  5 14:21:59 2018
(r341580)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec  5 14:22:30 2018
(r341581)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 14:21:59 2018
(r341580)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 14:22:30 2018
(r341581)
@@ -169,6 +169,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,
@@ -197,10 +198,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);
@@ -224,6 +248,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; ++i) {
if 

svn commit: r341580 - head/sys/dev/mlx5/mlx5_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:21:59 2018
New Revision: 341580
URL: https://svnweb.freebsd.org/changeset/base/341580

Log:
  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.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c  Wed Dec  5 14:21:28 2018
(r341579)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c  Wed Dec  5 14:21:59 2018
(r341580)
@@ -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: r341578 - head/sys/dev/mlx5/mlx5_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:20:57 2018
New Revision: 341578
URL: https://svnweb.freebsd.org/changeset/base/341578

Log:
  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.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 14:20:26 2018
(r341577)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 14:20:57 2018
(r341578)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec  5 14:20:26 2018
(r341577)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec  5 14:20:57 2018
(r341578)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 14:20:26 2018
(r341577)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 14:20:57 2018
(r341578)
@@ -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
@@ -1184,37 +1184,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 (priv->params_ethtool.tx_bufring_disable == 0) {
-   sq->br = buf_ring_alloc(MLX5E_SQ_TX_QUEUE_SIZE, M_MLX5EN,
-   M_WAITOK, >lock);
-   if (sq->br == NULL) {
-   if_printf(c->ifp, "%s: Failed allocating sq drbr 
buffer\n",
-   __func__);
-   err = -ENOMEM;
-   goto err_free_sq_db;
-   }
-
-   sq->sq_tq = 

svn commit: r341579 - in head/sys/dev/mlx5: . mlx5_core mlx5_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:21:28 2018
New Revision: 341579
URL: https://svnweb.freebsd.org/changeset/base/341579

Log:
  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.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_vport.c
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/en_rl.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
  head/sys/dev/mlx5/vport.h

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vport.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_vport.cWed Dec  5 14:20:57 2018
(r341578)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_vport.cWed Dec  5 14:21:28 2018
(r341579)
@@ -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: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 14:20:57 2018
(r341578)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 14:21:28 2018
(r341579)
@@ -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: head/sys/dev/mlx5/mlx5_en/en_rl.h
==
--- head/sys/dev/mlx5/mlx5_en/en_rl.h   Wed Dec  5 14:20:57 2018
(r341578)
+++ head/sys/dev/mlx5/mlx5_en/en_rl.h   Wed Dec  5 14:21:28 2018
(r341579)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec  5 14:20:57 2018
(r341578)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec  5 14:21:28 2018
(r341579)
@@ -374,6 +374,12 @@ mlx5e_trust_state_handler(SYSCTL_HANDLER_ARGS)
   

svn commit: r341577 - in head/sys/dev/mlx5: . mlx5_core mlx5_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:20:26 2018
New Revision: 341577
URL: https://svnweb.freebsd.org/changeset/base/341577

Log:
  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).
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_port.c
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  head/sys/dev/mlx5/port.h

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec  5 14:19:55 2018
(r341576)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec  5 14:20:26 2018
(r341577)
@@ -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: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 14:19:55 2018
(r341576)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 14:20:26 2018
(r341577)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c

svn commit: r341574 - in head/sys/dev/mlx5: . mlx5_fpga

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:18:52 2018
New Revision: 341574
URL: https://svnweb.freebsd.org/changeset/base/341574

Log:
  mlx5fpga: Support MorseQ board
  
  Added and supported new enum "morseQ = 4" for fpga_id field
  
  Submitted by:   kib@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c
  head/sys/dev/mlx5/mlx5io.h

Modified: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c
==
--- head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c Wed Dec  5 14:17:22 2018
(r341573)
+++ head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c Wed Dec  5 14:18:52 2018
(r341574)
@@ -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: head/sys/dev/mlx5/mlx5io.h
==
--- head/sys/dev/mlx5/mlx5io.h  Wed Dec  5 14:17:22 2018(r341573)
+++ head/sys/dev/mlx5/mlx5io.h  Wed Dec  5 14:18:52 2018(r341574)
@@ -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: r341576 - in head/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:19:55 2018
New Revision: 341576
URL: https://svnweb.freebsd.org/changeset/base/341576

Log:
  mlx5fpga: Add set and query connect/disconnect FPGA
  
  Submitted by:   kib@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_fpga/cmd.h
  head/sys/dev/mlx5/mlx5_fpga/core.h
  head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h
  head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c
  head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c
  head/sys/dev/mlx5/mlx5_fpga/sdk.h
  head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c
  head/sys/dev/mlx5/mlx5io.h

Modified: head/sys/dev/mlx5/mlx5_fpga/cmd.h
==
--- head/sys/dev/mlx5/mlx5_fpga/cmd.h   Wed Dec  5 14:19:23 2018
(r341575)
+++ head/sys/dev/mlx5/mlx5_fpga/cmd.h   Wed Dec  5 14:19:55 2018
(r341576)
@@ -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: head/sys/dev/mlx5/mlx5_fpga/core.h
==
--- head/sys/dev/mlx5/mlx5_fpga/core.h  Wed Dec  5 14:19:23 2018
(r341575)
+++ head/sys/dev/mlx5/mlx5_fpga/core.h  Wed Dec  5 14:19:55 2018
(r341576)
@@ -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: head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h
==
--- head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h Wed Dec  5 14:19:23 2018
(r341575)
+++ head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h Wed Dec  5 14:19:55 2018
(r341576)
@@ -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: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c
==
--- head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c  Wed Dec  5 14:19:23 2018
(r341575)
+++ head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c  Wed Dec  5 14:19:55 2018
(r341576)
@@ -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: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c
==
--- head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c  Wed Dec  5 14:19:23 2018
(r341575)
+++ head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c  Wed Dec  5 14:19:55 2018
(r341576)
@@ -342,6 +342,7 @@ int mlx5_fpga_device_reload(struct mlx5_fpga_device *f

svn commit: r341575 - in head/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:19:23 2018
New Revision: 341575
URL: https://svnweb.freebsd.org/changeset/base/341575

Log:
  mlx5fpga: IOCTL for FPGA temperature measurement
  
  Submitted by:   kib@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_fpga/cmd.h
  head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c
  head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c
  head/sys/dev/mlx5/mlx5_fpga/sdk.h
  head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c
  head/sys/dev/mlx5/mlx5_ifc.h
  head/sys/dev/mlx5/mlx5io.h

Modified: head/sys/dev/mlx5/driver.h
==
--- head/sys/dev/mlx5/driver.h  Wed Dec  5 14:18:52 2018(r341574)
+++ head/sys/dev/mlx5/driver.h  Wed Dec  5 14:19:23 2018(r341575)
@@ -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: head/sys/dev/mlx5/mlx5_fpga/cmd.h
==
--- head/sys/dev/mlx5/mlx5_fpga/cmd.h   Wed Dec  5 14:18:52 2018
(r341574)
+++ head/sys/dev/mlx5/mlx5_fpga/cmd.h   Wed Dec  5 14:19:23 2018
(r341575)
@@ -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: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c
==
--- head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c  Wed Dec  5 14:18:52 2018
(r341574)
+++ head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c  Wed Dec  5 14:19:23 2018
(r341575)
@@ -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: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c
==
--- head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c  Wed Dec  5 14:18:52 2018
(r341574)
+++ head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c  Wed Dec  5 14:19:23 2018
(r341575)
@@ -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: head/sys/dev/mlx5/mlx5_fpga/sdk.h
==
--- head/sys/dev/mlx5/mlx5_fpga/sdk.h   Wed Dec  5 14:18:52 2018
(r341574)
+++ head/sys/dev/mlx5/mlx5_fpga/sdk.h   Wed Dec  5 14:19:23 2018
(r341575)
@@ -356,6 +356,16 @@ void mlx5_fpga_device_query(struct mlx5_fpga_device *f
 struct device *mlx5_fpga_dev(struct mlx5_fpga_device *fdev);
 
 /**
+ * 

svn commit: r341573 - in head/sys: dev/mlx5 dev/mlx5/mlx5_fpga_tools modules/mlx5fpga_tools

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:17:22 2018
New Revision: 341573
URL: https://svnweb.freebsd.org/changeset/base/341573

Log:
  mlx5fpga_tools initial code import.
  
  Submitted by:   kib@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Added:
  head/sys/dev/mlx5/mlx5_fpga_tools/
  head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c   (contents, props 
changed)
  head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_main.c   (contents, props 
changed)
  head/sys/dev/mlx5/mlx5_fpga_tools/tools.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga_tools/tools_char.h   (contents, props changed)
  head/sys/modules/mlx5fpga_tools/
  head/sys/modules/mlx5fpga_tools/Makefile   (contents, props changed)
Modified:
  head/sys/dev/mlx5/mlx5io.h

Added: head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c Wed Dec  5 
14:17:22 2018(r341573)
@@ -0,0 +1,325 @@
+/*-
+ * Copyright (c) 2017 Mellanox Technologies. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *  - Redistributions of source code must retain the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer.
+ *
+ *  - 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.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define CHUNK_SIZE (128 * 1024)
+
+struct tools_context {
+   struct mlx5_fpga_tools_dev *tdev;
+   enum mlx5_fpga_access_type access_type;
+};
+
+static void
+tools_char_ctx_dtor(void *data)
+{
+
+   free(data, M_DEVBUF);
+}
+
+static int
+tools_char_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
+{
+   struct tools_context *context;
+
+   context = malloc(sizeof(*context), M_DEVBUF, M_WAITOK);
+   context->tdev = dev->si_drv1;
+   context->access_type = MLX5_FPGA_ACCESS_TYPE_DONTCARE;
+   devfs_set_cdevpriv(context, tools_char_ctx_dtor);
+   return (0);
+}
+
+static int
+mem_read(struct mlx5_fpga_tools_dev *tdev, void *buf, size_t count,
+u64 address, enum mlx5_fpga_access_type access_type, size_t *retcnt)
+{
+   int ret;
+
+   ret = sx_xlock_sig(>lock);
+   if (ret != 0)
+   return (ret);
+   ret = mlx5_fpga_mem_read(tdev->fdev, count, address, buf, access_type);
+   sx_xunlock(>lock);
+   if (ret < 0) {
+   dev_dbg(mlx5_fpga_dev(tdev->fdev),
+   "Failed to read %zu bytes at address 0x%jx: %d\n",
+   count, (uintmax_t)address, ret);
+   return (-ret);
+   }
+   *retcnt = ret;
+   return (0);
+}
+
+static int
+mem_write(struct mlx5_fpga_tools_dev *tdev, void *buf, size_t count,
+u64 address, enum mlx5_fpga_access_type access_type, size_t *retcnt)
+{
+   int ret;
+
+   ret = sx_xlock_sig(>lock);
+   if (ret != 0)
+   return (ret);
+   ret = mlx5_fpga_mem_write(tdev->fdev, count, address, buf, access_type);
+   sx_xunlock(>lock);
+   if (ret < 0) {
+   dev_dbg(mlx5_fpga_dev(tdev->fdev),
+   "Failed to write %zu bytes at address 0x%jx: %d\n",
+   count, (uintmax_t)address, ret);
+   return (-ret);
+   }
+   *retcnt = ret;
+   return (0);
+}
+
+static void
+tools_char_llseek(struct tools_context *context, struct uio *uio, ssize_t *len)
+{
+   uint64_t fbase, fsize;
+   size_t llen;
+
+   llen = uio->uio_resid;
+   if (llen < 1) {
+   *len = 0;
+   return;
+   }
+   if (llen > CHUNK_SIZE)
+   llen = CHUNK_SIZE;
+   fbase = 

svn commit: r341572 - in head/sys: dev/mlx5 dev/mlx5/mlx5_accel dev/mlx5/mlx5_core dev/mlx5/mlx5_fpga dev/mlx5/mlx5_lib modules/mlx5 modules/mlx5en modules/mlx5ib

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 14:11:20 2018
New Revision: 341572
URL: https://svnweb.freebsd.org/changeset/base/341572

Log:
  mlx5fpga: Initial code import.
  
  Submitted by:   kib@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Added:
  head/sys/dev/mlx5/mlx5_accel/
  head/sys/dev/mlx5/mlx5_accel/ipsec.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga/
  head/sys/dev/mlx5/mlx5_fpga/cmd.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga/conn.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga/core.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga/ipsec.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_conn.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_ipsec.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_trans.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_xfer.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga/sdk.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga/trans.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_fpga/xfer.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_lib/
  head/sys/dev/mlx5/mlx5_lib/mlx5.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_lib/mlx5_gid.c   (contents, props changed)
Modified:
  head/sys/dev/mlx5/device.h
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_core/mlx5_core.h
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c
  head/sys/dev/mlx5/mlx5_core/wq.h
  head/sys/dev/mlx5/mlx5_ifc.h
  head/sys/dev/mlx5/mlx5io.h
  head/sys/modules/mlx5/Makefile
  head/sys/modules/mlx5en/Makefile
  head/sys/modules/mlx5ib/Makefile

Modified: head/sys/dev/mlx5/device.h
==
--- head/sys/dev/mlx5/device.h  Wed Dec  5 13:49:11 2018(r341571)
+++ head/sys/dev/mlx5/device.h  Wed Dec  5 14:11:20 2018(r341572)
@@ -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: head/sys/dev/mlx5/driver.h
==
--- head/sys/dev/mlx5/driver.h  Wed Dec  5 13:49:11 2018(r341571)
+++ head/sys/dev/mlx5/driver.h  Wed Dec  5 14:11:20 2018(r341572)
@@ -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;

svn commit: r341571 - head/sys/dev/mlx5/mlx5_ib

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:49:11 2018
New Revision: 341571
URL: https://svnweb.freebsd.org/changeset/base/341571

Log:
  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
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c

Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
==
--- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec  5 13:48:39 2018
(r341570)
+++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec  5 13:49:11 2018
(r341571)
@@ -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: r341568 - head/sys/dev/mlx5/mlx5_ib

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:47:41 2018
New Revision: 341568
URL: https://svnweb.freebsd.org/changeset/base/341568

Log:
  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.
  
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c

Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
==
--- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec  5 13:47:10 2018
(r341567)
+++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec  5 13:47:41 2018
(r341568)
@@ -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: r341570 - head/sys/dev/mlx5/mlx5_ib

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:48:39 2018
New Revision: 341570
URL: https://svnweb.freebsd.org/changeset/base/341570

Log:
  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.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c

Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c
==
--- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.cWed Dec  5 13:48:10 2018
(r341569)
+++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.cWed Dec  5 13:48:39 2018
(r341570)
@@ -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: r341569 - head/sys/dev/mlx5/mlx5_ib

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:48:10 2018
New Revision: 341569
URL: https://svnweb.freebsd.org/changeset/base/341569

Log:
  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.
  
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c

Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c
==
--- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Wed Dec  5 13:47:41 2018
(r341568)
+++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Wed Dec  5 13:48:10 2018
(r341569)
@@ -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: r341567 - in head/sys: compat/linuxkpi/common/src dev/mlx5/mlx5_core dev/mlx5/mlx5_en dev/mlx5/mlx5_ib

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:47:10 2018
New Revision: 341567
URL: https://svnweb.freebsd.org/changeset/base/341567

Log:
  mlx5: Fix driver version location
  
  Driver description should be set by core and not by the Ethernet driver.
  
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/src/linux_pci.c
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c

Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
==
--- head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Dec  5 13:46:39 
2018(r341566)
+++ head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Dec  5 13:47:10 
2018(r341567)
@@ -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: head/sys/dev/mlx5/mlx5_core/mlx5_main.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec  5 13:46:39 2018
(r341566)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec  5 13:47:10 2018
(r341567)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 13:46:39 2018
(r341566)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 13:47:10 2018
(r341567)
@@ -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);
 
@@ -3687,9 +3687,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 |
@@ -3805,13 +3802,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);
 
@@ -3896,6 +3886,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: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
==
--- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec  5 13:46:39 2018
(r341566)
+++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec  5 13:47:10 2018
(r341567)
@@ -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);
mlx5_ib_odp_cleanup();
 }
+
+static void
+mlx5_ib_show_version(void __unused *arg)
+{
+
+   printf("%s", 

svn commit: r341566 - in head/sys/dev/mlx5: . mlx5_core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:46:39 2018
New Revision: 341566
URL: https://svnweb.freebsd.org/changeset/base/341566

Log:
  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.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
  head/sys/dev/mlx5/mlx5_core/mlx5_eq.c
  head/sys/dev/mlx5/mlx5_core/mlx5_health.c

Modified: head/sys/dev/mlx5/driver.h
==
--- head/sys/dev/mlx5/driver.h  Wed Dec  5 13:46:09 2018(r341565)
+++ head/sys/dev/mlx5/driver.h  Wed Dec  5 13:46:39 2018(r341566)
@@ -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: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c  Wed Dec  5 13:46:09 2018
(r341565)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c  Wed Dec  5 13:46:39 2018
(r341566)
@@ -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);
}
 }
 
@@ -938,15 

svn commit: r341564 - head/sys/dev/mlx5/mlx5_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:45:37 2018
New Revision: 341564
URL: https://svnweb.freebsd.org/changeset/base/341564

Log:
  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.
  
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 13:45:08 2018
(r341563)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Wed Dec  5 13:45:37 2018
(r341564)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 13:45:08 2018
(r341563)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 13:45:37 2018
(r341564)
@@ -502,6 +502,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: r341565 - head/sys/dev/mlx5/mlx5_core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:46:09 2018
New Revision: 341565
URL: https://svnweb.freebsd.org/changeset/base/341565

Log:
  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
  
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_port.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec  5 13:45:37 2018
(r341564)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec  5 13:46:09 2018
(r341565)
@@ -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: r341563 - in head/sys/dev/mlx5: . mlx5_core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:45:08 2018
New Revision: 341563
URL: https://svnweb.freebsd.org/changeset/base/341563

Log:
  mlx5: Implement support for configuring PCIe packet write ordering via a 
sysctl.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_mr.c
  head/sys/dev/mlx5/mlx5_ifc.h

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_mr.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_mr.c   Wed Dec  5 13:44:38 2018
(r341562)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_mr.c   Wed Dec  5 13:45:08 2018
(r341563)
@@ -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: head/sys/dev/mlx5/mlx5_ifc.h
==
--- head/sys/dev/mlx5/mlx5_ifc.hWed Dec  5 13:44:38 2018
(r341562)
+++ head/sys/dev/mlx5/mlx5_ifc.hWed Dec  5 13:45:08 2018
(r341563)
@@ -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: r341562 - in head/sys/dev/mlx5: . mlx5_core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:44:38 2018
New Revision: 341562
URL: https://svnweb.freebsd.org/changeset/base/341562

Log:
  mlx5: Extend vector argument to u64.
  
  Else the MLX5_TRIGGERED_CMD_COMP flag will be masked away.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c

Modified: head/sys/dev/mlx5/driver.h
==
--- head/sys/dev/mlx5/driver.h  Wed Dec  5 13:44:08 2018(r341561)
+++ head/sys/dev/mlx5/driver.h  Wed Dec  5 13:44:38 2018(r341562)
@@ -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: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c  Wed Dec  5 13:44:08 2018
(r341561)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c  Wed Dec  5 13:44:38 2018
(r341562)
@@ -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: r341561 - head/sys/dev/mlx5/mlx5_core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:44:08 2018
New Revision: 341561
URL: https://svnweb.freebsd.org/changeset/base/341561

Log:
  mlx5: Add global control to disable firmware reset, for all mlx5 devices.
  
  Submitted by:   kib@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_health.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Wed Dec  5 13:43:37 2018
(r341560)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Wed Dec  5 13:44:08 2018
(r341561)
@@ -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: r341560 - in head/sys/dev/mlx5: . mlx5_core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:43:37 2018
New Revision: 341560
URL: https://svnweb.freebsd.org/changeset/base/341560

Log:
  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().
  
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_core/mlx5_health.c
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c

Modified: head/sys/dev/mlx5/driver.h
==
--- head/sys/dev/mlx5/driver.h  Wed Dec  5 13:43:07 2018(r341559)
+++ head/sys/dev/mlx5/driver.h  Wed Dec  5 13:43:37 2018(r341560)
@@ -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: head/sys/dev/mlx5/mlx5_core/mlx5_health.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Wed Dec  5 13:43:07 2018
(r341559)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Wed Dec  5 13:43:37 2018
(r341560)
@@ -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: head/sys/dev/mlx5/mlx5_core/mlx5_main.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec  5 13:43:07 2018
(r341559)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec  5 13:43:37 2018
(r341560)
@@ -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: r341559 - in head/sys/dev/mlx5: mlx5_core mlx5_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:43:07 2018
New Revision: 341559
URL: https://svnweb.freebsd.org/changeset/base/341559

Log:
  mlx5: Move hw.mlx5 node definition to mlx5_core.
  
  Submitted by:   kib@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_core.h
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Dec  5 13:42:36 2018
(r341558)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Dec  5 13:43:07 2018
(r341559)
@@ -103,4 +103,6 @@ struct mlx5_crspace_regmap {
 
 extern struct pci_driver mlx5_core_driver;
 
+SYSCTL_DECL(_hw_mlx5);
+
 #endif /* __MLX5_CORE_H__ */

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec  5 13:42:36 2018
(r341558)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec  5 13:43:07 2018
(r341559)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 13:42:36 2018
(r341558)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec  5 13:43:07 2018
(r341559)
@@ -159,7 +159,7 @@ static const struct {
 
 MALLOC_DEFINE(M_MLX5EN, "MLX5EN", "MLX5 Ethernet");
 
-static SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "MLX5 driver 
parameters");
+SYSCTL_DECL(_hw_mlx5);
 
 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"


svn commit: r341558 - head/sys/dev/mlx5/mlx5_core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:42:36 2018
New Revision: 341558
URL: https://svnweb.freebsd.org/changeset/base/341558

Log:
  mlx5: Convert some spaces into tabs and use device_printf() instead of 
printf().
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec  5 13:42:06 2018
(r341557)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec  5 13:42:36 2018
(r341558)
@@ -1211,7 +1211,7 @@ static int init_one(struct pci_dev *pdev,
priv->pci_dev_data = id->driver_data;
 
if (prof_sel < 0 || prof_sel >= ARRAY_SIZE(profiles)) {
-   printf("mlx5_core: WARN: ""selected profile out of range, 
selecting default (%d)\n", MLX5_DEFAULT_PROF);
+   device_printf(bsddev, "WARN: selected profile out of range, 
selecting default (%d)\n", MLX5_DEFAULT_PROF);
prof_sel = MLX5_DEFAULT_PROF;
}
dev->profile = [prof_sel];
@@ -1226,38 +1226,38 @@ static int init_one(struct pci_dev *pdev,
 
INIT_LIST_HEAD(>ctx_list);
spin_lock_init(>ctx_lock);
-mutex_init(>pci_status_mutex);
-mutex_init(>intf_state_mutex);
+   mutex_init(>pci_status_mutex);
+   mutex_init(>intf_state_mutex);
err = mlx5_pci_init(dev, priv);
if (err) {
-   device_printf((>dev)->bsddev, "ERR: ""mlx5_pci_init 
failed %d\n", err);
+   device_printf(bsddev, "ERR: mlx5_pci_init failed %d\n", err);
goto clean_dev;
}
 
-err = mlx5_health_init(dev);
-if (err) {
-device_printf((>dev)->bsddev, "ERR: ""mlx5_health_init 
failed %d\n", err);
-goto close_pci;
-}
+   err = mlx5_health_init(dev);
+   if (err) {
+   device_printf(bsddev, "ERR: mlx5_health_init failed %d\n", err);
+   goto close_pci;
+   }
 
mlx5_pagealloc_init(dev);
 
err = mlx5_load_one(dev, priv, true);
if (err) {
-   device_printf((>dev)->bsddev, "ERR: 
""mlx5_register_device failed %d\n", err);
+   device_printf(bsddev, "ERR: mlx5_load_one failed %d\n", err);
goto clean_health;
}
 
mlx5_fwdump_prep(dev);
 
-   pci_save_state(pdev->dev.bsddev);
+   pci_save_state(bsddev);
return 0;
 
 clean_health:
mlx5_pagealloc_cleanup(dev);
-mlx5_health_cleanup(dev);
+   mlx5_health_cleanup(dev);
 close_pci:
-mlx5_pci_close(dev, priv);
+   mlx5_pci_close(dev, priv);
 clean_dev:
sysctl_ctx_free(>sysctl_ctx);
kfree(dev);
___
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: r341557 - in head/sys/dev/mlx5: . mlx5_ib

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:42:06 2018
New Revision: 341557
URL: https://svnweb.freebsd.org/changeset/base/341557

Log:
  mlx5: Add SRQ fixes from Linux
  
  Combine multiple fixes from Linux to SRQ.
  Linux commits:
  c73b791 IB/mlx5: Assign SRQ type earlier
  0fd27a8 IB/mlx5: Fix out-of-bound access
  c2b37f7 IB/mlx5: Fix integer overflows in mlx5_ib_create_srq
  d63c467 RDMA/mlx5: Fix memory leak in mlx5_ib_create_srq() error path
  
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c

Modified: head/sys/dev/mlx5/driver.h
==
--- head/sys/dev/mlx5/driver.h  Wed Dec  5 13:41:37 2018(r341556)
+++ head/sys/dev/mlx5/driver.h  Wed Dec  5 13:42:06 2018(r341557)
@@ -462,8 +462,8 @@ struct mlx5_core_srq {
struct mlx5_core_rsc_common common; /* must be first */
u32 srqn;
int max;
-   int max_gs;
-   int max_avail_gather;
+   size_t  max_gs;
+   size_t  max_avail_gather;
int wqe_shift;
void(*event)(struct mlx5_core_srq *, int);
atomic_trefcount;

Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c
==
--- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Wed Dec  5 13:41:37 2018
(r341556)
+++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Wed Dec  5 13:42:06 2018
(r341557)
@@ -159,8 +159,6 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, 
int err;
int i;
struct mlx5_wqe_srq_next_seg *next;
-   int page_shift;
-   int npages;
 
err = mlx5_db_alloc(dev->mdev, >db);
if (err) {
@@ -173,7 +171,6 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, 
err = -ENOMEM;
goto err_db;
}
-   page_shift = srq->buf.page_shift;
 
srq->head= 0;
srq->tail= srq->msrq.max - 1;
@@ -185,10 +182,8 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, 
cpu_to_be16((i + 1) & (srq->msrq.max - 1));
}
 
-   npages = DIV_ROUND_UP(srq->buf.npages, 1 << (page_shift - PAGE_SHIFT));
-   mlx5_ib_dbg(dev, "buf_size %d, page_shift %d, npages %d, calc npages 
%d\n",
-   buf_size, page_shift, srq->buf.npages, npages);
-   in->pas = mlx5_vzalloc(sizeof(*in->pas) * npages);
+   mlx5_ib_dbg(dev, "srq->buf.page_shift = %d\n", srq->buf.page_shift);
+   in->pas = mlx5_vzalloc(sizeof(*in->pas) * srq->buf.npages);
if (!in->pas) {
err = -ENOMEM;
goto err_buf;
@@ -204,7 +199,7 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, 
}
srq->wq_sig = !!srq_signature;
 
-   in->log_page_size = page_shift - MLX5_ADAPTER_PAGE_SHIFT;
+   in->log_page_size = srq->buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT;
if (MLX5_CAP_GEN(dev->mdev, cqe_version) == MLX5_CQE_VERSION_V1 &&
in->type == IB_SRQT_XRC)
in->user_index = MLX5_IB_DEFAULT_UIDX;
@@ -242,8 +237,8 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd,
 {
struct mlx5_ib_dev *dev = to_mdev(pd->device);
struct mlx5_ib_srq *srq;
-   int desc_size;
-   int buf_size;
+   size_t desc_size;
+   size_t buf_size;
int err;
struct mlx5_srq_attr in = {0};
__u32 max_srq_wqes = 1 << MLX5_CAP_GEN(dev->mdev, log_max_srq_sz);
@@ -267,15 +262,25 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd,
 
desc_size = sizeof(struct mlx5_wqe_srq_next_seg) +
srq->msrq.max_gs * sizeof(struct mlx5_wqe_data_seg);
+   if (desc_size == 0 || srq->msrq.max_gs > desc_size) {
+   err = -EINVAL;
+   goto err_srq;
+   }
desc_size = roundup_pow_of_two(desc_size);
-   desc_size = max_t(int, 32, desc_size);
+   desc_size = max_t(size_t, 32, desc_size);
+   if (desc_size < sizeof(struct mlx5_wqe_srq_next_seg)) {
+   err = -EINVAL;
+   goto err_srq;
+   }
srq->msrq.max_avail_gather = (desc_size - sizeof(struct 
mlx5_wqe_srq_next_seg)) /
sizeof(struct mlx5_wqe_data_seg);
srq->msrq.wqe_shift = ilog2(desc_size);
buf_size = srq->msrq.max * desc_size;
-   mlx5_ib_dbg(dev, "desc_size 0x%x, req wr 0x%x, srq size 0x%x, max_gs 
0x%x, max_avail_gather 0x%x\n",
-   desc_size, init_attr->attr.max_wr, srq->msrq.max, 
srq->msrq.max_gs,
-   srq->msrq.max_avail_gather);
+   if (buf_size < desc_size) {
+   err = -EINVAL;
+ 

svn commit: r341555 - in head/sys/dev/mlx5: mlx5_core mlx5_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:41:06 2018
New Revision: 341555
URL: https://svnweb.freebsd.org/changeset/base/341555

Log:
  mlx5: Discard unused return values.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.cWed Dec  5 13:40:36 
2018(r341554)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.cWed Dec  5 13:41:06 
2018(r341555)
@@ -128,7 +128,7 @@ mlx5_fwp_alloc(struct mlx5_core_dev *dev, gfp_t flags,
 
/* load memory into DMA */
MLX5_DMA_LOCK(dev);
-   err = bus_dmamap_load(
+   (void) bus_dmamap_load(
dev->cmd.dma_tag, fwp[x].dma_map, fwp[x].virt_addr,
MLX5_ADAPTER_PAGE_SIZE, _fwp_load_mem_cb,
fwp + x, BUS_DMA_WAITOK | BUS_DMA_COHERENT);

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c  Wed Dec  5 13:40:36 2018
(r341554)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c  Wed Dec  5 13:41:06 2018
(r341555)
@@ -421,7 +421,6 @@ mlx5e_rlw_channel_set_rate_locked(struct mlx5e_rl_work
 
if (rate == 0) {
/* rate doesn't exist, fallback to unlimited */
-   error = EINVAL;
index = 0;
rate = 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: r341556 - head/sys/dev/mlx5/mlx5_core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:41:37 2018
New Revision: 341556
URL: https://svnweb.freebsd.org/changeset/base/341556

Log:
  mlx5: Fix for potential memory leaks.
  
  Make sure allocated data gets freed in error cases.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c
  head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c
  head/sys/dev/mlx5/mlx5_core/mlx5_vport.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c  Wed Dec  5 13:41:06 2018
(r341555)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c  Wed Dec  5 13:41:37 2018
(r341556)
@@ -1601,9 +1601,10 @@ static char *get_dest_name(struct mlx5_flow_destinatio
case MLX5_FLOW_CONTEXT_DEST_TYPE_TIR:
snprintf(name, 20, "dest_%s_%u", "tir", dest->tir_num);
return name;
+   default:
+   kfree(name);
+   return NULL;
}
-
-   return NULL;
 }
 
 /* assumed fg is locked */

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.cWed Dec  5 13:41:06 
2018(r341555)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.cWed Dec  5 13:41:37 
2018(r341556)
@@ -153,6 +153,7 @@ failure:
bus_dmamem_free(dev->cmd.dma_tag, fwp[x].virt_addr, 
fwp[x].dma_map);
}
sx_xunlock(>cmd.dma_sx);
+   kfree(fwp);
return (NULL);
 }
 

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vport.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_vport.cWed Dec  5 13:41:06 2018
(r341555)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_vport.cWed Dec  5 13:41:37 2018
(r341556)
@@ -1597,8 +1597,8 @@ int mlx5_query_vport_counter(struct mlx5_core_dev *dev
 
err = mlx5_cmd_exec(dev, in, in_sz, out,  out_size);
 
-   kvfree(in);
 ex:
+   kvfree(in);
return err;
 }
 EXPORT_SYMBOL_GPL(mlx5_query_vport_counter);
___
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: r341554 - in head/sys/dev/mlx5: mlx5_core mlx5_ib

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:40:36 2018
New Revision: 341554
URL: https://svnweb.freebsd.org/changeset/base/341554

Log:
  mlx5: Raise fatal IB event when sys error occurs
  
  All other mlx5_events report the port number as 1 based, which is how FW
  reports it in the port event EQE. Reporting 0 for this event causes
  mlx5_ib to not raise a fatal event notification to registered clients
  due to a seemingly invalid port.
  
  All switch cases in mlx5_ib_event that go through the port check are
  supposed to set the port now, so just do it once at variable
  declaration.
  
  Linux commit:
  aba462134634b502d720e15b23154f21cfa277e5
  
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_health.c
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Wed Dec  5 13:40:05 2018
(r341553)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Wed Dec  5 13:40:36 2018
(r341554)
@@ -269,7 +269,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev,
mlx5_core_err(dev, "system error event triggered\n");
 
 err_state_done:
-   mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 0);
+   mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 1);
mutex_unlock(>intf_state_mutex);
 }
 

Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
==
--- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec  5 13:40:05 2018
(r341553)
+++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec  5 13:40:36 2018
(r341554)
@@ -2335,7 +2335,7 @@ static void mlx5_ib_event(struct mlx5_core_dev *dev, v
struct mlx5_ib_dev *ibdev = (struct mlx5_ib_dev *)context;
struct ib_event ibev;
bool fatal = false;
-   u8 port = 0;
+   u8 port = (u8)param;
 
switch (event) {
case MLX5_DEV_EVENT_SYS_ERROR:
@@ -2347,8 +2347,6 @@ static void mlx5_ib_event(struct mlx5_core_dev *dev, v
case MLX5_DEV_EVENT_PORT_UP:
case MLX5_DEV_EVENT_PORT_DOWN:
case MLX5_DEV_EVENT_PORT_INITIALIZED:
-   port = (u8)param;
-
/* In RoCE, port up/down events are handled in
 * mlx5_netdev_event().
 */
@@ -2362,24 +2360,20 @@ static void mlx5_ib_event(struct mlx5_core_dev *dev, v
 
case MLX5_DEV_EVENT_LID_CHANGE:
ibev.event = IB_EVENT_LID_CHANGE;
-   port = (u8)param;
break;
 
case MLX5_DEV_EVENT_PKEY_CHANGE:
ibev.event = IB_EVENT_PKEY_CHANGE;
-   port = (u8)param;
 
schedule_work(>devr.ports[port - 1].pkey_change_work);
break;
 
case MLX5_DEV_EVENT_GUID_CHANGE:
ibev.event = IB_EVENT_GID_CHANGE;
-   port = (u8)param;
break;
 
case MLX5_DEV_EVENT_CLIENT_REREG:
ibev.event = IB_EVENT_CLIENT_REREGISTER;
-   port = (u8)param;
break;
 
default:
@@ -2390,7 +2384,7 @@ static void mlx5_ib_event(struct mlx5_core_dev *dev, v
ibev.device   = >ib_dev;
ibev.element.port_num = port;
 
-   if (port < 1 || port > ibdev->num_ports) {
+   if (!rdma_is_port_valid(>ib_dev, port)) {
mlx5_ib_warn(ibdev, "warning: event(%d) on port %d\n", event, 
port);
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: r341553 - head/sys/dev/mlx5/mlx5_ib

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:40:05 2018
New Revision: 341553
URL: https://svnweb.freebsd.org/changeset/base/341553

Log:
  mlx5: Fix integer overflow while resizing CQ
  
  The user can provide very large cqe_size which will cause to integer
  overflow.
  
  Linux commit:
  28e9091e3119933c38933cb8fc48d5618eb784c8
  
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c

Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c
==
--- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c  Wed Dec  5 13:39:35 2018
(r341552)
+++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c  Wed Dec  5 13:40:05 2018
(r341553)
@@ -1124,7 +1124,12 @@ static int resize_user(struct mlx5_ib_dev *dev, struct
if (ucmd.reserved0 || ucmd.reserved1)
return -EINVAL;
 
-   umem = ib_umem_get(context, ucmd.buf_addr, entries * ucmd.cqe_size,
+   /* check multiplication overflow */
+   if (ucmd.cqe_size && SIZE_MAX / ucmd.cqe_size <= entries - 1)
+   return -EINVAL;
+
+   umem = ib_umem_get(context, ucmd.buf_addr,
+  (size_t)ucmd.cqe_size * entries,
   IB_ACCESS_LOCAL_WRITE, 1);
if (IS_ERR(umem)) {
err = PTR_ERR(umem);
___
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: r341551 - head/sys/dev/mlx4/mlx4_core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:39:05 2018
New Revision: 341551
URL: https://svnweb.freebsd.org/changeset/base/341551

Log:
  mlx4: Make sure default VNET is set when adding a new interface.
  
  Adding an interface might be done outside the device_attach() routine
  and will then cause a panic, due to the VNET not being defined.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_core/mlx4_intf.c

Modified: head/sys/dev/mlx4/mlx4_core/mlx4_intf.c
==
--- head/sys/dev/mlx4/mlx4_core/mlx4_intf.c Wed Dec  5 13:38:35 2018
(r341550)
+++ head/sys/dev/mlx4/mlx4_core/mlx4_intf.c Wed Dec  5 13:39:05 2018
(r341551)
@@ -62,8 +62,11 @@ static void mlx4_add_device(struct mlx4_interface *int
spin_lock_irq(>ctx_lock);
list_add_tail(_ctx->list, >ctx_list);
spin_unlock_irq(>ctx_lock);
-   if (intf->activate)
+   if (intf->activate) {
+   CURVNET_SET_QUIET(vnet0);
intf->activate(>dev, dev_ctx->context);
+   CURVNET_RESTORE();
+   }
} else
kfree(dev_ctx);
 }
___
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: r341552 - head/sys/dev/mlx4/mlx4_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:39:35 2018
New Revision: 341552
URL: https://svnweb.freebsd.org/changeset/base/341552

Log:
  mlx4en: Optimise reception of small packets.
  
  Copy small packets like TCP ACKs into a new mbuf
  reusing the existing mbuf to receive a new ethernet
  frame. This avoids wasting buffer space for
  small sized packets.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c
==
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c  Wed Dec  5 13:39:05 2018
(r341551)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c  Wed Dec  5 13:39:35 2018
(r341552)
@@ -629,6 +629,24 @@ mlx4_en_rx_mb(struct mlx4_en_priv *priv, struct mlx4_e
 #endif
struct mbuf *mb;
 
+   /* optimise reception of small packets */
+   if (length <= (MHLEN - MLX4_NET_IP_ALIGN) &&
+   (mb = m_gethdr(M_NOWAIT, MT_DATA)) != NULL) {
+
+   /* set packet length */
+   mb->m_pkthdr.len = mb->m_len = length;
+
+   /* make sure IP header gets aligned */
+   mb->m_data += MLX4_NET_IP_ALIGN;
+
+   bus_dmamap_sync(ring->dma_tag, mb_list->dma_map,
+   BUS_DMASYNC_POSTREAD);
+
+   bcopy(mtod(mb_list->mbuf, caddr_t), mtod(mb, caddr_t), length);
+
+   return (mb);
+   }
+
/* get mbuf */
mb = mb_list->mbuf;
 
___
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: r341550 - head/sys/dev/mlx4/mlx4_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:38:35 2018
New Revision: 341550
URL: https://svnweb.freebsd.org/changeset/base/341550

Log:
  mlx4en: Remove duplicate statistics variable assignment.
  
  The "priv->pkstats.rx_dropped" is written twice in a row.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c
==
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_port.cWed Dec  5 13:32:46 2018
(r341549)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_port.cWed Dec  5 13:38:35 2018
(r341550)
@@ -256,7 +256,6 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u
priv->pkstats.rx_length_errors = 
be32_to_cpu(mlx4_en_stats->RdropLength);
priv->pkstats.rx_over_errors = be32_to_cpu(mlx4_en_stats->RdropOvflw);
priv->pkstats.rx_crc_errors = be32_to_cpu(mlx4_en_stats->RCRC);
-   priv->pkstats.rx_dropped = be32_to_cpu(mlx4_en_stats->RdropOvflw);
priv->pkstats.tx_dropped = be32_to_cpu(mlx4_en_stats->TDROP);
 
/* RX stats */
___
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: r341542 - head/sys/dev/mlx4/mlx4_core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:29:16 2018
New Revision: 341542
URL: https://svnweb.freebsd.org/changeset/base/341542

Log:
  mlx4core: Avoid multiplication overflow by casting multiplication.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_core/mlx4_icm.c

Modified: head/sys/dev/mlx4/mlx4_core/mlx4_icm.c
==
--- head/sys/dev/mlx4/mlx4_core/mlx4_icm.c  Wed Dec  5 13:28:46 2018
(r341541)
+++ head/sys/dev/mlx4/mlx4_core/mlx4_icm.c  Wed Dec  5 13:29:16 2018
(r341542)
@@ -411,7 +411,7 @@ int mlx4_init_icm_table(struct mlx4_dev *dev, struct m
size = (u64) nobj * obj_size;
for (i = 0; i * MLX4_TABLE_CHUNK_SIZE < reserved * obj_size; ++i) {
chunk_size = MLX4_TABLE_CHUNK_SIZE;
-   if ((i + 1) * MLX4_TABLE_CHUNK_SIZE > size)
+   if ((u64) (i + 1) * MLX4_TABLE_CHUNK_SIZE > size)
chunk_size = PAGE_ALIGN(size -
i * MLX4_TABLE_CHUNK_SIZE);
 
___
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: r341540 - head/contrib/ofed/libibverbs

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:28:17 2018
New Revision: 341540
URL: https://svnweb.freebsd.org/changeset/base/341540

Log:
  libibverbs: Fix memory leak in ibv_read_sysfs_file().
  
  Testing packetdrill using valgrind resulted in finding a memory leak in
  ibv_read_sysfs_file(). The attached patch fixes it.
  
  Submitted by: tuexen@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/contrib/ofed/libibverbs/sysfs.c

Modified: head/contrib/ofed/libibverbs/sysfs.c
==
--- head/contrib/ofed/libibverbs/sysfs.cWed Dec  5 13:27:48 2018
(r341539)
+++ head/contrib/ofed/libibverbs/sysfs.cWed Dec  5 13:28:17 2018
(r341540)
@@ -79,7 +79,7 @@ int ibv_read_sysfs_file(const char *dir, const char *f
char *buf, size_t size)
 {
char *path, *s;
-   int fd;
+   int ret;
size_t len;
 
if (asprintf(, "%s/%s", dir, file) < 0)
@@ -89,11 +89,12 @@ int ibv_read_sysfs_file(const char *dir, const char *f
if (*s == '/')
*s = '.';
 
-len = size;
-if (sysctlbyname([1], buf, , NULL, 0) == -1)
-   return -1;
-
+   len = size;
+   ret = sysctlbyname([1], buf, , NULL, 0);
free(path);
+
+   if (ret == -1)
+   return -1;
 
if (len > 0 && buf[len - 1] == '\n')
buf[--len] = '\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: r341547 - head/sys/dev/mlx4/mlx4_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:31:45 2018
New Revision: 341547
URL: https://svnweb.freebsd.org/changeset/base/341547

Log:
  mlx4en: 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.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_en/en.h
  head/sys/dev/mlx4/mlx4_en/mlx4_en_cq.c
  head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
  head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c

Modified: head/sys/dev/mlx4/mlx4_en/en.h
==
--- head/sys/dev/mlx4/mlx4_en/en.h  Wed Dec  5 13:31:14 2018
(r341546)
+++ head/sys/dev/mlx4/mlx4_en/en.h  Wed Dec  5 13:31:45 2018
(r341547)
@@ -271,10 +271,8 @@ struct mlx4_en_tx_ring {
u32 doorbell_qpn;
u8 *buf;
u16 poll_cnt;
-   int blocked;
struct mlx4_en_tx_info *tx_info;
u8 queue_index;
-   struct buf_ring *br;
u32 last_nr_txbb;
struct mlx4_qp qp;
struct mlx4_qp_context context;
@@ -806,7 +804,6 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
 void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv,
 struct mlx4_en_rx_ring **pring,
 u32 size, u16 stride);
-void mlx4_en_tx_que(void *context, int pending);
 void mlx4_en_rx_que(void *context, int pending);
 int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv);
 void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv,

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_cq.c
==
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_cq.c  Wed Dec  5 13:31:14 2018
(r341546)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_cq.c  Wed Dec  5 13:31:45 2018
(r341547)
@@ -44,6 +44,10 @@ static void mlx4_en_cq_event(struct mlx4_cq *cq, enum 
return;
 }
 
+static void mlx4_en_tx_que(void *arg, int pending)
+{
+
+}
 
 int mlx4_en_create_cq(struct mlx4_en_priv *priv,
  struct mlx4_en_cq **pcq,

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
==
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c  Wed Dec  5 13:31:14 2018
(r341546)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c  Wed Dec  5 13:31:45 2018
(r341547)
@@ -1574,9 +1574,12 @@ static void mlx4_en_restart(struct work_struct *work)
if (priv->blocked == 0 || priv->port_up == 0)
return;
for (i = 0; i < priv->tx_ring_num; i++) {
+   int watchdog_time;
+
ring = priv->tx_ring[i];
-   if (ring->blocked &&
-   ring->watchdog_time + MLX4_EN_WATCHDOG_TIMEOUT 
< ticks)
+   watchdog_time = READ_ONCE(ring->watchdog_time);
+   if (watchdog_time != 0 &&
+   time_after(ticks, ring->watchdog_time))
goto reset;
}
return;

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c
==
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c  Wed Dec  5 13:31:14 2018
(r341546)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c  Wed Dec  5 13:31:45 2018
(r341547)
@@ -94,15 +94,6 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
mtx_init(>tx_lock.m, "mlx4 tx", NULL, MTX_DEF);
mtx_init(>comp_lock.m, "mlx4 comp", NULL, MTX_DEF);
 
-   /* Allocate the buf ring */
-   ring->br = buf_ring_alloc(MLX4_EN_DEF_TX_QUEUE_SIZE, M_DEVBUF,
-   M_WAITOK, >tx_lock.m);
-   if (ring->br == NULL) {
-   en_err(priv, "Failed allocating tx_info ring\n");
-   err = -ENOMEM;
-   goto err_free_dma_tag;
-   }
-
tmp = size * sizeof(struct mlx4_en_tx_info);
ring->tx_info = kzalloc_node(tmp, GFP_KERNEL, node);
if (!ring->tx_info) {
@@ -190,8 +181,6 @@ err_dma_map:
 err_info:
vfree(ring->tx_info);
 err_ring:
-   buf_ring_free(ring->br, M_DEVBUF);
-err_free_dma_tag:
bus_dma_tag_destroy(ring->dma_tag);
 done:
kfree(ring);
@@ -206,7 +195,6 @@ void mlx4_en_destroy_tx_ring(struct mlx4_en_priv *priv
uint32_t x;
en_dbg(DRV, priv, "Destroying tx ring, qpn: %d\n", ring->qpn);
 
-   buf_ring_free(ring->br, M_DEVBUF);
if (ring->bf_enabled)
mlx4_bf_free(mdev->dev, >bf);
mlx4_qp_remove(mdev->dev, >qp);
@@ -236,8 +224,8 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv
ring->cons = 0x;
ring->last_nr_txbb = 1;
ring->poll_cnt = 0;

svn commit: r341549 - head/sys/dev/mlx4/mlx4_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:32:46 2018
New Revision: 341549
URL: https://svnweb.freebsd.org/changeset/base/341549

Log:
  mlx4en: Add support for receiving all data using one or more MCLBYTES sized 
mbufs.
  Also when the MTU is greater than MCLBYTES.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_en/en.h
  head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
  head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c

Modified: head/sys/dev/mlx4/mlx4_en/en.h
==
--- head/sys/dev/mlx4/mlx4_en/en.h  Wed Dec  5 13:32:15 2018
(r341548)
+++ head/sys/dev/mlx4/mlx4_en/en.h  Wed Dec  5 13:32:46 2018
(r341549)
@@ -75,6 +75,15 @@
 #define MAX_RX_RINGS   128
 #define MIN_RX_RINGS   4
 #define TXBB_SIZE  64
+
+#ifndef MLX4_EN_MAX_RX_SEGS
+#defineMLX4_EN_MAX_RX_SEGS 1   /* or 8 */
+#endif
+
+#ifndef MLX4_EN_MAX_RX_BYTES
+#defineMLX4_EN_MAX_RX_BYTES MCLBYTES
+#endif
+
 #define HEADROOM   (2048 / TXBB_SIZE + 1)
 #define INIT_OWNER_BIT 0x
 #define STAMP_STRIDE   64
@@ -297,10 +306,12 @@ struct mlx4_en_tx_ring {
 };
 
 struct mlx4_en_rx_desc {
-   /* actual number of entries depends on rx ring stride */
-   struct mlx4_wqe_data_seg data[0];
+   struct mlx4_wqe_data_seg data[MLX4_EN_MAX_RX_SEGS];
 };
 
+/* the size of the structure above must be power of two */
+CTASSERT(powerof2(sizeof(struct mlx4_en_rx_desc)));
+
 struct mlx4_en_rx_mbuf {
bus_dmamap_t dma_map;
struct mbuf *mbuf;
@@ -309,7 +320,7 @@ struct mlx4_en_rx_mbuf {
 struct mlx4_en_rx_spare {
bus_dmamap_t dma_map;
struct mbuf *mbuf;
-   u64 paddr_be;
+   bus_dma_segment_t segs[MLX4_EN_MAX_RX_SEGS];
 };
 
 struct mlx4_en_rx_ring {
@@ -319,7 +330,6 @@ struct mlx4_en_rx_ring {
u32 size ;  /* number of Rx descs*/
u32 actual_size;
u32 size_mask;
-   u16 stride;
u16 log_stride;
u16 cqn;/* index of port CQ associated with this ring */
u32 prod;
@@ -327,6 +337,7 @@ struct mlx4_en_rx_ring {
u32 buf_size;
u8  fcs_del;
u32 rx_mb_size;
+   u32 rx_mr_key_be;
int qpn;
u8 *buf;
struct mlx4_en_rx_mbuf *mbuf;
@@ -559,7 +570,6 @@ struct mlx4_en_priv {
int registered;
int gone;
int allocated;
-   int stride;
unsigned char current_mac[ETH_ALEN + 2];
 u64 mac;
int mac_index;
@@ -805,7 +815,7 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
   u32 size, int node);
 void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv,
 struct mlx4_en_rx_ring **pring,
-u32 size, u16 stride);
+u32 size);
 void mlx4_en_rx_que(void *context, int pending);
 int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv);
 void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv,

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
==
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c  Wed Dec  5 13:32:15 2018
(r341548)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c  Wed Dec  5 13:32:46 2018
(r341549)
@@ -1683,7 +1683,7 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv)
for (i = 0; i < priv->rx_ring_num; i++) {
if (priv->rx_ring[i])
mlx4_en_destroy_rx_ring(priv, >rx_ring[i],
-   priv->prof->rx_ring_size, priv->stride);
+   priv->prof->rx_ring_size);
if (priv->rx_cq[i])
mlx4_en_destroy_cq(priv, >rx_cq[i]);
}
@@ -1734,8 +1734,7 @@ err:
for (i = 0; i < priv->rx_ring_num; i++) {
if (priv->rx_ring[i])
mlx4_en_destroy_rx_ring(priv, >rx_ring[i],
-   prof->rx_ring_size,
-   priv->stride);
+   prof->rx_ring_size);
if (priv->rx_cq[i])
mlx4_en_destroy_cq(priv, >rx_cq[i]);
}
@@ -2236,9 +2235,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int 
 err = -EINVAL;
 goto out;
 }
-
-   priv->stride = roundup_pow_of_two(sizeof(struct mlx4_en_rx_desc) +
- DS_SIZE);
 
mlx4_en_sysctl_conf(priv);
 

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c
==
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c  Wed Dec  5 13:32:15 2018
(r341548)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c  Wed 

svn commit: r341548 - in head/sys/dev/mlx4: . mlx4_core mlx4_en

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:32:15 2018
New Revision: 341548
URL: https://svnweb.freebsd.org/changeset/base/341548

Log:
  mlx4en: Add support for netdump.
  
  Implement the needed callback functions and support for polling the driver.
  
  Differential Revision: https://reviews.freebsd.org/D15259
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx4/driver.h
  head/sys/dev/mlx4/mlx4_core/mlx4_eq.c
  head/sys/dev/mlx4/mlx4_en/en.h
  head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
  head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c

Modified: head/sys/dev/mlx4/driver.h
==
--- head/sys/dev/mlx4/driver.h  Wed Dec  5 13:31:45 2018(r341547)
+++ head/sys/dev/mlx4/driver.h  Wed Dec  5 13:32:15 2018(r341548)
@@ -101,4 +101,7 @@ static inline u64 mlx4_mac_to_u64(const u8 *addr)
return mac;
 }
 
+void mlx4_disable_interrupts(struct mlx4_dev *);
+void mlx4_poll_interrupts(struct mlx4_dev *);
+
 #endif /* MLX4_DRIVER_H */

Modified: head/sys/dev/mlx4/mlx4_core/mlx4_eq.c
==
--- head/sys/dev/mlx4/mlx4_core/mlx4_eq.c   Wed Dec  5 13:31:45 2018
(r341547)
+++ head/sys/dev/mlx4/mlx4_core/mlx4_eq.c   Wed Dec  5 13:32:15 2018
(r341548)
@@ -1535,3 +1535,34 @@ void mlx4_release_eq(struct mlx4_dev *dev, int vec)
 }
 EXPORT_SYMBOL(mlx4_release_eq);
 
+void
+mlx4_disable_interrupts(struct mlx4_dev *dev)
+{
+   struct mlx4_priv *priv = container_of(dev, struct mlx4_priv, dev);
+   int i;
+
+   if (dev->flags & MLX4_FLAG_MSI_X) {
+   for (i = 0; i < (dev->caps.num_comp_vectors + 1); ++i)
+   disable_irq(priv->eq_table.eq[i].irq);
+   } else {
+   disable_irq(dev->persist->pdev->irq);
+   }
+}
+EXPORT_SYMBOL(mlx4_disable_interrupts);
+
+void
+mlx4_poll_interrupts(struct mlx4_dev *dev)
+{
+   struct mlx4_priv *priv = container_of(dev, struct mlx4_priv, dev);
+   int i;
+
+   if (dev->flags & MLX4_FLAG_MSI_X) {
+   for (i = 0; i < (dev->caps.num_comp_vectors + 1); ++i) {
+   mlx4_msi_x_interrupt(priv->eq_table.eq[i].irq,
+priv->eq_table.eq + i);
+   }
+   } else {
+   mlx4_interrupt(dev->persist->pdev->irq, dev);
+   }
+}
+EXPORT_SYMBOL(mlx4_poll_interrupts);

Modified: head/sys/dev/mlx4/mlx4_en/en.h
==
--- head/sys/dev/mlx4/mlx4_en/en.h  Wed Dec  5 13:31:45 2018
(r341547)
+++ head/sys/dev/mlx4/mlx4_en/en.h  Wed Dec  5 13:32:15 2018
(r341548)
@@ -54,6 +54,7 @@
 #include 
 
 #include 
+#include 
 
 #include "en_port.h"
 #include 
@@ -784,6 +785,7 @@ int mlx4_en_arm_cq(struct mlx4_en_priv *priv, struct m
 void mlx4_en_tx_irq(struct mlx4_cq *mcq);
 u16 mlx4_en_select_queue(struct net_device *dev, struct mbuf *mb);
 
+int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **mbp);
 int mlx4_en_transmit(struct ifnet *dev, struct mbuf *m);
 int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
   struct mlx4_en_tx_ring **pring,

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
==
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c  Wed Dec  5 13:31:45 2018
(r341547)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c  Wed Dec  5 13:32:15 2018
(r341548)
@@ -53,6 +53,8 @@
 #include "en.h"
 #include "en_port.h"
 
+NETDUMP_DEFINE(mlx4_en);
+
 static void mlx4_en_sysctl_stat(struct mlx4_en_priv *priv);
 static void mlx4_en_sysctl_conf(struct mlx4_en_priv *priv);
 
@@ -2311,6 +2313,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int 
ifmedia_add(>media, IFM_ETHER | IFM_AUTO, 0, NULL);
ifmedia_set(>media, IFM_ETHER | IFM_AUTO);
 
+   NETDUMP_SET(dev, mlx4_en);
+
en_warn(priv, "Using %d TX rings\n", prof->tx_ring_num);
en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num);
 
@@ -2892,3 +2896,54 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p
CTLFLAG_RD, _ring->errors, 0, "RX soft errors");
}
 }
+
+#ifdef NETDUMP
+static void
+mlx4_en_netdump_init(struct ifnet *dev, int *nrxr, int *ncl, int *clsize)
+{
+   struct mlx4_en_priv *priv;
+
+   priv = if_getsoftc(dev);
+   mutex_lock(>mdev->state_lock);
+   *nrxr = priv->rx_ring_num;
+   *ncl = NETDUMP_MAX_IN_FLIGHT;
+   *clsize = priv->rx_mb_size;
+   mutex_unlock(>mdev->state_lock);
+}
+
+static void
+mlx4_en_netdump_event(struct ifnet *dev, enum netdump_ev event)
+{
+}
+
+static int
+mlx4_en_netdump_transmit(struct ifnet *dev, struct mbuf *m)
+{
+   struct mlx4_en_priv *priv;
+   int err;
+
+   priv = if_getsoftc(dev);

svn commit: r341536 - head/sys/ofed/drivers/infiniband/ulp/ipoib

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:26:17 2018
New Revision: 341536
URL: https://svnweb.freebsd.org/changeset/base/341536

Log:
  ipoib: Don't do a light flush when MTU is unchanged.
  
  When changing the MTU of ibX network interfaces, check that the MTU was really
  changed before requesting an update of the multicast rules. Else we might go
  into an infinite loop joining and leaving ibX multicast groups towards the
  opensm master interface.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c

Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
==
--- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Dec  5 
13:25:47 2018(r341535)
+++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Dec  5 
13:26:17 2018(r341536)
@@ -305,9 +305,11 @@ ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_
priv->admin_mtu = new_mtu;
error = ipoib_propagate_ifnet_mtu(priv, min(priv->mcast_mtu,
priv->admin_mtu), propagate);
-   if (error == 0)
-   queue_work(ipoib_workqueue, >flush_light);
-   else
+   if (error == 0) {
+   /* check for MTU change to avoid infinite loop */
+   if (prev_admin_mtu != new_mtu)
+   queue_work(ipoib_workqueue, >flush_light);
+   } else
priv->admin_mtu = prev_admin_mtu;
return (error);
 }
___
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: r341546 - head/sys/dev/mlx4/mlx4_core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:31:14 2018
New Revision: 341546
URL: https://svnweb.freebsd.org/changeset/base/341546

Log:
  mlx4en: Add driver version to sysctl desc
  
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_core/mlx4_main.c

Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c
==
--- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec  5 13:30:48 2018
(r341545)
+++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec  5 13:31:14 2018
(r341546)
@@ -121,6 +121,9 @@ MODULE_PARM_DESC(enable_4k_uar,
 
 #define RESET_PERSIST_MASK_FLAGS   (MLX4_FLAG_SRIOV)
 
+static char mlx4_description[] = "Mellanox driver"
+" (" DRV_VERSION ")";
+
 static char mlx4_version[] =
DRV_NAME ": Mellanox ConnectX core driver v"
DRV_VERSION " (" DRV_RELDATE ")\n";
@@ -3780,6 +3783,7 @@ static int mlx4_init_one(struct pci_dev *pdev, const s
kfree(priv);
return ret;
} else {
+   device_set_desc(pdev->dev.bsddev, mlx4_description);
pci_save_state(pdev->dev.bsddev);
}
 
@@ -3907,6 +3911,13 @@ static void mlx4_remove_one(struct pci_dev *pdev)
mutex_lock(>interface_state_mutex);
persist->interface_state |= MLX4_INTERFACE_STATE_DELETION;
mutex_unlock(>interface_state_mutex);
+
+   /*
+* Clear the device description to avoid use after free,
+* because the bsddev is not destroyed when this module is
+* unloaded:
+*/
+   device_set_desc(pdev->dev.bsddev, NULL);
 
/* Disabling SR-IOV is not allowed while there are active vf's */
if (mlx4_is_master(dev) && dev->flags & MLX4_FLAG_SRIOV) {
___
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: r341545 - in head/sys/dev/mlx4: . mlx4_core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:30:48 2018
New Revision: 341545
URL: https://svnweb.freebsd.org/changeset/base/341545

Log:
  mlx4: Add board identifier and firmware version to sysctl
  
  In last mlx4 update (r325841) we lost the sysctl to show the
  firmware version for mlx4 devices.
  Add both board identifier and firmware version under:
  sys.device.mlx4_core0.hw sysctl node.
  
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx4/device.h
  head/sys/dev/mlx4/mlx4_core/mlx4_main.c

Modified: head/sys/dev/mlx4/device.h
==
--- head/sys/dev/mlx4/device.h  Wed Dec  5 13:30:16 2018(r341544)
+++ head/sys/dev/mlx4/device.h  Wed Dec  5 13:30:48 2018(r341545)
@@ -877,6 +877,8 @@ struct mlx4_dev {
u64 regid_allmulti_array[MLX4_MAX_PORTS + 1];
struct mlx4_vf_dev *dev_vfs;
u8  uar_page_shift;
+   struct sysctl_ctx_list  hw_ctx;
+   charfw_str[64];
 };
 
 struct mlx4_clock_params {

Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c
==
--- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec  5 13:30:16 2018
(r341544)
+++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec  5 13:30:48 2018
(r341545)
@@ -1893,6 +1893,7 @@ static void unmap_internal_clock(struct mlx4_dev *dev)
 
 static void mlx4_close_hca(struct mlx4_dev *dev)
 {
+   sysctl_ctx_free(>hw_ctx);
unmap_internal_clock(dev);
unmap_bf_area(dev);
if (mlx4_is_slave(dev))
@@ -3745,10 +3746,14 @@ err_disable_pdev:
 
 static int mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 {
-   struct mlx4_priv *priv;
-   struct mlx4_dev *dev;
-   int ret;
 
+   struct sysctl_ctx_list  *ctx;
+   struct sysctl_oid   *node;
+   struct sysctl_oid_list  *node_list;
+   struct mlx4_priv*priv;
+   struct mlx4_dev *dev;
+   int ret;
+
printk_once(KERN_INFO "%s", mlx4_version);
 
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
@@ -3773,8 +3778,28 @@ static int mlx4_init_one(struct pci_dev *pdev, const s
if (ret) {
kfree(dev->persist);
kfree(priv);
+   return ret;
} else {
pci_save_state(pdev->dev.bsddev);
+   }
+
+   snprintf(dev->fw_str, sizeof(dev->fw_str), "%d.%d.%d",
+(int) (dev->caps.fw_ver >> 32),
+(int) (dev->caps.fw_ver >> 16) & 0x,
+(int) (dev->caps.fw_ver & 0x));
+
+   ctx = >hw_ctx;
+   sysctl_ctx_init(ctx);
+   node = SYSCTL_ADD_NODE(ctx,SYSCTL_CHILDREN(pdev->dev.kobj.oidp),
+   OID_AUTO, "hw" , CTLFLAG_RD, 0, "mlx4 dev hw information");
+   if (node != NULL) {
+   node_list = SYSCTL_CHILDREN(node);
+   SYSCTL_ADD_STRING(ctx, node_list, OID_AUTO,
+   "fw_version", CTLFLAG_RD, dev->fw_str, 0,
+   "Device firmware version");
+   SYSCTL_ADD_STRING(ctx, node_list, OID_AUTO,
+   "board_id", CTLFLAG_RD, dev->board_id, 0,
+   "Device board identifier");
}
 
return ret;
___
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: r341534 - head/sys/ofed/drivers/infiniband/core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:25:13 2018
New Revision: 341534
URL: https://svnweb.freebsd.org/changeset/base/341534

Log:
  ibcore: Fix clearing of bound device interface.
  
  Binding to a loopback device is not allowed. Make sure the destination
  device address is global by clearing the bound device interface.
  Only do this conditionally, else link local addresses won't work.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/ofed/drivers/infiniband/core/ib_addr.c

Modified: head/sys/ofed/drivers/infiniband/core/ib_addr.c
==
--- head/sys/ofed/drivers/infiniband/core/ib_addr.c Wed Dec  5 13:24:43 
2018(r341533)
+++ head/sys/ofed/drivers/infiniband/core/ib_addr.c Wed Dec  5 13:25:13 
2018(r341534)
@@ -649,8 +649,13 @@ static int addr_resolve_neigh(struct ifnet *dev,
if (dev->if_flags & IFF_LOOPBACK) {
int ret;
 
-   /* find real device, not loopback one */
-   addr->bound_dev_if = 0;
+   /*
+* Binding to a loopback device is not allowed. Make
+* sure the destination device address is global by
+* clearing the bound device interface:
+*/
+   if (addr->bound_dev_if == dev->if_index)
+   addr->bound_dev_if = 0;
 
ret = rdma_translate_ip(dst_in, addr);
if (ret == 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: r341533 - in head/sys: compat/linuxkpi/common/include/linux ofed/drivers/infiniband/core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:24:43 2018
New Revision: 341533
URL: https://svnweb.freebsd.org/changeset/base/341533

Log:
  ibcore: ip6_dev_find() needs to know the scope ID.
  
  Else the wrong network device can be returned for link-local addresses.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/inetdevice.h
  head/sys/ofed/drivers/infiniband/core/ib_addr.c
  head/sys/ofed/drivers/infiniband/core/ib_cma.c

Modified: head/sys/compat/linuxkpi/common/include/linux/inetdevice.h
==
--- head/sys/compat/linuxkpi/common/include/linux/inetdevice.h  Wed Dec  5 
13:24:12 2018(r341532)
+++ head/sys/compat/linuxkpi/common/include/linux/inetdevice.h  Wed Dec  5 
13:24:43 2018(r341533)
@@ -59,37 +59,32 @@ ip_dev_find(struct vnet *vnet, uint32_t addr)
 }
 
 static inline struct net_device *
-ip6_dev_find(struct vnet *vnet, struct in6_addr addr)
+ip6_dev_find(struct vnet *vnet, struct in6_addr addr, uint16_t scope_id)
 {
struct sockaddr_in6 sin6;
-   struct ifaddr *ifa = NULL;
-   struct ifnet *ifp = NULL;
-   int x;
+   struct ifaddr *ifa;
+   struct ifnet *ifp;
 
memset(, 0, sizeof(sin6));
sin6.sin6_addr = addr;
sin6.sin6_len = sizeof(sin6);
sin6.sin6_family = AF_INET6;
-   NET_EPOCH_ENTER();
-   CURVNET_SET_QUIET(vnet);
if (IN6_IS_SCOPE_LINKLOCAL() ||
IN6_IS_ADDR_MC_INTFACELOCAL()) {
-   /* XXX need to search all scope ID's */
-   for (x = 0; x <= V_if_index && x < 65536; x++) {
-   sin6.sin6_addr.s6_addr16[1] = htons(x);
-   ifa = ifa_ifwithaddr((struct sockaddr *));
-   if (ifa != NULL)
-   break;
-   }
-   } else {
-   ifa = ifa_ifwithaddr((struct sockaddr *));
+   /* embed the IPv6 scope ID */
+   sin6.sin6_addr.s6_addr16[1] = htons(scope_id);
}
+   NET_EPOCH_ENTER();
+   CURVNET_SET_QUIET(vnet);
+   ifa = ifa_ifwithaddr((struct sockaddr *));
+   CURVNET_RESTORE();
if (ifa != NULL) {
ifp = ifa->ifa_ifp;
if_ref(ifp);
+   } else {
+   ifp = NULL;
}
NET_EPOCH_EXIT();
-   CURVNET_RESTORE();
return (ifp);
 }
 

Modified: head/sys/ofed/drivers/infiniband/core/ib_addr.c
==
--- head/sys/ofed/drivers/infiniband/core/ib_addr.c Wed Dec  5 13:24:12 
2018(r341532)
+++ head/sys/ofed/drivers/infiniband/core/ib_addr.c Wed Dec  5 13:24:43 
2018(r341533)
@@ -185,7 +185,7 @@ int rdma_translate_ip(const struct sockaddr *addr,
 #ifdef INET6
case AF_INET6:
dev = ip6_dev_find(dev_addr->net,
-   ((const struct sockaddr_in6 *)addr)->sin6_addr);
+   ((const struct sockaddr_in6 *)addr)->sin6_addr, 0);
break;
 #endif
default:
@@ -525,7 +525,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
if (addr->bound_dev_if != 0) {
ifp = dev_get_by_index(addr->net, addr->bound_dev_if);
} else {
-   ifp = ip6_dev_find(addr->net, src_in->sin6_addr);
+   ifp = ip6_dev_find(addr->net, src_in->sin6_addr, 0);
}
 
/* check source interface */

Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c
==
--- head/sys/ofed/drivers/infiniband/core/ib_cma.c  Wed Dec  5 13:24:12 
2018(r341532)
+++ head/sys/ofed/drivers/infiniband/core/ib_cma.c  Wed Dec  5 13:24:43 
2018(r341533)
@@ -1329,7 +1329,8 @@ static bool validate_ipv6_net_dev(struct net_device *n
struct rtentry *rte;
bool ret;
 
-   dst_dev = ip6_dev_find(net_dev->if_vnet, dst_tmp.sin6_addr);
+   dst_dev = ip6_dev_find(net_dev->if_vnet, dst_tmp.sin6_addr,
+   net_dev->if_index);
if (dst_dev != net_dev) {
if (dst_dev != NULL)
dev_put(dst_dev);
___
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: r341544 - head/sys/dev/mlx4/mlx4_core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:30:16 2018
New Revision: 341544
URL: https://svnweb.freebsd.org/changeset/base/341544

Log:
  mlx4core: Add checks for invalid port numbers.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c

Modified: head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c
==
--- head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c  Wed Dec  5 13:29:46 2018
(r341543)
+++ head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c  Wed Dec  5 13:30:16 2018
(r341544)
@@ -961,6 +961,8 @@ static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, 
if (!err && slave != mlx4_master_func_num(dev)) 
{
u8 *state = outsmp->data + 
PORT_STATE_OFFSET;
 
+   if (port < 1 || port > 
dev->caps.num_ports)
+   return -EINVAL;
*state = (*state & 0xf0) | 
vf_port_state(dev, port, slave);
slave_cap_mask = 
priv->mfunc.master.slave_state[slave].ib_cap_mask[port];
memcpy(outsmp->data + 
PORT_CAPABILITY_LOCATION_IN_SMP, _cap_mask, 4);
@@ -968,8 +970,12 @@ static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, 
return err;
}
if (smp->attr_id == IB_SMP_ATTR_GUID_INFO) {
-   __be64 guid = mlx4_get_admin_guid(dev, slave,
- port);
+   __be64 guid;
+
+   if (port < 1 || port > dev->caps.num_ports)
+   return -EINVAL;
+
+   guid = mlx4_get_admin_guid(dev, slave, port);
 
/* set the PF admin guid to the FW/HW burned
 * GUID, if it wasn't yet set
___
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: r341543 - head/sys/dev/mlx4/mlx4_core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:29:46 2018
New Revision: 341543
URL: https://svnweb.freebsd.org/changeset/base/341543

Log:
  mlx4: Zero initialize device capabilities to avoid use of uninitialized 
fields.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_core/mlx4_main.c

Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c
==
--- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec  5 13:29:16 2018
(r341542)
+++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec  5 13:29:46 2018
(r341543)
@@ -2208,7 +2208,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
 {
struct mlx4_priv  *priv = mlx4_priv(dev);
struct mlx4_adapteradapter;
-   struct mlx4_dev_capdev_cap;
+   struct mlx4_dev_capdev_cap = {};
struct mlx4_profileprofile;
struct mlx4_init_hca_param init_hca;
u64 icm_size;
___
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: r341532 - head/sys/ofed/drivers/infiniband/core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:24:12 2018
New Revision: 341532
URL: https://svnweb.freebsd.org/changeset/base/341532

Log:
  ibcore: Fix sleeping in atomic when RoCE is used
  
  A couple of places in the CM do
  
  spin_lock_irq(_id_priv->lock);
  ...
  if (cm_alloc_response_msg(work->port, work->mad_recv_wc, ))
  
  However when the underlying transport is RoCE, this leads to a sleeping 
function
  being called with the lock held - the callchain is
  
  cm_alloc_response_msg() ->
ib_create_ah_from_wc() ->
  ib_init_ah_from_wc() ->
rdma_addr_find_l2_eth_by_grh() ->
  rdma_resolve_ip()
  
  and rdma_resolve_ip() starts out by doing
  
  req = kzalloc(sizeof *req, GFP_KERNEL);
  
  not to mention rdma_addr_find_l2_eth_by_grh() doing
  
  wait_for_completion();
  
  to wait for the task that rdma_resolve_ip() queues up.
  
  Fix this by moving the AH creation out of the lock.
  
  Linux commit:
  c76161181193985087cd716fdf69b5cb6cf9ee85
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/ofed/drivers/infiniband/core/ib_cm.c

Modified: head/sys/ofed/drivers/infiniband/core/ib_cm.c
==
--- head/sys/ofed/drivers/infiniband/core/ib_cm.c   Wed Dec  5 13:23:44 
2018(r341531)
+++ head/sys/ofed/drivers/infiniband/core/ib_cm.c   Wed Dec  5 13:24:12 
2018(r341532)
@@ -332,11 +332,19 @@ out:
return ret;
 }
 
-static int cm_alloc_response_msg(struct cm_port *port,
-struct ib_mad_recv_wc *mad_recv_wc,
-struct ib_mad_send_buf **msg)
+static struct ib_mad_send_buf *cm_alloc_response_msg_no_ah(struct cm_port 
*port,
+  struct 
ib_mad_recv_wc *mad_recv_wc)
 {
-   struct ib_mad_send_buf *m;
+   return ib_create_send_mad(port->mad_agent, 1, 
mad_recv_wc->wc->pkey_index,
+ 0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA,
+ GFP_ATOMIC,
+ IB_MGMT_BASE_VERSION);
+}
+
+static int cm_create_response_msg_ah(struct cm_port *port,
+struct ib_mad_recv_wc *mad_recv_wc,
+struct ib_mad_send_buf *msg)
+{
struct ib_ah *ah;
 
ah = ib_create_ah_from_wc(port->mad_agent->qp->pd, mad_recv_wc->wc,
@@ -344,27 +352,40 @@ static int cm_alloc_response_msg(struct cm_port *port,
if (IS_ERR(ah))
return PTR_ERR(ah);
 
-   m = ib_create_send_mad(port->mad_agent, 1, mad_recv_wc->wc->pkey_index,
-  0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA,
-  GFP_ATOMIC,
-  IB_MGMT_BASE_VERSION);
-   if (IS_ERR(m)) {
-   ib_destroy_ah(ah);
-   return PTR_ERR(m);
-   }
-   m->ah = ah;
-   *msg = m;
+   msg->ah = ah;
return 0;
 }
 
 static void cm_free_msg(struct ib_mad_send_buf *msg)
 {
-   ib_destroy_ah(msg->ah);
+   if (msg->ah)
+   ib_destroy_ah(msg->ah);
if (msg->context[0])
cm_deref_id(msg->context[0]);
ib_free_send_mad(msg);
 }
 
+static int cm_alloc_response_msg(struct cm_port *port,
+struct ib_mad_recv_wc *mad_recv_wc,
+struct ib_mad_send_buf **msg)
+{
+   struct ib_mad_send_buf *m;
+   int ret;
+
+   m = cm_alloc_response_msg_no_ah(port, mad_recv_wc);
+   if (IS_ERR(m))
+   return PTR_ERR(m);
+
+   ret = cm_create_response_msg_ah(port, mad_recv_wc, m);
+   if (ret) {
+   cm_free_msg(m);
+   return ret;
+   }
+
+   *msg = m;
+   return 0;
+}
+
 static void * cm_copy_private_data(const void *private_data,
   u8 private_data_len)
 {
@@ -2331,7 +2352,8 @@ static int cm_dreq_handler(struct cm_work *work)
case IB_CM_TIMEWAIT:
atomic_long_inc(>port->counter_group[CM_RECV_DUPLICATES].
counter[CM_DREQ_COUNTER]);
-   if (cm_alloc_response_msg(work->port, work->mad_recv_wc, ))
+   msg = cm_alloc_response_msg_no_ah(work->port, 
work->mad_recv_wc);
+   if (IS_ERR(msg))
goto unlock;
 
cm_format_drep((struct cm_drep_msg *) msg->mad, cm_id_priv,
@@ -2339,7 +2361,8 @@ static int cm_dreq_handler(struct cm_work *work)
   cm_id_priv->private_data_len);
spin_unlock_irq(_id_priv->lock);
 
-   if (ib_post_send_mad(msg, NULL))
+   if (cm_create_response_msg_ah(work->port, work->mad_recv_wc, 
msg) ||
+   ib_post_send_mad(msg, NULL))
  

svn commit: r341531 - head/sys/ofed/drivers/infiniband/core

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:23:44 2018
New Revision: 341531
URL: https://svnweb.freebsd.org/changeset/base/341531

Log:
  ibcore: Add missing unref of netdevice.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/ofed/drivers/infiniband/core/ib_cma.c

Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c
==
--- head/sys/ofed/drivers/infiniband/core/ib_cma.c  Wed Dec  5 13:23:14 
2018(r341530)
+++ head/sys/ofed/drivers/infiniband/core/ib_cma.c  Wed Dec  5 13:23:44 
2018(r341531)
@@ -1335,6 +1335,7 @@ static bool validate_ipv6_net_dev(struct net_device *n
dev_put(dst_dev);
return false;
}
+   dev_put(dst_dev);
 
CURVNET_SET(net_dev->if_vnet);
 
___
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: r341539 - head/sys/contrib/rdma/krping

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:27:48 2018
New Revision: 341539
URL: https://svnweb.freebsd.org/changeset/base/341539

Log:
  krping: Fix for memory leak in error case.
  
  Submitted by:   hselasky@
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/contrib/rdma/krping/krping_dev.c

Modified: head/sys/contrib/rdma/krping/krping_dev.c
==
--- head/sys/contrib/rdma/krping/krping_dev.c   Wed Dec  5 13:27:17 2018
(r341538)
+++ head/sys/contrib/rdma/krping/krping_dev.c   Wed Dec  5 13:27:48 2018
(r341539)
@@ -187,7 +187,7 @@ krping_write(struct cdev *dev, struct uio *uio, int io
err = uiomove(cp, amt, uio);
if (err) {
uprintf("Write failed: bad address!\n");
-   return err;
+   goto done;
}
cp += amt;
remain -= amt;
@@ -195,7 +195,8 @@ krping_write(struct cdev *dev, struct uio *uio, int io
 
if (uio->uio_resid != 0) {
uprintf("Message too big. max size is %d!\n", BUFFERSIZE);
-   return EMSGSIZE;
+   err = EMSGSIZE;
+   goto done;
}
 
/* null terminate and remove the \n */
@@ -204,6 +205,7 @@ krping_write(struct cdev *dev, struct uio *uio, int io
krpingmsg->len = (unsigned long)(cp - krpingmsg->msg);
uprintf("krping: write string = |%s|\n", krpingmsg->msg);
err = krping_doit(krpingmsg->msg);
+done:
free(krpingmsg, M_DEVBUF);
return(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: r341541 - head/contrib/ofed/opensm/opensm

2018-12-05 Thread Slava Shwartsman
Author: slavash
Date: Wed Dec  5 13:28:46 2018
New Revision: 341541
URL: https://svnweb.freebsd.org/changeset/base/341541

Log:
  opensm: Use precision specifier for scanf
  
  If user input a string larger than the length of buffer, the stack
  memory will be corrupted.
  
  Approved by:hselasky (mentor)
  MFC after:  1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/contrib/ofed/opensm/opensm/main.c

Modified: head/contrib/ofed/opensm/opensm/main.c
==
--- head/contrib/ofed/opensm/opensm/main.c  Wed Dec  5 13:28:17 2018
(r341540)
+++ head/contrib/ofed/opensm/opensm/main.c  Wed Dec  5 13:28:46 2018
(r341541)
@@ -492,7 +492,7 @@ static ib_net64_t get_port_guid(IN osm_opensm_t * p_os
fflush(stdout);
if (scanf("%u", ) <= 0) {
char junk[128];
-   if (scanf("%s", junk) <= 0)
+   if (scanf("%127s", junk) <= 0)
printf("\nError: Cannot scan!\n");
} else if (choice == 0)
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"


  1   2   >