svn commit: r278221 - in head/sys/dev/sfxge: . common

2015-02-04 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Feb  4 20:03:57 2015
New Revision: 278221
URL: https://svnweb.freebsd.org/changeset/base/278221

Log:
  sfxge: Add macros to init, destroy, acquire, release and assert locks
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efsys.h
  head/sys/dev/sfxge/sfxge.c
  head/sys/dev/sfxge/sfxge.h
  head/sys/dev/sfxge/sfxge_ev.c
  head/sys/dev/sfxge/sfxge_mcdi.c
  head/sys/dev/sfxge/sfxge_port.c
  head/sys/dev/sfxge/sfxge_rx.c
  head/sys/dev/sfxge/sfxge_tx.c
  head/sys/dev/sfxge/sfxge_tx.h

Modified: head/sys/dev/sfxge/common/efsys.h
==
--- head/sys/dev/sfxge/common/efsys.h   Wed Feb  4 19:58:54 2015
(r278220)
+++ head/sys/dev/sfxge/common/efsys.h   Wed Feb  4 20:03:57 2015
(r278221)
@@ -517,6 +517,15 @@ typedef struct efsys_bar_s {
struct resource *esb_res;
 } efsys_bar_t;
 
+#defineSFXGE_BAR_LOCK_INIT(_esbp, _name)   
\
+   mtx_init((_esbp)-esb_lock, (_name), NULL, MTX_DEF)
+#defineSFXGE_BAR_LOCK_DESTROY(_esbp)   
\
+   mtx_destroy((_esbp)-esb_lock)
+#defineSFXGE_BAR_LOCK(_esbp)   
\
+   mtx_lock((_esbp)-esb_lock)
+#defineSFXGE_BAR_UNLOCK(_esbp) 
\
+   mtx_unlock((_esbp)-esb_lock)
+
 #defineEFSYS_BAR_READD(_esbp, _offset, _edp, _lock)
\
do {\
_NOTE(CONSTANTCONDITION)\
@@ -525,7 +534,7 @@ typedef struct efsys_bar_s {
\
_NOTE(CONSTANTCONDITION)\
if (_lock)  \
-   mtx_lock(((_esbp)-esb_lock)); \
+   SFXGE_BAR_LOCK(_esbp);  \
\
(_edp)-ed_u32[0] = bus_space_read_4((_esbp)-esb_tag,  \
(_esbp)-esb_handle, (_offset));\
@@ -535,7 +544,7 @@ typedef struct efsys_bar_s {
\
_NOTE(CONSTANTCONDITION)\
if (_lock)  \
-   mtx_unlock(((_esbp)-esb_lock));   \
+   SFXGE_BAR_UNLOCK(_esbp);\
_NOTE(CONSTANTCONDITION)\
} while (B_FALSE)
 
@@ -545,7 +554,7 @@ typedef struct efsys_bar_s {
KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)),\
(not power of 2 aligned));\
\
-   mtx_lock(((_esbp)-esb_lock)); \
+   SFXGE_BAR_LOCK(_esbp);  \
\
(_eqp)-eq_u32[0] = bus_space_read_4((_esbp)-esb_tag,  \
(_esbp)-esb_handle, (_offset));\
@@ -556,7 +565,7 @@ typedef struct efsys_bar_s {
uint32_t, (_eqp)-eq_u32[1],\
uint32_t, (_eqp)-eq_u32[0]);   \
\
-   mtx_unlock(((_esbp)-esb_lock));   \
+   SFXGE_BAR_UNLOCK(_esbp);\
_NOTE(CONSTANTCONDITION)\
} while (B_FALSE)
 
@@ -568,7 +577,7 @@ typedef struct efsys_bar_s {
\
_NOTE(CONSTANTCONDITION)\
if (_lock)  \
-   mtx_lock(((_esbp)-esb_lock)); \
+   SFXGE_BAR_LOCK(_esbp);  \
\
(_eop)-eo_u32[0] = bus_space_read_4((_esbp)-esb_tag,  \
(_esbp)-esb_handle, (_offset));\
@@ -587,7 +596,7 @@ typedef struct efsys_bar_s {
\
_NOTE(CONSTANTCONDITION)\
if (_lock)  \
-   mtx_unlock(((_esbp)-esb_lock));   

svn commit: r278220 - head/sys/dev/sfxge/common

2015-02-04 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Feb  4 19:58:54 2015
New Revision: 278220
URL: https://svnweb.freebsd.org/changeset/base/278220

Log:
  sfxge: Implement EFSYS_MEM_READ_BARRIER()
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efsys.h

Modified: head/sys/dev/sfxge/common/efsys.h
==
--- head/sys/dev/sfxge/common/efsys.h   Wed Feb  4 19:40:30 2015
(r278219)
+++ head/sys/dev/sfxge/common/efsys.h   Wed Feb  4 19:58:54 2015
(r278220)
@@ -677,8 +677,7 @@ typedef struct efsys_bar_s {
 
 /* BARRIERS */
 
-/* Strict ordering guaranteed by devacc.devacc_attr_dataorder */
-#defineEFSYS_MEM_READ_BARRIER()
+#defineEFSYS_MEM_READ_BARRIER()rmb()
 #defineEFSYS_PIO_WRITE_BARRIER()
 
 /* TIMESTAMP */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278248 - head/sys/dev/sfxge

2015-02-05 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Feb  5 11:37:07 2015
New Revision: 278248
URL: https://svnweb.freebsd.org/changeset/base/278248

Log:
  sfxge: access statistics buffers under port lock
  
  Allow access to statistics data not only from sysctl handlers.
  
  Submitted by:   Boris Misenov Boris.Misenov at oktetlabs.ru
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_port.c

Modified: head/sys/dev/sfxge/sfxge_port.c
==
--- head/sys/dev/sfxge/sfxge_port.c Thu Feb  5 10:50:51 2015
(r278247)
+++ head/sys/dev/sfxge/sfxge_port.c Thu Feb  5 11:37:07 2015
(r278248)
@@ -48,7 +48,7 @@ sfxge_mac_stat_update(struct sfxge_softc
unsigned int count;
int rc;
 
-   SFXGE_PORT_LOCK(port);
+   SFXGE_PORT_LOCK_ASSERT_OWNED(port);
 
if (port-init_state != SFXGE_PORT_STARTED) {
rc = 0;
@@ -82,7 +82,6 @@ sfxge_mac_stat_update(struct sfxge_softc
 
rc = ETIMEDOUT;
 out:
-   SFXGE_PORT_UNLOCK(port);
return (rc);
 }
 
@@ -93,12 +92,16 @@ sfxge_mac_stat_handler(SYSCTL_HANDLER_AR
unsigned int id = arg2;
int rc;
 
+   SFXGE_PORT_LOCK(sc-port);
if ((rc = sfxge_mac_stat_update(sc)) != 0)
-   return (rc);
+   goto out;
 
-   return (SYSCTL_OUT(req,
- (uint64_t *)sc-port.mac_stats.decode_buf + id,
- sizeof(uint64_t)));
+   rc = SYSCTL_OUT(req,
+   (uint64_t *)sc-port.mac_stats.decode_buf + id,
+   sizeof(uint64_t));
+out:
+   SFXGE_PORT_UNLOCK(sc-port);
+   return (rc);
 }
 
 static void
@@ -453,7 +456,7 @@ sfxge_phy_stat_update(struct sfxge_softc
unsigned int count;
int rc;
 
-   SFXGE_PORT_LOCK(port);
+   SFXGE_PORT_LOCK_ASSERT_OWNED(port);
 
if (port-init_state != SFXGE_PORT_STARTED) {
rc = 0;
@@ -487,7 +490,6 @@ sfxge_phy_stat_update(struct sfxge_softc
 
rc = ETIMEDOUT;
 out:
-   SFXGE_PORT_UNLOCK(port);
return (rc);
 }
 
@@ -498,12 +500,16 @@ sfxge_phy_stat_handler(SYSCTL_HANDLER_AR
unsigned int id = arg2;
int rc;
 
+   SFXGE_PORT_LOCK(sc-port);
if ((rc = sfxge_phy_stat_update(sc)) != 0)
-   return (rc);
+   goto out;
 
-   return (SYSCTL_OUT(req,
- (uint32_t *)sc-port.phy_stats.decode_buf + id,
- sizeof(uint32_t)));
+   rc = SYSCTL_OUT(req,
+   (uint32_t *)sc-port.phy_stats.decode_buf + id,
+   sizeof(uint32_t));
+out:
+   SFXGE_PORT_UNLOCK(sc-port);
+   return (rc);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278254 - head/sys/dev/sfxge/common

2015-02-05 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Feb  5 12:08:25 2015
New Revision: 278254
URL: https://svnweb.freebsd.org/changeset/base/278254

Log:
  sfxge: using 64-bit access for x86-64
  
  Submitted by:   Artem V. Andreev Artem.Andreev at oktetlabs.ru
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efsys.h

Modified: head/sys/dev/sfxge/common/efsys.h
==
--- head/sys/dev/sfxge/common/efsys.h   Thu Feb  5 11:54:55 2015
(r278253)
+++ head/sys/dev/sfxge/common/efsys.h   Thu Feb  5 12:08:25 2015
(r278254)
@@ -51,7 +51,11 @@ extern C {
 #include machine/endian.h
 
 #defineEFSYS_HAS_UINT64 1
+#if defined(__x86_64__)
+#defineEFSYS_USE_UINT64 1
+#else
 #defineEFSYS_USE_UINT64 0
+#endif
 #if _BYTE_ORDER == _BIG_ENDIAN
 #defineEFSYS_IS_BIG_ENDIAN 1
 #defineEFSYS_IS_LITTLE_ENDIAN 0
@@ -398,6 +402,26 @@ typedef struct efsys_mem_s {
_NOTE(CONSTANTCONDITION)\
} while (B_FALSE)
 
+#if defined(__x86_64__)
+#defineEFSYS_MEM_READQ(_esmp, _offset, _eqp)   
\
+   do {\
+   uint64_t *addr; \
+   \
+   _NOTE(CONSTANTCONDITION)\
+   KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)),\
+   (not power of 2 aligned));\
+   \
+   addr = (void *)((_esmp)-esm_base + (_offset)); \
+   \
+   (_eqp)-eq_u64[0] = *addr;  \
+   \
+   EFSYS_PROBE3(mem_readq, unsigned int, (_offset),\
+   uint32_t, (_eqp)-eq_u32[1],\
+   uint32_t, (_eqp)-eq_u32[0]);   \
+   \
+   _NOTE(CONSTANTCONDITION)\
+   } while (B_FALSE)
+#else
 #defineEFSYS_MEM_READQ(_esmp, _offset, _eqp)   
\
do {\
uint32_t *addr; \
@@ -417,7 +441,31 @@ typedef struct efsys_mem_s {
\
_NOTE(CONSTANTCONDITION)\
} while (B_FALSE)
+#endif
 
+#if defined(__x86_64__)
+#defineEFSYS_MEM_READO(_esmp, _offset, _eop)   
\
+   do {\
+   uint64_t *addr; \
+   \
+   _NOTE(CONSTANTCONDITION)\
+   KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)),\
+   (not power of 2 aligned));\
+   \
+   addr = (void *)((_esmp)-esm_base + (_offset)); \
+   \
+   (_eop)-eo_u64[0] = *addr++;\
+   (_eop)-eo_u64[1] = *addr;  \
+   \
+   EFSYS_PROBE5(mem_reado, unsigned int, (_offset),\
+   uint32_t, (_eop)-eo_u32[3],\
+   uint32_t, (_eop)-eo_u32[2],\
+   uint32_t, (_eop)-eo_u32[1],\
+   uint32_t, (_eop)-eo_u32[0]);   \
+   \
+   _NOTE(CONSTANTCONDITION)\
+   } while (B_FALSE)
+#else
 #defineEFSYS_MEM_READO(_esmp, _offset, _eop)   
\
do {\
uint32_t *addr; \
@@ -441,6 +489,7 @@ typedef struct efsys_mem_s {
\
_NOTE(CONSTANTCONDITION)\
} while (B_FALSE)
+#endif
 
 #defineEFSYS_MEM_WRITED(_esmp, _offset, _edp)  
\

svn commit: r278250 - in head/sys/dev/sfxge: . common

2015-02-05 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Feb  5 11:39:15 2015
New Revision: 278250
URL: https://svnweb.freebsd.org/changeset/base/278250

Log:
  sfxge: make lock names unique
  
  Lock name should include interface name.
  Tx queue and event queue lock name should include queue number.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efsys.h
  head/sys/dev/sfxge/sfxge.c
  head/sys/dev/sfxge/sfxge.h
  head/sys/dev/sfxge/sfxge_ev.c
  head/sys/dev/sfxge/sfxge_mcdi.c
  head/sys/dev/sfxge/sfxge_port.c
  head/sys/dev/sfxge/sfxge_tx.c
  head/sys/dev/sfxge/sfxge_tx.h

Modified: head/sys/dev/sfxge/common/efsys.h
==
--- head/sys/dev/sfxge/common/efsys.h   Thu Feb  5 11:38:29 2015
(r278249)
+++ head/sys/dev/sfxge/common/efsys.h   Thu Feb  5 11:39:15 2015
(r278250)
@@ -509,16 +509,26 @@ typedef struct efsys_mem_s {
 
 /* BAR */
 
+#defineSFXGE_LOCK_NAME_MAX 16
+
 typedef struct efsys_bar_s {
struct mtx  esb_lock;
+   charesb_lock_name[SFXGE_LOCK_NAME_MAX];
bus_space_tag_t esb_tag;
bus_space_handle_t  esb_handle;
int esb_rid;
struct resource *esb_res;
 } efsys_bar_t;
 
-#defineSFXGE_BAR_LOCK_INIT(_esbp, _name)   
\
-   mtx_init((_esbp)-esb_lock, (_name), NULL, MTX_DEF)
+#defineSFXGE_BAR_LOCK_INIT(_esbp, _ifname) 
\
+   do {\
+   snprintf((_esbp)-esb_lock_name,\
+sizeof((_esbp)-esb_lock_name),\
+%s:bar, (_ifname));  \
+   mtx_init((_esbp)-esb_lock, (_esbp)-esb_lock_name,\
+NULL, MTX_DEF);\
+   _NOTE(CONSTANTCONDITION)\
+   } while (B_FALSE)
 #defineSFXGE_BAR_LOCK_DESTROY(_esbp)   
\
mtx_destroy((_esbp)-esb_lock)
 #defineSFXGE_BAR_LOCK(_esbp)   
\
@@ -721,13 +731,35 @@ typedef   clock_t efsys_timestamp_t;
 
 /* LOCK */
 
-typedef struct mtx efsys_lock_t;
+typedef struct efsys_lock_s {
+   struct mtx  lock;
+   charlock_name[SFXGE_LOCK_NAME_MAX];
+} efsys_lock_t;
+
+#defineSFXGE_EFSYS_LOCK_INIT(_eslp, _ifname, _label)   
\
+   do {\
+   efsys_lock_t *__eslp = (_eslp); \
+   \
+   snprintf((__eslp)-lock_name,   \
+sizeof((__eslp)-lock_name),   \
+%s:%s, (_ifname), (_label)); \
+   mtx_init((__eslp)-lock, (__eslp)-lock_name,  \
+NULL, MTX_DEF);\
+   } while (B_FALSE)
+#defineSFXGE_EFSYS_LOCK_DESTROY(_eslp) 
\
+   mtx_destroy((_eslp)-lock)
+#defineSFXGE_EFSYS_LOCK(_eslp) 
\
+   mtx_lock((_eslp)-lock)
+#defineSFXGE_EFSYS_UNLOCK(_eslp)   
\
+   mtx_unlock((_eslp)-lock)
+#defineSFXGE_EFSYS_LOCK_ASSERT_OWNED(_eslp)
\
+   mtx_assert((_eslp)-lock, MA_OWNED)
 
 #defineEFSYS_LOCK_MAGIC0x10c4
 
 #defineEFSYS_LOCK(_lockp, _state)  
\
do {\
-   mtx_lock(_lockp);   \
+   SFXGE_EFSYS_LOCK(_lockp);   \
(_state) = EFSYS_LOCK_MAGIC;\
_NOTE(CONSTANTCONDITION)\
} while (B_FALSE)
@@ -736,7 +768,7 @@ typedef struct mtx  efsys_lock_t;
do {\
if ((_state) != EFSYS_LOCK_MAGIC)   \
KASSERT(B_FALSE, (not locked));   \
-   mtx_unlock(_lockp); \
+   SFXGE_EFSYS_UNLOCK(_lockp); \
_NOTE(CONSTANTCONDITION)\
} while (B_FALSE)
 

Modified: head/sys/dev/sfxge/sfxge.c
==
--- head/sys/dev/sfxge/sfxge.c  Thu Feb  5 11:38:29 2015(r278249)
+++ 

svn commit: r278941 - head/sys/dev/sfxge/common

2015-02-17 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Feb 18 06:23:16 2015
New Revision: 278941
URL: https://svnweb.freebsd.org/changeset/base/278941

Log:
  sfxge: support variable-length response to MCDI GET_BOARD_CFG
  
  Allocate the minimum or maximum response length for GET_BOARD_CFG as
  appropriate.  When looking up firmware subtypes by partition ID,
  check the ID against the actual response length.
  
  Merge of the patch made by Ben Hutchings in 2011.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efx_regs_mcdi.h
  head/sys/dev/sfxge/common/siena_nic.c
  head/sys/dev/sfxge/common/siena_nvram.c

Modified: head/sys/dev/sfxge/common/efx_regs_mcdi.h
==
--- head/sys/dev/sfxge/common/efx_regs_mcdi.h   Wed Feb 18 06:21:59 2015
(r278940)
+++ head/sys/dev/sfxge/common/efx_regs_mcdi.h   Wed Feb 18 06:23:16 2015
(r278941)
@@ -709,7 +709,9 @@
 #defineMC_CMD_GET_BOARD_CFG_IN_LEN 0
 
 /* MC_CMD_GET_BOARD_CFG_OUT msgresponse */
-#defineMC_CMD_GET_BOARD_CFG_OUT_LEN 96
+#defineMC_CMD_GET_BOARD_CFG_OUT_LENMIN 96
+#defineMC_CMD_GET_BOARD_CFG_OUT_LENMAX 136
+#defineMC_CMD_GET_BOARD_CFG_OUT_LEN(num) (72+2*(num))
 #defineMC_CMD_GET_BOARD_CFG_OUT_BOARD_TYPE_OFST 0
 #defineMC_CMD_GET_BOARD_CFG_OUT_BOARD_NAME_OFST 4
 #defineMC_CMD_GET_BOARD_CFG_OUT_BOARD_NAME_LEN 32
@@ -729,7 +731,8 @@
 #defineMC_CMD_GET_BOARD_CFG_OUT_MAC_STRIDE_PORT1_OFST 68
 #defineMC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST 72
 #defineMC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_LEN 2
-#defineMC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_NUM 12
+#defineMC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM 12
+#defineMC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MAXNUM 32
 
 
 /***/

Modified: head/sys/dev/sfxge/common/siena_nic.c
==
--- head/sys/dev/sfxge/common/siena_nic.c   Wed Feb 18 06:21:59 2015
(r278940)
+++ head/sys/dev/sfxge/common/siena_nic.c   Wed Feb 18 06:23:16 2015
(r278941)
@@ -276,7 +276,7 @@ siena_board_cfg(
 {
efx_nic_cfg_t *encp = (enp-en_nic_cfg);
efx_mcdi_iface_t *emip = (enp-en_u.siena.enu_mip);
-   uint8_t outbuf[MAX(MC_CMD_GET_BOARD_CFG_OUT_LEN,
+   uint8_t outbuf[MAX(MC_CMD_GET_BOARD_CFG_OUT_LENMIN,
MC_CMD_GET_RESOURCE_LIMITS_OUT_LEN)];
efx_mcdi_req_t req;
uint8_t *src;
@@ -288,7 +288,7 @@ siena_board_cfg(
req.emr_in_buf = NULL;
req.emr_in_length = 0;
req.emr_out_buf = outbuf;
-   req.emr_out_length = MC_CMD_GET_BOARD_CFG_OUT_LEN;
+   req.emr_out_length = MC_CMD_GET_BOARD_CFG_OUT_LENMIN;
 
efx_mcdi_execute(enp, req);
 
@@ -297,7 +297,7 @@ siena_board_cfg(
goto fail1;
}
 
-   if (req.emr_out_length_used  MC_CMD_GET_BOARD_CFG_OUT_LEN) {
+   if (req.emr_out_length_used  MC_CMD_GET_BOARD_CFG_OUT_LENMIN) {
rc = EMSGSIZE;
goto fail2;
}

Modified: head/sys/dev/sfxge/common/siena_nvram.c
==
--- head/sys/dev/sfxge/common/siena_nvram.c Wed Feb 18 06:21:59 2015
(r278940)
+++ head/sys/dev/sfxge/common/siena_nvram.c Wed Feb 18 06:23:16 2015
(r278941)
@@ -587,7 +587,7 @@ siena_nvram_get_subtype(
__out   uint32_t *subtypep)
 {
efx_mcdi_req_t req;
-   uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LEN];
+   uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMAX];
efx_word_t *fw_list;
int rc;
 
@@ -605,17 +605,26 @@ siena_nvram_get_subtype(
goto fail1;
}
 
-   if (req.emr_out_length_used  MC_CMD_GET_BOARD_CFG_OUT_LEN) {
+   if (req.emr_out_length_used  MC_CMD_GET_BOARD_CFG_OUT_LENMIN) {
rc = EMSGSIZE;
goto fail2;
}
 
+   if (req.emr_out_length_used 
+   MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST +
+   (partn + 1) * sizeof(efx_word_t)) {
+   rc = ENOENT;
+   goto fail3;
+   }
+
fw_list = MCDI_OUT2(req, efx_word_t,
GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST);
*subtypep = EFX_WORD_FIELD(fw_list[partn], EFX_WORD_0);
 
return (0);
 
+fail3:
+   EFSYS_PROBE(fail3);
 fail2:
EFSYS_PROBE(fail2);
 fail1:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278940 - head/sys/dev/sfxge

2015-02-17 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Feb 18 06:21:59 2015
New Revision: 278940
URL: https://svnweb.freebsd.org/changeset/base/278940

Log:
  sfxge: add driver context member with number of event queues
  
  Mainly to unify with similar member for transmit and receive queues.
  It will be used in the future for resources allocation processing.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge.h
  head/sys/dev/sfxge/sfxge_ev.c

Modified: head/sys/dev/sfxge/sfxge.h
==
--- head/sys/dev/sfxge/sfxge.h  Wed Feb 18 06:20:59 2015(r278939)
+++ head/sys/dev/sfxge/sfxge.h  Wed Feb 18 06:21:59 2015(r278940)
@@ -260,6 +260,7 @@ struct sfxge_softc {
chartx_lock_name[SFXGE_LOCK_NAME_MAX];
 #endif
 
+   unsigned intevq_count;
unsigned intrxq_count;
unsigned inttxq_count;
 };

Modified: head/sys/dev/sfxge/sfxge_ev.c
==
--- head/sys/dev/sfxge/sfxge_ev.c   Wed Feb 18 06:20:59 2015
(r278939)
+++ head/sys/dev/sfxge/sfxge_ev.c   Wed Feb 18 06:21:59 2015
(r278940)
@@ -427,7 +427,7 @@ sfxge_ev_stat_update(struct sfxge_softc 
sc-ev_stats_update_time = now;
 
/* Add event counts from each event queue in turn */
-   for (index = 0; index  sc-intr.n_alloc; index++) {
+   for (index = 0; index  sc-evq_count; index++) {
evq = sc-evq[index];
SFXGE_EVQ_LOCK(evq);
efx_ev_qstats_update(evq-common, sc-ev_stats);
@@ -493,7 +493,7 @@ sfxge_int_mod_handler(SYSCTL_HANDLER_ARG
struct sfxge_intr *intr = sc-intr;
unsigned int moderation;
int error;
-   int index;
+   unsigned int index;
 
SFXGE_ADAPTER_LOCK(sc);
 
@@ -513,7 +513,7 @@ sfxge_int_mod_handler(SYSCTL_HANDLER_ARG
 
sc-ev_moderation = moderation;
if (intr-state == SFXGE_INTR_STARTED) {
-   for (index = 0; index  intr-n_alloc; index++)
+   for (index = 0; index  sc-evq_count; index++)
sfxge_ev_qmoderate(sc, index, moderation);
}
} else {
@@ -727,7 +727,7 @@ sfxge_ev_stop(struct sfxge_softc *sc)
(Interrupts not started));
 
/* Stop the event queue(s) */
-   index = intr-n_alloc;
+   index = sc-evq_count;
while (--index = 0)
sfxge_ev_qstop(sc, index);
 
@@ -752,7 +752,7 @@ sfxge_ev_start(struct sfxge_softc *sc)
return (rc);
 
/* Start the event queues */
-   for (index = 0; index  intr-n_alloc; index++) {
+   for (index = 0; index  sc-evq_count; index++) {
if ((rc = sfxge_ev_qstart(sc, index)) != 0)
goto fail;
}
@@ -853,9 +853,11 @@ sfxge_ev_fini(struct sfxge_softc *sc)
sc-ev_moderation = 0;
 
/* Tear down the event queue(s). */
-   index = intr-n_alloc;
+   index = sc-evq_count;
while (--index = 0)
sfxge_ev_qfini(sc, index);
+
+   sc-evq_count = 0;
 }
 
 int
@@ -869,6 +871,8 @@ sfxge_ev_init(struct sfxge_softc *sc)
 
intr = sc-intr;
 
+   sc-evq_count = intr-n_alloc;
+
KASSERT(intr-state == SFXGE_INTR_INITIALIZED,
(intr-state != SFXGE_INTR_INITIALIZED));
 
@@ -884,7 +888,7 @@ sfxge_ev_init(struct sfxge_softc *sc)
/*
 * Initialize the event queue(s) - one per interrupt.
 */
-   for (index = 0; index  intr-n_alloc; index++) {
+   for (index = 0; index  sc-evq_count; index++) {
if ((rc = sfxge_ev_qinit(sc, index)) != 0)
goto fail;
}
@@ -899,5 +903,6 @@ fail:
while (--index = 0)
sfxge_ev_qfini(sc, index);
 
+   sc-evq_count = 0;
return (rc);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278938 - head/sys/dev/sfxge

2015-02-17 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Feb 18 06:19:35 2015
New Revision: 278938
URL: https://svnweb.freebsd.org/changeset/base/278938

Log:
  sfxge: add driver context member with number of transmit queues
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge.h
  head/sys/dev/sfxge/sfxge_tx.c
  head/sys/dev/sfxge/sfxge_tx.h

Modified: head/sys/dev/sfxge/sfxge.h
==
--- head/sys/dev/sfxge/sfxge.h  Wed Feb 18 06:18:51 2015(r278937)
+++ head/sys/dev/sfxge/sfxge.h  Wed Feb 18 06:19:35 2015(r278938)
@@ -259,6 +259,8 @@ struct sfxge_softc {
struct mtx  tx_lock __aligned(CACHE_LINE_SIZE);
chartx_lock_name[SFXGE_LOCK_NAME_MAX];
 #endif
+
+   unsigned inttxq_count;
 };
 
 #defineSFXGE_LINK_UP(sc) ((sc)-port.link_mode != EFX_LINK_DOWN)

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Wed Feb 18 06:18:51 2015
(r278937)
+++ head/sys/dev/sfxge/sfxge_tx.c   Wed Feb 18 06:19:35 2015
(r278938)
@@ -649,7 +649,7 @@ sfxge_if_qflush(struct ifnet *ifp)
 
sc = ifp-if_softc;
 
-   for (i = 0; i  SFXGE_TXQ_IP_TCP_UDP_CKSUM + SFXGE_TX_SCALE(sc); i++)
+   for (i = 0; i  sc-txq_count; i++)
sfxge_tx_qdpl_flush(sc-txq[i]);
 }
 
@@ -1280,13 +1280,9 @@ sfxge_tx_stop(struct sfxge_softc *sc)
 {
int index;
 
-   index = SFXGE_TX_SCALE(sc);
+   index = sc-txq_count;
while (--index = 0)
-   sfxge_tx_qstop(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index);
-
-   sfxge_tx_qstop(sc, SFXGE_TXQ_IP_CKSUM);
-
-   sfxge_tx_qstop(sc, SFXGE_TXQ_NON_CKSUM);
+   sfxge_tx_qstop(sc, index);
 
/* Tear down the transmit module */
efx_tx_fini(sc-enp);
@@ -1302,30 +1298,17 @@ sfxge_tx_start(struct sfxge_softc *sc)
if ((rc = efx_tx_init(sc-enp)) != 0)
return (rc);
 
-   if ((rc = sfxge_tx_qstart(sc, SFXGE_TXQ_NON_CKSUM)) != 0)
-   goto fail;
-
-   if ((rc = sfxge_tx_qstart(sc, SFXGE_TXQ_IP_CKSUM)) != 0)
-   goto fail2;
-
-   for (index = 0; index  SFXGE_TX_SCALE(sc); index++) {
-   if ((rc = sfxge_tx_qstart(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM +
-   index)) != 0)
-   goto fail3;
+   for (index = 0; index  sc-txq_count; index++) {
+   if ((rc = sfxge_tx_qstart(sc, index)) != 0)
+   goto fail;
}
 
return (0);
 
-fail3:
+fail:
while (--index = 0)
-   sfxge_tx_qstop(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index);
-
-   sfxge_tx_qstop(sc, SFXGE_TXQ_IP_CKSUM);
-
-fail2:
-   sfxge_tx_qstop(sc, SFXGE_TXQ_NON_CKSUM);
+   sfxge_tx_qstop(sc, index);
 
-fail:
efx_tx_fini(sc-enp);
 
return (rc);
@@ -1536,9 +1519,7 @@ sfxge_tx_stat_handler(SYSCTL_HANDLER_ARG
 
/* Sum across all TX queues */
sum = 0;
-   for (index = 0;
-index  SFXGE_TXQ_IP_TCP_UDP_CKSUM + SFXGE_TX_SCALE(sc);
-index++)
+   for (index = 0; index  sc-txq_count; index++)
sum += *(unsigned long *)((caddr_t)sc-txq[index] +
  sfxge_tx_stats[id].offset);
 
@@ -1571,12 +1552,11 @@ sfxge_tx_fini(struct sfxge_softc *sc)
 {
int index;
 
-   index = SFXGE_TX_SCALE(sc);
+   index = sc-txq_count;
while (--index = 0)
-   sfxge_tx_qfini(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index);
+   sfxge_tx_qfini(sc, index);
 
-   sfxge_tx_qfini(sc, SFXGE_TXQ_IP_CKSUM);
-   sfxge_tx_qfini(sc, SFXGE_TXQ_NON_CKSUM);
+   sc-txq_count = 0;
 }
 
 
@@ -1592,6 +1572,12 @@ sfxge_tx_init(struct sfxge_softc *sc)
KASSERT(intr-state == SFXGE_INTR_INITIALIZED,
(intr-state != SFXGE_INTR_INITIALIZED));
 
+#ifdef SFXGE_HAVE_MQ
+   sc-txq_count = SFXGE_TXQ_NTYPES - 1 + sc-intr.n_alloc;
+#else
+   sc-txq_count = SFXGE_TXQ_NTYPES;
+#endif
+
sc-txqs_node = SYSCTL_ADD_NODE(
device_get_sysctl_ctx(sc-dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(sc-dev)),
@@ -1610,8 +1596,10 @@ sfxge_tx_init(struct sfxge_softc *sc)
SFXGE_TXQ_IP_CKSUM, 0)) != 0)
goto fail2;
 
-   for (index = 0; index  SFXGE_TX_SCALE(sc); index++) {
-   if ((rc = sfxge_tx_qinit(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index,
+   for (index = 0;
+index  sc-txq_count - SFXGE_TXQ_NTYPES + 1;
+index++) {
+   if ((rc = sfxge_tx_qinit(sc, SFXGE_TXQ_NTYPES - 1 + index,
SFXGE_TXQ_IP_TCP_UDP_CKSUM, index)) != 0)
goto fail3;
}
@@ -1621,15 +1609,16 @@ sfxge_tx_init(struct sfxge_softc *sc)

svn commit: r278937 - head/sys/dev/sfxge

2015-02-17 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Feb 18 06:18:51 2015
New Revision: 278937
URL: https://svnweb.freebsd.org/changeset/base/278937

Log:
  sfxge: add TCP segment size to sfxge_tso_state
  
  It avoids access to m_pkthdr when TSO packet is started and also makes
  tso_start_new_packet() function smaller.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Wed Feb 18 05:53:04 2015
(r278936)
+++ head/sys/dev/sfxge/sfxge_tx.c   Wed Feb 18 06:18:51 2015
(r278937)
@@ -791,6 +791,7 @@ struct sfxge_tso_state {
ssize_t nh_off; /* Offset of network header */
ssize_t tcph_off;   /* Offset of TCP header */
unsigned header_len;/* Number of bytes of header */
+   unsigned seg_size;  /* TCP segment size */
 };
 
 static const struct ip *tso_iph(const struct sfxge_tso_state *tso)
@@ -892,6 +893,7 @@ static void tso_start(struct sfxge_tso_s
}
 
tso-header_len = tso-tcph_off + 4 * tso_tcph(tso)-th_off;
+   tso-seg_size = mbuf-m_pkthdr.tso_segsz;
 
tso-seqnum = ntohl(tso_tcph(tso)-th_seq);
 
@@ -1008,11 +1010,10 @@ static int tso_start_new_packet(struct s
m_copydata(tso-mbuf, 0, tso-header_len, header);
 
tsoh_th-th_seq = htonl(tso-seqnum);
-   tso-seqnum += tso-mbuf-m_pkthdr.tso_segsz;
-   if (tso-out_len  tso-mbuf-m_pkthdr.tso_segsz) {
+   tso-seqnum += tso-seg_size;
+   if (tso-out_len  tso-seg_size) {
/* This packet will not finish the TSO burst. */
-   ip_length = tso-header_len - tso-nh_off +
-   tso-mbuf-m_pkthdr.tso_segsz;
+   ip_length = tso-header_len - tso-nh_off + tso-seg_size;
tsoh_th-th_flags = ~(TH_FIN | TH_PUSH);
} else {
/* This packet will be the last in the TSO burst. */
@@ -1034,7 +1035,7 @@ static int tso_start_new_packet(struct s
/* Make the header visible to the hardware. */
bus_dmamap_sync(txq-packet_dma_tag, map, BUS_DMASYNC_PREWRITE);
 
-   tso-packet_space = tso-mbuf-m_pkthdr.tso_segsz;
+   tso-packet_space = tso-seg_size;
txq-tso_packets++;
 
/* Form a descriptor for this header. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278942 - head/sys/dev/sfxge/common

2015-02-17 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Feb 18 06:26:07 2015
New Revision: 278942
URL: https://svnweb.freebsd.org/changeset/base/278942

Log:
  sfxge: fix broken MCDI_EV_FIELD() macro
  
  Submitted by:   Andrew Lee alee at solarflare.com
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efx_ev.c
  head/sys/dev/sfxge/common/efx_mcdi.h
  head/sys/dev/sfxge/common/siena_phy.c

Modified: head/sys/dev/sfxge/common/efx_ev.c
==
--- head/sys/dev/sfxge/common/efx_ev.c  Wed Feb 18 06:23:16 2015
(r278941)
+++ head/sys/dev/sfxge/common/efx_ev.c  Wed Feb 18 06:26:07 2015
(r278942)
@@ -577,9 +577,9 @@ efx_ev_mcdi(
 
case MCDI_EVENT_CODE_CMDDONE:
efx_mcdi_ev_cpl(enp,
-   MCDI_EV_FIELD(*eqp, CMDDONE_SEQ),
-   MCDI_EV_FIELD(*eqp, CMDDONE_DATALEN),
-   MCDI_EV_FIELD(*eqp, CMDDONE_ERRNO));
+   MCDI_EV_FIELD(eqp, CMDDONE_SEQ),
+   MCDI_EV_FIELD(eqp, CMDDONE_DATALEN),
+   MCDI_EV_FIELD(eqp, CMDDONE_ERRNO));
break;
 
case MCDI_EVENT_CODE_LINKCHANGE: {

Modified: head/sys/dev/sfxge/common/efx_mcdi.h
==
--- head/sys/dev/sfxge/common/efx_mcdi.hWed Feb 18 06:23:16 2015
(r278941)
+++ head/sys/dev/sfxge/common/efx_mcdi.hWed Feb 18 06:26:07 2015
(r278942)
@@ -231,7 +231,7 @@ efx_mcdi_version(
MC_CMD_ ## _field)
 
 #defineMCDI_EV_FIELD(_eqp, _field) 
\
-   EFX_QWORD_FIELD(*eqp, MCDI_EVENT_ ## _field)
+   EFX_QWORD_FIELD(*_eqp, MCDI_EVENT_ ## _field)
 
 #ifdef __cplusplus
 }

Modified: head/sys/dev/sfxge/common/siena_phy.c
==
--- head/sys/dev/sfxge/common/siena_phy.c   Wed Feb 18 06:23:16 2015
(r278941)
+++ head/sys/dev/sfxge/common/siena_phy.c   Wed Feb 18 06:26:07 2015
(r278942)
@@ -122,7 +122,7 @@ siena_phy_link_ev(
 * Convert the LINKCHANGE speed enumeration into mbit/s, in the
 * same way as GET_LINK encodes the speed
 */
-   switch (MCDI_EV_FIELD(*eqp, LINKCHANGE_SPEED)) {
+   switch (MCDI_EV_FIELD(eqp, LINKCHANGE_SPEED)) {
case MCDI_EVENT_LINKCHANGE_SPEED_100M:
speed = 100;
break;
@@ -137,11 +137,11 @@ siena_phy_link_ev(
break;
}
 
-   link_flags = MCDI_EV_FIELD(*eqp, LINKCHANGE_LINK_FLAGS);
+   link_flags = MCDI_EV_FIELD(eqp, LINKCHANGE_LINK_FLAGS);
siena_phy_decode_link_mode(enp, link_flags, speed,
-   MCDI_EV_FIELD(*eqp, LINKCHANGE_FCNTL),
+   MCDI_EV_FIELD(eqp, LINKCHANGE_FCNTL),
link_mode, fcntl);
-   siena_phy_decode_cap(MCDI_EV_FIELD(*eqp, LINKCHANGE_LP_CAP),
+   siena_phy_decode_cap(MCDI_EV_FIELD(eqp, LINKCHANGE_LP_CAP),
lp_cap_mask);
 
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278939 - head/sys/dev/sfxge

2015-02-17 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Feb 18 06:20:59 2015
New Revision: 278939
URL: https://svnweb.freebsd.org/changeset/base/278939

Log:
  sfxge: add driver context member with number of receive queues
  
  Mainly to unify with similar member for transmit queues.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge.h
  head/sys/dev/sfxge/sfxge_rx.c

Modified: head/sys/dev/sfxge/sfxge.h
==
--- head/sys/dev/sfxge/sfxge.h  Wed Feb 18 06:19:35 2015(r278938)
+++ head/sys/dev/sfxge/sfxge.h  Wed Feb 18 06:20:59 2015(r278939)
@@ -260,6 +260,7 @@ struct sfxge_softc {
chartx_lock_name[SFXGE_LOCK_NAME_MAX];
 #endif
 
+   unsigned intrxq_count;
unsigned inttxq_count;
 };
 

Modified: head/sys/dev/sfxge/sfxge_rx.c
==
--- head/sys/dev/sfxge/sfxge_rx.c   Wed Feb 18 06:19:35 2015
(r278938)
+++ head/sys/dev/sfxge/sfxge_rx.c   Wed Feb 18 06:20:59 2015
(r278939)
@@ -939,13 +939,10 @@ fail:
 void
 sfxge_rx_stop(struct sfxge_softc *sc)
 {
-   struct sfxge_intr *intr;
int index;
 
-   intr = sc-intr;
-
/* Stop the receive queue(s) */
-   index = intr-n_alloc;
+   index = sc-rxq_count;
while (--index = 0)
sfxge_rx_qstop(sc, index);
 
@@ -987,7 +984,7 @@ sfxge_rx_start(struct sfxge_softc *sc)
 * Set up the scale table.  Enable all hash types and hash insertion.
 */
for (index = 0; index  SFXGE_RX_SCALE_MAX; index++)
-   sc-rx_indir_table[index] = index % sc-intr.n_alloc;
+   sc-rx_indir_table[index] = index % sc-rxq_count;
if ((rc = efx_rx_scale_tbl_set(sc-enp, sc-rx_indir_table,
   SFXGE_RX_SCALE_MAX)) != 0)
goto fail;
@@ -1000,7 +997,7 @@ sfxge_rx_start(struct sfxge_softc *sc)
goto fail;
 
/* Start the receive queue(s). */
-   for (index = 0; index  intr-n_alloc; index++) {
+   for (index = 0; index  sc-rxq_count; index++) {
if ((rc = sfxge_rx_qstart(sc, index)) != 0)
goto fail2;
}
@@ -1099,7 +1096,7 @@ sfxge_rx_qinit(struct sfxge_softc *sc, u
efsys_mem_t *esmp;
int rc;
 
-   KASSERT(index  sc-intr.n_alloc, (index = %d, sc-intr.n_alloc));
+   KASSERT(index  sc-rxq_count, (index = %d, sc-rxq_count));
 
rxq = malloc(sizeof(struct sfxge_rxq), M_SFXGE, M_ZERO | M_WAITOK);
rxq-sc = sc;
@@ -1159,7 +1156,7 @@ sfxge_rx_stat_handler(SYSCTL_HANDLER_ARG
 
/* Sum across all RX queues */
sum = 0;
-   for (index = 0; index  sc-intr.n_alloc; index++)
+   for (index = 0; index  sc-rxq_count; index++)
sum += *(unsigned int *)((caddr_t)sc-rxq[index] +
 sfxge_rx_stats[id].offset);
 
@@ -1190,14 +1187,13 @@ sfxge_rx_stat_init(struct sfxge_softc *s
 void
 sfxge_rx_fini(struct sfxge_softc *sc)
 {
-   struct sfxge_intr *intr;
int index;
 
-   intr = sc-intr;
-
-   index = intr-n_alloc;
+   index = sc-rxq_count;
while (--index = 0)
sfxge_rx_qfini(sc, index);
+
+   sc-rxq_count = 0;
 }
 
 int
@@ -1212,11 +1208,13 @@ sfxge_rx_init(struct sfxge_softc *sc)
 
intr = sc-intr;
 
+   sc-rxq_count = intr-n_alloc;
+
KASSERT(intr-state == SFXGE_INTR_INITIALIZED,
(intr-state != SFXGE_INTR_INITIALIZED));
 
/* Initialize the receive queue(s) - one per interrupt. */
-   for (index = 0; index  intr-n_alloc; index++) {
+   for (index = 0; index  sc-rxq_count; index++) {
if ((rc = sfxge_rx_qinit(sc, index)) != 0)
goto fail;
}
@@ -1230,5 +1228,6 @@ fail:
while (--index = 0)
sfxge_rx_qfini(sc, index);
 
+   sc-rxq_count = 0;
return (rc);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r279048 - head/sys/dev/sfxge/common

2015-02-19 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Feb 20 07:57:59 2015
New Revision: 279048
URL: https://svnweb.freebsd.org/changeset/base/279048

Log:
  sfxge: add Florence R7 turbo mode support to common code
  
  Submitted by:   Andrew Lee alee at solarflare.com
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_ev.c
  head/sys/dev/sfxge/common/efx_mcdi.h
  head/sys/dev/sfxge/common/siena_nic.c

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Feb 20 07:54:35 2015
(r279047)
+++ head/sys/dev/sfxge/common/efx.h Fri Feb 20 07:57:59 2015
(r279048)
@@ -861,6 +861,7 @@ efx_phy_bist_stop(
 #defineEFX_FEATURE_MCDI0x0020
 #defineEFX_FEATURE_LOOKAHEAD_SPLIT 0x0040
 #defineEFX_FEATURE_MAC_HEADER_FILTERS  0x0080
+#defineEFX_FEATURE_TURBO   0x0100
 
 typedef struct efx_nic_cfg_s {
uint32_tenc_board_type;
@@ -881,6 +882,7 @@ typedef struct efx_nic_cfg_s {
uint32_tenc_rxq_limit;
uint32_tenc_buftbl_limit;
uint32_tenc_evq_moderation_max;
+   uint32_tenc_clk_mult;
 #if EFSYS_OPT_LOOPBACK
uint32_tenc_loopback_types[EFX_LINK_NMODES];
 #endif /* EFSYS_OPT_LOOPBACK */

Modified: head/sys/dev/sfxge/common/efx_ev.c
==
--- head/sys/dev/sfxge/common/efx_ev.c  Fri Feb 20 07:54:35 2015
(r279047)
+++ head/sys/dev/sfxge/common/efx_ev.c  Fri Feb 20 07:57:59 2015
(r279048)
@@ -844,13 +844,14 @@ efx_ev_qmoderate(
__inunsigned int us)
 {
efx_nic_t *enp = eep-ee_enp;
+   efx_nic_cfg_t *encp = (enp-en_nic_cfg);
unsigned int locked;
efx_dword_t dword;
int rc;
 
EFSYS_ASSERT3U(eep-ee_magic, ==, EFX_EVQ_MAGIC);
 
-   if (us  enp-en_nic_cfg.enc_evq_moderation_max) {
+   if (us  encp-enc_evq_moderation_max) {
rc = EINVAL;
goto fail1;
}
@@ -869,21 +870,20 @@ efx_ev_qmoderate(
uint32_t timer_val;
 
/* Calculate the timer value in quanta */
-   us -= (us % EFX_EV_TIMER_QUANTUM);
-   if (us  EFX_EV_TIMER_QUANTUM)
-   us = EFX_EV_TIMER_QUANTUM;
-
-   timer_val = us / EFX_EV_TIMER_QUANTUM;
+   timer_val = us * encp-enc_clk_mult / EFX_EV_TIMER_QUANTUM;
 
/* Moderation value is base 0 so we need to deduct 1 */
+   if (timer_val  0)
+   timer_val--;
+
if (enp-en_family == EFX_FAMILY_FALCON)
EFX_POPULATE_DWORD_2(dword,
FRF_AB_TC_TIMER_MODE, FFE_AB_TIMER_MODE_INT_HLDOFF,
-   FRF_AB_TIMER_VAL, timer_val - 1);
+   FRF_AB_TIMER_VAL, timer_val);
else
EFX_POPULATE_DWORD_2(dword,
FRF_CZ_TC_TIMER_MODE, FFE_CZ_TIMER_MODE_INT_HLDOFF,
-   FRF_CZ_TC_TIMER_VAL, timer_val - 1);
+   FRF_CZ_TC_TIMER_VAL, timer_val);
}
 
locked = (eep-ee_index == 0) ? 1 : 0;

Modified: head/sys/dev/sfxge/common/efx_mcdi.h
==
--- head/sys/dev/sfxge/common/efx_mcdi.hFri Feb 20 07:54:35 2015
(r279047)
+++ head/sys/dev/sfxge/common/efx_mcdi.hFri Feb 20 07:57:59 2015
(r279048)
@@ -233,6 +233,9 @@ efx_mcdi_version(
 #defineMCDI_EV_FIELD(_eqp, _field) 
\
EFX_QWORD_FIELD(*_eqp, MCDI_EVENT_ ## _field)
 
+#define MCDI_CMD_DWORD_FIELD(_edp, _field) \
+   EFX_DWORD_FIELD(*_edp, MC_CMD_ ## _field)
+
 #ifdef __cplusplus
 }
 #endif

Modified: head/sys/dev/sfxge/common/siena_nic.c
==
--- head/sys/dev/sfxge/common/siena_nic.c   Fri Feb 20 07:54:35 2015
(r279047)
+++ head/sys/dev/sfxge/common/siena_nic.c   Fri Feb 20 07:57:59 2015
(r279048)
@@ -279,7 +279,8 @@ siena_board_cfg(
uint8_t outbuf[MAX(MC_CMD_GET_BOARD_CFG_OUT_LENMIN,
MC_CMD_GET_RESOURCE_LIMITS_OUT_LEN)];
efx_mcdi_req_t req;
-   uint8_t *src;
+   uint8_t *mac_addr;
+   efx_dword_t *capabilities;
int rc;
 
/* Board configuration */
@@ -302,17 +303,35 @@ siena_board_cfg(
goto fail2;
}
 
-   if (emip-emi_port == 1)
-   src = MCDI_OUT2(req, uint8_t,
+   if (emip-emi_port == 1) {
+   mac_addr = MCDI_OUT2(req, uint8_t,
   

svn commit: r279047 - head/sys/dev/sfxge/common

2015-02-19 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Feb 20 07:54:35 2015
New Revision: 279047
URL: https://svnweb.freebsd.org/changeset/base/279047

Log:
  sfxge: regenerate MCDI protocol headers
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efx_regs_mcdi.h

Modified: head/sys/dev/sfxge/common/efx_regs_mcdi.h
==
--- head/sys/dev/sfxge/common/efx_regs_mcdi.h   Fri Feb 20 07:53:46 2015
(r279046)
+++ head/sys/dev/sfxge/common/efx_regs_mcdi.h   Fri Feb 20 07:54:35 2015
(r279047)
@@ -40,6 +40,18 @@
 /* The Scheduler has started. */
 #define MC_FW_STATE_SCHED (8)
 
+/* Siena MC shared memmory offsets */
+/* The 'doorbell' addresses are hard-wired to alert the MC when written */
+#defineMC_SMEM_P0_DOORBELL_OFST0x000
+#defineMC_SMEM_P1_DOORBELL_OFST0x004
+/* The rest of these are firmware-defined */
+#defineMC_SMEM_P0_PDU_OFST 0x008
+#defineMC_SMEM_P1_PDU_OFST 0x108
+#defineMC_SMEM_PDU_LEN 0x100
+#defineMC_SMEM_P0_PTP_TIME_OFST0x7f0
+#defineMC_SMEM_P0_STATUS_OFST  0x7f8
+#defineMC_SMEM_P1_STATUS_OFST  0x7fc
+
 /* Values to be written to the per-port status dword in shared
  * memory on reboot and assert */
 #define MC_STATUS_DWORD_REBOOT (0xb007b007)
@@ -58,10 +70,7 @@
 
 /* Unused commands: 0x23, 0x27, 0x30, 0x31 */
 
-/* Unused commands: 0x23, 0x27, 0x30, 0x31 */
-
-/**
- * MCDI version 1
+/* MCDI version 1
  *
  * Each MCDI request starts with an MCDI_HEADER, which is a 32byte
  * structure, filled in by the client.
@@ -113,10 +122,10 @@
 #define MCDI_HEADER_XFLAGS_EVREQ 0x01
 
 /* Maximum number of payload bytes */
-#if MCDI_PCOL_VERSION == 1
-#define MCDI_CTL_SDU_LEN_MAX 0xfc
-#elif  MCDI_PCOL_VERSION == 2
+#ifdef WITH_MCDI_V2
 #define MCDI_CTL_SDU_LEN_MAX 0x400
+#else
+#define MCDI_CTL_SDU_LEN_MAX 0xfc
 #endif
 
 /* The MC can generate events for two reasons:
@@ -133,7 +142,7 @@
  *
  * If Code==CMDDONE, then the fields are further interpreted as:
  *
- *   - LEVEL==INFOCommand succeded
+ *   - LEVEL==INFOCommand succeeded
  *   - LEVEL==ERR Command failed
  *
  *0 8 16  24 32
@@ -293,6 +302,27 @@
 #defineMCDI_EVENT_TX_ERR_INFO_WIDTH 16
 #defineMCDI_EVENT_TX_FLUSH_TXQ_LBN 0
 #defineMCDI_EVENT_TX_FLUSH_TXQ_WIDTH 12
+#defineMCDI_EVENT_PTP_ERR_TYPE_LBN 0
+#defineMCDI_EVENT_PTP_ERR_TYPE_WIDTH 8
+#defineMCDI_EVENT_PTP_ERR_PLL_LOST 0x1 /* enum */
+#defineMCDI_EVENT_PTP_ERR_FILTER 0x2 /* enum */
+#defineMCDI_EVENT_PTP_ERR_FIFO 0x3 /* enum */
+#defineMCDI_EVENT_PTP_ERR_QUEUE 0x4 /* enum */
+#defineMCDI_EVENT_AOE_ERR_TYPE_LBN 0
+#defineMCDI_EVENT_AOE_ERR_TYPE_WIDTH 8
+#defineMCDI_EVENT_AOE_NO_LOAD 0x1 /* enum */
+#defineMCDI_EVENT_AOE_FC_ASSERT 0x2 /* enum */
+#defineMCDI_EVENT_AOE_FC_WATCHDOG 0x3 /* enum */
+#defineMCDI_EVENT_AOE_FC_NO_START 0x4 /* enum */
+#defineMCDI_EVENT_AOE_FAULT 0x5 /* enum */
+#defineMCDI_EVENT_AOE_CPLD_REPROGRAMMED 0x6 /* enum */
+#defineMCDI_EVENT_AOE_LOAD 0x7 /* enum */
+#defineMCDI_EVENT_AOE_DMA 0x8 /* enum */
+#defineMCDI_EVENT_AOE_BYTEBLASTER 0x9 /* enum */
+#defineMCDI_EVENT_AOE_DDR_ECC_STATUS 0xa /* enum */
+#defineMCDI_EVENT_AOE_PTP_STATUS 0xb /* enum */
+#defineMCDI_EVENT_AOE_ERR_DATA_LBN 8
+#defineMCDI_EVENT_AOE_ERR_DATA_WIDTH 8
 #defineMCDI_EVENT_DATA_LBN 0
 #defineMCDI_EVENT_DATA_WIDTH 32
 #defineMCDI_EVENT_SRC_LBN 36
@@ -313,6 +343,12 @@
 #defineMCDI_EVENT_CODE_FLR 0xa /* enum */
 #defineMCDI_EVENT_CODE_TX_ERR 0xb /* enum */
 #defineMCDI_EVENT_CODE_TX_FLUSH  0xc /* enum */
+#defineMCDI_EVENT_CODE_PTP_RX  0xd /* enum */
+#defineMCDI_EVENT_CODE_PTP_FAULT  0xe /* enum */
+#defineMCDI_EVENT_CODE_PTP_PPS  0xf /* enum */
+#defineMCDI_EVENT_CODE_AOE  0x12 /* enum */
+#defineMCDI_EVENT_CODE_VCAL_FAIL  0x13 /* enum */
+#defineMCDI_EVENT_CODE_HW_PPS  0x14 /* enum */
 #defineMCDI_EVENT_CMDDONE_DATA_OFST 0
 #defineMCDI_EVENT_CMDDONE_DATA_LBN 0
 #defineMCDI_EVENT_CMDDONE_DATA_WIDTH 32
@@ -328,6 +364,94 @@
 #defineMCDI_EVENT_TX_ERR_DATA_OFST 0
 #defineMCDI_EVENT_TX_ERR_DATA_LBN 0
 #defineMCDI_EVENT_TX_ERR_DATA_WIDTH 32
+#defineMCDI_EVENT_PTP_SECONDS_OFST 0
+#defineMCDI_EVENT_PTP_SECONDS_LBN 0
+#defineMCDI_EVENT_PTP_SECONDS_WIDTH 32
+#defineMCDI_EVENT_PTP_NANOSECONDS_OFST 0
+#defineMCDI_EVENT_PTP_NANOSECONDS_LBN 0
+#defineMCDI_EVENT_PTP_NANOSECONDS_WIDTH 32
+#defineMCDI_EVENT_PTP_UUID_OFST 0
+#defineMCDI_EVENT_PTP_UUID_LBN 0
+#defineMCDI_EVENT_PTP_UUID_WIDTH 32
+
+/* 

svn commit: r279046 - head/sys/dev/sfxge

2015-02-19 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Feb 20 07:53:46 2015
New Revision: 279046
URL: https://svnweb.freebsd.org/changeset/base/279046

Log:
  sfxge: handle fragmented TCP header in mbuf
  
  TCP header is fragmented in the case of VLAN tagged IPv6 traffic without
  HW VLAN tagging.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Fri Feb 20 06:19:23 2015
(r279045)
+++ head/sys/dev/sfxge/sfxge_tx.c   Fri Feb 20 07:53:46 2015
(r279046)
@@ -865,6 +865,8 @@ static void tso_fini(struct sfxge_txq *t
 static void tso_start(struct sfxge_tso_state *tso, struct mbuf *mbuf)
 {
struct ether_header *eh = mtod(mbuf, struct ether_header *);
+   const struct tcphdr *th;
+   struct tcphdr th_copy;
 
tso-mbuf = mbuf;
 
@@ -892,13 +894,24 @@ static void tso_start(struct sfxge_tso_s
tso-tcph_off = tso-nh_off + sizeof(struct ip6_hdr);
}
 
-   tso-header_len = tso-tcph_off + 4 * tso_tcph(tso)-th_off;
+   KASSERT(mbuf-m_len = tso-tcph_off,
+   (network header is fragmented in mbuf));
+   /* We need TCP header including flags (window is the next) */
+   if (mbuf-m_len  tso-tcph_off + offsetof(struct tcphdr, th_win)) {
+   m_copydata(tso-mbuf, tso-tcph_off, sizeof(th_copy),
+  (caddr_t)th_copy);
+   th = th_copy;
+   } else {
+   th = tso_tcph(tso);
+   }
+
+   tso-header_len = tso-tcph_off + 4 * th-th_off;
tso-seg_size = mbuf-m_pkthdr.tso_segsz;
 
-   tso-seqnum = ntohl(tso_tcph(tso)-th_seq);
+   tso-seqnum = ntohl(th-th_seq);
 
/* These flags must not be duplicated */
-   KASSERT(!(tso_tcph(tso)-th_flags  (TH_URG | TH_SYN | TH_RST)),
+   KASSERT(!(th-th_flags  (TH_URG | TH_SYN | TH_RST)),
(incompatible TCP flag on TSO packet));
 
tso-out_len = mbuf-m_pkthdr.len - tso-header_len;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r277884 - head/sys/dev/sfxge

2015-01-29 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Jan 29 18:50:25 2015
New Revision: 277884
URL: https://svnweb.freebsd.org/changeset/base/277884

Log:
  sfxge: Change sfxge_ev_qpoll() proto to avoid EVQ pointers array access
  
  It was the only place on data path where sc-evq array is accessed.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge.h
  head/sys/dev/sfxge/sfxge_ev.c
  head/sys/dev/sfxge/sfxge_intr.c

Modified: head/sys/dev/sfxge/sfxge.h
==
--- head/sys/dev/sfxge/sfxge.h  Thu Jan 29 18:44:21 2015(r277883)
+++ head/sys/dev/sfxge/sfxge.h  Thu Jan 29 18:50:25 2015(r277884)
@@ -281,7 +281,7 @@ extern int sfxge_ev_init(struct sfxge_so
 extern void sfxge_ev_fini(struct sfxge_softc *sc);
 extern int sfxge_ev_start(struct sfxge_softc *sc);
 extern void sfxge_ev_stop(struct sfxge_softc *sc);
-extern int sfxge_ev_qpoll(struct sfxge_softc *sc, unsigned int index);
+extern int sfxge_ev_qpoll(struct sfxge_evq *evq);
 
 /*
  * From sfxge_intr.c.

Modified: head/sys/dev/sfxge/sfxge_ev.c
==
--- head/sys/dev/sfxge/sfxge_ev.c   Thu Jan 29 18:44:21 2015
(r277883)
+++ head/sys/dev/sfxge/sfxge_ev.c   Thu Jan 29 18:50:25 2015
(r277884)
@@ -569,13 +569,10 @@ static const efx_ev_callbacks_t sfxge_ev
 
 
 int
-sfxge_ev_qpoll(struct sfxge_softc *sc, unsigned int index)
+sfxge_ev_qpoll(struct sfxge_evq *evq)
 {
-   struct sfxge_evq *evq;
int rc;
 
-   evq = sc-evq[index];
-
mtx_lock(evq-lock);
 
if (evq-init_state != SFXGE_EVQ_STARTING 

Modified: head/sys/dev/sfxge/sfxge_intr.c
==
--- head/sys/dev/sfxge/sfxge_intr.c Thu Jan 29 18:44:21 2015
(r277883)
+++ head/sys/dev/sfxge/sfxge_intr.c Thu Jan 29 18:50:25 2015
(r277884)
@@ -110,9 +110,8 @@ static void
 sfxge_intr_line(void *arg)
 {
struct sfxge_evq *evq = arg;
-   struct sfxge_softc *sc = evq-sc;
 
-   (void)sfxge_ev_qpoll(sc, 0);
+   (void)sfxge_ev_qpoll(evq);
 }
 
 static void
@@ -146,7 +145,7 @@ sfxge_intr_message(void *arg)
return;
}
 
-   (void)sfxge_ev_qpoll(sc, index);
+   (void)sfxge_ev_qpoll(evq);
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r277887 - head/sys/dev/sfxge

2015-01-29 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Jan 29 18:57:27 2015
New Revision: 277887
URL: https://svnweb.freebsd.org/changeset/base/277887

Log:
  sfxge: Remove extra cache-line alignment and reorder sfxge_evq_t
  
  Remove the first member alignment to cacheline since it is nop.
  Use __aligned() for the whole structure to make sure that the structure
  size is cacheline aligned.
  Remove lock alignment to make the structure smaller and fit all members
  used on event queue processing into one cacheline (128 bytes) on x86-64.
  The lock is obtained as well from different context when event queue
  statistics are retrived from sysctl context, but it is infrequent.
  Reorder members to avoid padding and go in usage order on event
  processing.
  As the result all structure members used on event queue processing fit
  into exactly one cacheline (128 byte) now.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge.h

Modified: head/sys/dev/sfxge/sfxge.h
==
--- head/sys/dev/sfxge/sfxge.h  Thu Jan 29 18:54:43 2015(r277886)
+++ head/sys/dev/sfxge/sfxge.h  Thu Jan 29 18:57:27 2015(r277887)
@@ -103,26 +103,26 @@ enum sfxge_evq_state {
 #defineSFXGE_EV_BATCH  16384
 
 struct sfxge_evq {
-   struct sfxge_softc  *sc  __aligned(CACHE_LINE_SIZE);
-   struct mtx  lock __aligned(CACHE_LINE_SIZE);
-
-   enum sfxge_evq_stateinit_state;
+   /* Structure members below are sorted by usage order */
+   struct sfxge_softc  *sc;
+   struct mtx  lock;
unsigned intindex;
-   unsigned intentries;
+   enum sfxge_evq_stateinit_state;
efsys_mem_t mem;
-   unsigned intbuf_base_id;
-
-   boolean_t   exception;
-
efx_evq_t   *common;
unsigned intread_ptr;
+   boolean_t   exception;
unsigned intrx_done;
unsigned inttx_done;
 
/* Linked list of TX queues with completions to process */
struct sfxge_txq*txq;
struct sfxge_txq**txqs;
-};
+
+   /* Structure members not used on event processing path */
+   unsigned intbuf_base_id;
+   unsigned intentries;
+} __aligned(CACHE_LINE_SIZE);
 
 #defineSFXGE_NDESCS1024
 #defineSFXGE_MODERATION30
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r277890 - head/sys/dev/sfxge

2015-01-29 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Jan 29 19:02:25 2015
New Revision: 277890
URL: https://svnweb.freebsd.org/changeset/base/277890

Log:
  sfxge: Do not bzero() DMA allocated memory once again
  
  sfxge_dma_alloc() calls bus_dmamem_alloc() with BUS_DMA_ZERO flag, so
  allocated memory is already filled in by zeros
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_port.c

Modified: head/sys/dev/sfxge/sfxge_port.c
==
--- head/sys/dev/sfxge/sfxge_port.c Thu Jan 29 19:01:09 2015
(r277889)
+++ head/sys/dev/sfxge/sfxge_port.c Thu Jan 29 19:02:25 2015
(r277890)
@@ -583,7 +583,6 @@ sfxge_port_init(struct sfxge_softc *sc)
M_SFXGE, M_WAITOK | M_ZERO);
if ((rc = sfxge_dma_alloc(sc, EFX_PHY_STATS_SIZE, phy_stats_buf)) != 0)
goto fail;
-   bzero(phy_stats_buf-esm_base, phy_stats_buf-esm_size);
sfxge_phy_stat_init(sc);
 
sysctl_ctx = device_get_sysctl_ctx(sc-dev);
@@ -605,7 +604,6 @@ sfxge_port_init(struct sfxge_softc *sc)
M_SFXGE, M_WAITOK | M_ZERO);
if ((rc = sfxge_dma_alloc(sc, EFX_MAC_STATS_SIZE, mac_stats_buf)) != 0)
goto fail2;
-   bzero(mac_stats_buf-esm_base, mac_stats_buf-esm_size);
sfxge_mac_stat_init(sc);
 
port-init_state = SFXGE_PORT_INITIALIZED;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r277885 - head/sys/dev/sfxge

2015-01-29 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Jan 29 18:52:33 2015
New Revision: 277885
URL: https://svnweb.freebsd.org/changeset/base/277885

Log:
  sfxge: Move txq-next pointer to part writable on completion path
  
  In fact the pointer is used only if more than one TXQ is processed in
  one interrupt.
  It is used (read-write) on completion path only.
  Also it makes the first part of the structure smaller and it fits now
  into one 128byte cache line. So, TXQ structure becomes 128 bytes smaller.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_tx.h

Modified: head/sys/dev/sfxge/sfxge_tx.h
==
--- head/sys/dev/sfxge/sfxge_tx.h   Thu Jan 29 18:50:25 2015
(r277884)
+++ head/sys/dev/sfxge/sfxge_tx.h   Thu Jan 29 18:52:33 2015
(r277885)
@@ -139,7 +139,6 @@ struct sfxge_txq {
bus_dma_tag_t   packet_dma_tag;
efx_buffer_t*pend_desc;
efx_txq_t   *common;
-   struct sfxge_txq*next;
 
efsys_mem_t *tsoh_buffer;
 
@@ -173,6 +172,7 @@ struct sfxge_txq {
 */
unsigned intpending __aligned(CACHE_LINE_SIZE);
unsigned intcompleted;
+   struct sfxge_txq*next;
 };
 
 extern int sfxge_tx_packet_add(struct sfxge_txq *, struct mbuf *);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r277886 - in head/sys/dev/sfxge: . common

2015-01-29 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Jan 29 18:54:43 2015
New Revision: 277886
URL: https://svnweb.freebsd.org/changeset/base/277886

Log:
  sfxge: Make it possible to build without EVQ statistics
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efx_ev.c
  head/sys/dev/sfxge/common/efx_tx.c
  head/sys/dev/sfxge/sfxge.h
  head/sys/dev/sfxge/sfxge_ev.c

Modified: head/sys/dev/sfxge/common/efx_ev.c
==
--- head/sys/dev/sfxge/common/efx_ev.c  Thu Jan 29 18:52:33 2015
(r277885)
+++ head/sys/dev/sfxge/common/efx_ev.c  Thu Jan 29 18:54:43 2015
(r277886)
@@ -995,6 +995,7 @@ fail1:
return (rc);
 }
 
+#if EFSYS_OPT_QSTATS
 #if EFSYS_OPT_NAMES
 /* START MKCONFIG GENERATED EfxEventQueueStatNamesBlock 67e9bdcd920059bd */
 static const char  __cs * __cs __efx_ev_qstat_name[] = {
@@ -1052,6 +1053,7 @@ efx_ev_qstat_name(
return (__efx_ev_qstat_name[id]);
 }
 #endif /* EFSYS_OPT_NAMES */
+#endif /* EFSYS_OPT_QSTATS */
 
 #if EFSYS_OPT_QSTATS
void

Modified: head/sys/dev/sfxge/common/efx_tx.c
==
--- head/sys/dev/sfxge/common/efx_tx.c  Thu Jan 29 18:52:33 2015
(r277885)
+++ head/sys/dev/sfxge/common/efx_tx.c  Thu Jan 29 18:54:43 2015
(r277886)
@@ -358,6 +358,7 @@ fail1:
return (rc);
 }
 
+#if EFSYS_OPT_QSTATS
 #if EFSYS_OPT_NAMES
 /* START MKCONFIG GENERATED EfxTransmitQueueStatNamesBlock 78ca9ab00287fffb */
 static const char  __cs * __cs __efx_tx_qstat_name[] = {
@@ -378,6 +379,7 @@ efx_tx_qstat_name(
return (__efx_tx_qstat_name[id]);
 }
 #endif /* EFSYS_OPT_NAMES */
+#endif /* EFSYS_OPT_QSTATS */
 
 #if EFSYS_OPT_QSTATS
void

Modified: head/sys/dev/sfxge/sfxge.h
==
--- head/sys/dev/sfxge/sfxge.h  Thu Jan 29 18:52:33 2015(r277885)
+++ head/sys/dev/sfxge/sfxge.h  Thu Jan 29 18:54:43 2015(r277886)
@@ -225,8 +225,10 @@ struct sfxge_softc {
 
struct sfxge_evq*evq[SFXGE_RX_SCALE_MAX];
unsigned intev_moderation;
+#if EFSYS_OPT_QSTATS
clock_t ev_stats_update_time;
uint64_tev_stats[EV_NQSTATS];
+#endif
 
uma_zone_t  rxq_cache;
struct sfxge_rxq*rxq[SFXGE_RX_SCALE_MAX];

Modified: head/sys/dev/sfxge/sfxge_ev.c
==
--- head/sys/dev/sfxge/sfxge_ev.c   Thu Jan 29 18:52:33 2015
(r277885)
+++ head/sys/dev/sfxge/sfxge_ev.c   Thu Jan 29 18:54:43 2015
(r277886)
@@ -406,6 +406,8 @@ sfxge_ev_wake_up(void *arg, uint32_t ind
return (B_FALSE);
 }
 
+#if EFSYS_OPT_QSTATS
+
 static void
 sfxge_ev_stat_update(struct sfxge_softc *sc)
 {
@@ -467,6 +469,8 @@ sfxge_ev_stat_init(struct sfxge_softc *s
}
 }
 
+#endif /* EFSYS_OPT_QSTATS */
+
 static void
 sfxge_ev_qmoderate(struct sfxge_softc *sc, unsigned int idx, unsigned int us)
 {
@@ -627,8 +631,10 @@ sfxge_ev_qstop(struct sfxge_softc *sc, u
evq-read_ptr = 0;
evq-exception = B_FALSE;
 
+#if EFSYS_OPT_QSTATS
/* Add event counts before discarding the common evq state */
efx_ev_qstats_update(evq-common, sc-ev_stats);
+#endif
 
efx_ev_qdestroy(evq-common);
efx_sram_buf_tbl_clear(sc-enp, evq-buf_base_id,
@@ -883,7 +889,9 @@ sfxge_ev_init(struct sfxge_softc *sc)
goto fail;
}
 
+#if EFSYS_OPT_QSTATS
sfxge_ev_stat_init(sc);
+#endif
 
return (0);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r277888 - head/sys/dev/sfxge

2015-01-29 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Jan 29 18:59:22 2015
New Revision: 277888
URL: https://svnweb.freebsd.org/changeset/base/277888

Log:
  sfxge: fixed TSO code to cope with VLAN headers
  
  Submitted by:   Artem V. Andreev Artem.Andreev at oktetlabs.ru
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Thu Jan 29 18:57:27 2015
(r277887)
+++ head/sys/dev/sfxge/sfxge_tx.c   Thu Jan 29 18:59:22 2015
(r277888)
@@ -855,9 +855,7 @@ static void tso_start(struct sfxge_tso_s
tso-tcph_off = tso-nh_off + sizeof(struct ip6_hdr);
}
 
-   /* We assume all headers are linear in the head mbuf */
tso-header_len = tso-tcph_off + 4 * tso_tcph(tso)-th_off;
-   KASSERT(tso-header_len = mbuf-m_len, (packet headers fragmented));
tso-full_packet_size = tso-header_len + mbuf-m_pkthdr.tso_segsz;
 
tso-seqnum = ntohl(tso_tcph(tso)-th_seq);
@@ -972,7 +970,7 @@ static int tso_start_new_packet(struct s
tsoh_th = (struct tcphdr *)(header + tso-tcph_off);
 
/* Copy and update the headers. */
-   memcpy(header, tso-mbuf-m_data, tso-header_len);
+   m_copydata(tso-mbuf, 0, tso-header_len, header);
 
tsoh_th-th_seq = htonl(tso-seqnum);
tso-seqnum += tso-mbuf-m_pkthdr.tso_segsz;
@@ -1018,20 +1016,18 @@ sfxge_tx_queue_tso(struct sfxge_txq *txq
 {
struct sfxge_tso_state tso;
unsigned int id, next_id;
+   unsigned skipped = 0;
 
tso_start(tso, mbuf);
 
-   /* Grab the first payload fragment. */
-   if (dma_seg-ds_len == tso.header_len) {
+   while (dma_seg-ds_len + skipped = tso.header_len) {
+   skipped += dma_seg-ds_len;
--n_dma_seg;
KASSERT(n_dma_seg, (no payload found in TSO packet));
++dma_seg;
-   tso.in_len = dma_seg-ds_len;
-   tso.dma_addr = dma_seg-ds_addr;
-   } else {
-   tso.in_len = dma_seg-ds_len - tso.header_len;
-   tso.dma_addr = dma_seg-ds_addr + tso.header_len;
}
+   tso.in_len = dma_seg-ds_len + (tso.header_len - skipped);
+   tso.dma_addr = dma_seg-ds_addr + (tso.header_len - skipped);
 
id = txq-added  txq-ptr_mask;
if (__predict_false(tso_start_new_packet(txq, tso, id)))
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r277889 - head/sys/dev/sfxge

2015-01-29 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Jan 29 19:01:09 2015
New Revision: 277889
URL: https://svnweb.freebsd.org/changeset/base/277889

Log:
  sfxge: Add evq argument to sfxge_tx_qcomplete()
  
  It removes necessity to get evq pointer by its index in soft context.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_ev.c
  head/sys/dev/sfxge/sfxge_tx.c
  head/sys/dev/sfxge/sfxge_tx.h

Modified: head/sys/dev/sfxge/sfxge_ev.c
==
--- head/sys/dev/sfxge/sfxge_ev.c   Thu Jan 29 18:59:22 2015
(r277888)
+++ head/sys/dev/sfxge/sfxge_ev.c   Thu Jan 29 19:01:09 2015
(r277889)
@@ -68,7 +68,7 @@ sfxge_ev_qcomplete(struct sfxge_evq *evq
(txq-evq_index != index));
 
if (txq-pending != txq-completed)
-   sfxge_tx_qcomplete(txq);
+   sfxge_tx_qcomplete(txq, evq);
 
txq = next;
} while (txq != NULL);
@@ -262,7 +262,7 @@ sfxge_ev_tx(void *arg, uint32_t label, u
}
 
if (txq-pending - txq-completed = SFXGE_TX_BATCH)
-   sfxge_tx_qcomplete(txq);
+   sfxge_tx_qcomplete(txq, evq);
 
 done:
return (evq-tx_done = SFXGE_EV_BATCH);

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Thu Jan 29 18:59:22 2015
(r277888)
+++ head/sys/dev/sfxge/sfxge_tx.c   Thu Jan 29 19:01:09 2015
(r277889)
@@ -105,15 +105,10 @@ static int sfxge_tx_queue_tso(struct sfx
  const bus_dma_segment_t *dma_seg, int n_dma_seg);
 
 void
-sfxge_tx_qcomplete(struct sfxge_txq *txq)
+sfxge_tx_qcomplete(struct sfxge_txq *txq, struct sfxge_evq *evq)
 {
-   struct sfxge_softc *sc;
-   struct sfxge_evq *evq;
unsigned int completed;
 
-   sc = txq-sc;
-   evq = sc-evq[txq-evq_index];
-
mtx_assert(evq-lock, MA_OWNED);
 
completed = txq-completed;
@@ -1147,7 +1142,7 @@ sfxge_tx_qstop(struct sfxge_softc *sc, u
txq-blocked = 0;
txq-pending = txq-added;
 
-   sfxge_tx_qcomplete(txq);
+   sfxge_tx_qcomplete(txq, evq);
KASSERT(txq-completed == txq-added,
(txq-completed != txq-added));
 

Modified: head/sys/dev/sfxge/sfxge_tx.h
==
--- head/sys/dev/sfxge/sfxge_tx.h   Thu Jan 29 18:59:22 2015
(r277888)
+++ head/sys/dev/sfxge/sfxge_tx.h   Thu Jan 29 19:01:09 2015
(r277889)
@@ -175,13 +175,15 @@ struct sfxge_txq {
struct sfxge_txq*next;
 };
 
+struct sfxge_evq;
+
 extern int sfxge_tx_packet_add(struct sfxge_txq *, struct mbuf *);
 
 extern int sfxge_tx_init(struct sfxge_softc *sc);
 extern void sfxge_tx_fini(struct sfxge_softc *sc);
 extern int sfxge_tx_start(struct sfxge_softc *sc);
 extern void sfxge_tx_stop(struct sfxge_softc *sc);
-extern void sfxge_tx_qcomplete(struct sfxge_txq *txq);
+extern void sfxge_tx_qcomplete(struct sfxge_txq *txq, struct sfxge_evq *evq);
 extern void sfxge_tx_qflush_done(struct sfxge_txq *txq);
 #ifdef SFXGE_HAVE_MQ
 extern void sfxge_if_qflush(struct ifnet *ifp);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r277892 - head/sys/dev/sfxge

2015-01-29 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Jan 29 19:04:42 2015
New Revision: 277892
URL: https://svnweb.freebsd.org/changeset/base/277892

Log:
  sfxge: Pass correct address to free allocated memory in the case of load error
  
  Most likely is was just memory leak on the error handling path since
  typically efsys_mem_t is filled in by zeros on allocation.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_dma.c

Modified: head/sys/dev/sfxge/sfxge_dma.c
==
--- head/sys/dev/sfxge/sfxge_dma.c  Thu Jan 29 19:03:33 2015
(r277891)
+++ head/sys/dev/sfxge/sfxge_dma.c  Thu Jan 29 19:04:42 2015
(r277892)
@@ -157,7 +157,7 @@ sfxge_dma_alloc(struct sfxge_softc *sc, 
if (bus_dmamap_load(esmp-esm_tag, esmp-esm_map, vaddr, len,
sfxge_dma_cb, esmp-esm_addr, 0) != 0) {
device_printf(sc-dev, Couldn't load DMA mapping\n);
-   bus_dmamem_free(esmp-esm_tag, esmp-esm_base, esmp-esm_map);
+   bus_dmamem_free(esmp-esm_tag, vaddr, esmp-esm_map);
bus_dma_tag_destroy(esmp-esm_tag);
return (ENOMEM);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r277891 - head/sys/dev/sfxge/common

2015-01-29 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Jan 29 19:03:33 2015
New Revision: 277891
URL: https://svnweb.freebsd.org/changeset/base/277891

Log:
  sfxge: Remove unused esm_size member of the efsys_mem_t structure
  
  esm_size is not even initialized properly when memory is allocated.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efsys.h

Modified: head/sys/dev/sfxge/common/efsys.h
==
--- head/sys/dev/sfxge/common/efsys.h   Thu Jan 29 19:02:25 2015
(r277890)
+++ head/sys/dev/sfxge/common/efsys.h   Thu Jan 29 19:03:33 2015
(r277891)
@@ -370,7 +370,6 @@ typedef struct efsys_mem_s {
bus_dmamap_tesm_map;
caddr_t esm_base;
efsys_dma_addr_tesm_addr;
-   size_t  esm_size;
 } efsys_mem_t;
 
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r277893 - head/sys/dev/sfxge

2015-01-29 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Jan 29 19:06:14 2015
New Revision: 277893
URL: https://svnweb.freebsd.org/changeset/base/277893

Log:
  sfxge: Use SFXGE_MODERATION to initialize event moderation
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_ev.c

Modified: head/sys/dev/sfxge/sfxge_ev.c
==
--- head/sys/dev/sfxge/sfxge_ev.c   Thu Jan 29 19:04:42 2015
(r277892)
+++ head/sys/dev/sfxge/sfxge_ev.c   Thu Jan 29 19:06:14 2015
(r277893)
@@ -875,7 +875,7 @@ sfxge_ev_init(struct sfxge_softc *sc)
/* Set default interrupt moderation; add a sysctl to
 * read and change it.
 */
-   sc-ev_moderation = 30;
+   sc-ev_moderation = SFXGE_MODERATION;
SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree),
OID_AUTO, int_mod, CTLTYPE_UINT|CTLFLAG_RW,
sc, 0, sfxge_int_mod_handler, IU,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r277894 - in head: share/man/man4 sys/dev/sfxge

2015-01-29 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Jan 29 19:09:14 2015
New Revision: 277894
URL: https://svnweb.freebsd.org/changeset/base/277894

Log:
  sfxge: implemented parameter to restrict RSS channels
  
  Submitted by:   Artem V. Andreev Artem.Andreev at oktetlabs.ru
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/share/man/man4/sfxge.4
  head/sys/dev/sfxge/sfxge.c
  head/sys/dev/sfxge/sfxge.h
  head/sys/dev/sfxge/sfxge_intr.c

Modified: head/share/man/man4/sfxge.4
==
--- head/share/man/man4/sfxge.4 Thu Jan 29 19:06:14 2015(r277893)
+++ head/share/man/man4/sfxge.4 Thu Jan 29 19:09:14 2015(r277894)
@@ -108,6 +108,10 @@ If a packet is dropped, the
 .Va tx_early_drops
 counter is incremented and the local sender receives ENOBUFS.
 The value must be greater than or equal to 0.
+.It Va hw.sfxge.N.max_rss_channels
+The maximum number of allocated RSS channels for the Nth adapter.
+If set to 0 or unset, the number of channels is determined by the number
+of CPU cores.
 .El
 .Sh SUPPORT
 For general information and support,

Modified: head/sys/dev/sfxge/sfxge.c
==
--- head/sys/dev/sfxge/sfxge.c  Thu Jan 29 19:06:14 2015(r277893)
+++ head/sys/dev/sfxge/sfxge.c  Thu Jan 29 19:09:14 2015(r277894)
@@ -397,11 +397,18 @@ sfxge_create(struct sfxge_softc *sc)
device_t dev;
efx_nic_t *enp;
int error;
+   char rss_param_name[sizeof(SFXGE_PARAM(%d.max_rss_channels))];
 
dev = sc-dev;
 
sx_init(sc-softc_lock, sfxge_softc);
 
+   sc-max_rss_channels = 0;
+   snprintf(rss_param_name, sizeof(rss_param_name),
+SFXGE_PARAM(%d.max_rss_channels),
+(int)device_get_unit(dev));
+   TUNABLE_INT_FETCH(rss_param_name, sc-max_rss_channels);
+
sc-stats_node = SYSCTL_ADD_NODE(
device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),

Modified: head/sys/dev/sfxge/sfxge.h
==
--- head/sys/dev/sfxge/sfxge.h  Thu Jan 29 19:06:14 2015(r277893)
+++ head/sys/dev/sfxge/sfxge.h  Thu Jan 29 19:09:14 2015(r277894)
@@ -230,6 +230,7 @@ struct sfxge_softc {
uint64_tev_stats[EV_NQSTATS];
 #endif
 
+   unsigned intmax_rss_channels;
uma_zone_t  rxq_cache;
struct sfxge_rxq*rxq[SFXGE_RX_SCALE_MAX];
unsigned intrx_indir_table[SFXGE_RX_SCALE_MAX];

Modified: head/sys/dev/sfxge/sfxge_intr.c
==
--- head/sys/dev/sfxge/sfxge_intr.c Thu Jan 29 19:06:14 2015
(r277893)
+++ head/sys/dev/sfxge/sfxge_intr.c Thu Jan 29 19:09:14 2015
(r277894)
@@ -302,6 +302,9 @@ sfxge_intr_setup_msix(struct sfxge_softc
if (count  EFX_MAXRSS)
count = EFX_MAXRSS;
 
+   if (sc-max_rss_channels  0  count  sc-max_rss_channels)
+   count = sc-max_rss_channels;
+
rid = PCIR_BAR(4);
resp = bus_alloc_resource_any(dev, SYS_RES_MEMORY, rid, RF_ACTIVE);
if (resp == NULL)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r277895 - in head: share/man/man4 sys/dev/sfxge

2015-01-29 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Jan 29 19:11:37 2015
New Revision: 277895
URL: https://svnweb.freebsd.org/changeset/base/277895

Log:
  sfxge: Separate software Tx queue limit for non-TCP traffic
  
  Add separate software Tx queue limit for non-TCP traffic to make total
  limit higher and avoid local drops of TCP packets because of no
  backpressure.
  There is no point to make non-TCP limit high since without backpressure
  UDP stream easily overflows any sensible limit.
  
  Split early drops statistics since it is better to have separate counter
  for each drop reason to make it unabmiguous.
  
  Add software Tx queue high watermark. The information is very useful to
  understand how big queues grow under traffic load.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/share/man/man4/sfxge.4
  head/sys/dev/sfxge/sfxge_tx.c
  head/sys/dev/sfxge/sfxge_tx.h

Modified: head/share/man/man4/sfxge.4
==
--- head/share/man/man4/sfxge.4 Thu Jan 29 19:09:14 2015(r277894)
+++ head/share/man/man4/sfxge.4 Thu Jan 29 19:11:37 2015(r277895)
@@ -93,10 +93,18 @@ Supported values are: 512, 1024, 2048 an
 .It Va hw.sfxge.tx_dpl_get_max
 The maximum length of the deferred packet
 .Dq get-list
-for queued transmit
-packets, used only if the transmit queue lock can be acquired.
+for queued transmit packets (TCP and non-TCP), used only if the transmit
+queue lock can be acquired.
 If a packet is dropped, the
-.Va tx_early_drops
+.Va tx_get_overflow
+counter is incremented and the local sender receives ENOBUFS.
+The value must be greater than 0.
+.It Va hw.sfxge.tx_dpl_get_non_tcp_max
+The maximum number of non-TCP packets in the deferred packet
+.Dq get-list
+, used only if the transmit queue lock can be acquired.
+If packet is dropped, the
+.Va tx_get_non_tcp_overflow
 counter is incremented and the local sender receives ENOBUFS.
 The value must be greater than 0.
 .It Va hw.sfxge.tx_dpl_put_max
@@ -105,7 +113,7 @@ The maximum length of the deferred packe
 for queued transmit
 packets, used if the transmit queue lock cannot be acquired.
 If a packet is dropped, the
-.Va tx_early_drops
+.Va tx_put_overflow
 counter is incremented and the local sender receives ENOBUFS.
 The value must be greater than or equal to 0.
 .It Va hw.sfxge.N.max_rss_channels

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Thu Jan 29 19:09:14 2015
(r277894)
+++ head/sys/dev/sfxge/sfxge_tx.c   Thu Jan 29 19:11:37 2015
(r277895)
@@ -85,14 +85,23 @@ static int sfxge_tx_dpl_get_max = SFXGE_
 TUNABLE_INT(SFXGE_PARAM_TX_DPL_GET_MAX, sfxge_tx_dpl_get_max);
 SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_dpl_get_max, CTLFLAG_RDTUN,
   sfxge_tx_dpl_get_max, 0,
-  Maximum number of packets in deferred packet get-list);
+  Maximum number of any packets in deferred packet get-list);
+
+#defineSFXGE_PARAM_TX_DPL_GET_NON_TCP_MAX \
+   SFXGE_PARAM(tx_dpl_get_non_tcp_max)
+static int sfxge_tx_dpl_get_non_tcp_max =
+   SFXGE_TX_DPL_GET_NON_TCP_PKT_LIMIT_DEFAULT;
+TUNABLE_INT(SFXGE_PARAM_TX_DPL_GET_NON_TCP_MAX, sfxge_tx_dpl_get_non_tcp_max);
+SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_dpl_get_non_tcp_max, CTLFLAG_RDTUN,
+  sfxge_tx_dpl_get_non_tcp_max, 0,
+  Maximum number of non-TCP packets in deferred packet get-list);
 
 #defineSFXGE_PARAM_TX_DPL_PUT_MAX  SFXGE_PARAM(tx_dpl_put_max)
 static int sfxge_tx_dpl_put_max = SFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT;
 TUNABLE_INT(SFXGE_PARAM_TX_DPL_PUT_MAX, sfxge_tx_dpl_put_max);
 SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_dpl_put_max, CTLFLAG_RDTUN,
   sfxge_tx_dpl_put_max, 0,
-  Maximum number of packets in deferred packet put-list);
+  Maximum number of any packets in deferred packet put-list);
 
 #endif
 
@@ -147,6 +156,15 @@ sfxge_tx_qcomplete(struct sfxge_txq *txq
 
 #ifdef SFXGE_HAVE_MQ
 
+static inline unsigned int
+sfxge_is_mbuf_non_tcp(struct mbuf *mbuf)
+{
+   /* Absense of TCP checksum flags does not mean that it is non-TCP
+* but it should be true if user wants to achieve high throughput.
+*/
+   return (!(mbuf-m_pkthdr.csum_flags  (CSUM_IP_TCP | CSUM_IP6_TCP)));
+}
+
 /*
  * Reorder the put list and append it to the get list.
  */
@@ -158,6 +176,7 @@ sfxge_tx_qdpl_swizzle(struct sfxge_txq *
volatile uintptr_t *putp;
uintptr_t put;
unsigned int count;
+   unsigned int non_tcp_count;
 
mtx_assert(txq-lock, MA_OWNED);
 
@@ -176,9 +195,11 @@ sfxge_tx_qdpl_swizzle(struct sfxge_txq *
get_next = NULL;
 
count = 0;
+   non_tcp_count = 0;
do {
struct mbuf *put_next;
 
+   non_tcp_count += sfxge_is_mbuf_non_tcp(mbuf);
put_next = mbuf-m_nextpkt;

svn commit: r278839 - head/sys/dev/sfxge/common

2015-02-15 Thread Andrew Rybchenko
Author: arybchik
Date: Mon Feb 16 06:12:04 2015
New Revision: 278839
URL: https://svnweb.freebsd.org/changeset/base/278839

Log:
  sfxge: style fixes
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efx_ev.c
  head/sys/dev/sfxge/common/efx_mac.c
  head/sys/dev/sfxge/common/efx_mcdi.c
  head/sys/dev/sfxge/common/efx_nic.c
  head/sys/dev/sfxge/common/efx_rx.c
  head/sys/dev/sfxge/common/efx_tx.c
  head/sys/dev/sfxge/common/siena_mon.c
  head/sys/dev/sfxge/common/siena_nic.c
  head/sys/dev/sfxge/common/siena_vpd.c

Modified: head/sys/dev/sfxge/common/efx_ev.c
==
--- head/sys/dev/sfxge/common/efx_ev.c  Mon Feb 16 06:10:17 2015
(r278838)
+++ head/sys/dev/sfxge/common/efx_ev.c  Mon Feb 16 06:12:04 2015
(r278839)
@@ -89,7 +89,8 @@ efx_ev_rx_not_ok(
if (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_TOBE_DISC) != 0) {
EFX_EV_QSTAT_INCR(eep, EV_RX_TOBE_DISC);
EFSYS_PROBE(tobe_disc);
-   /* Assume this is a unicast address mismatch, unless below
+   /*
+* Assume this is a unicast address mismatch, unless below
 * we find either FSF_AZ_RX_EV_ETH_CRC_ERR or
 * EV_RX_PAUSE_FRM_ERR is set.
 */
@@ -102,7 +103,8 @@ efx_ev_rx_not_ok(
(*flagsp) |= EFX_DISCARD;
 
 #if (EFSYS_OPT_RX_HDR_SPLIT || EFSYS_OPT_RX_SCATTER)
-   /* Lookout for payload queue ran dry errors and ignore them.
+   /*
+* Lookout for payload queue ran dry errors and ignore them.
 *
 * Sadly for the header/data split cases, the descriptor
 * pointer in this event refers to the header queue and

Modified: head/sys/dev/sfxge/common/efx_mac.c
==
--- head/sys/dev/sfxge/common/efx_mac.c Mon Feb 16 06:10:17 2015
(r278838)
+++ head/sys/dev/sfxge/common/efx_mac.c Mon Feb 16 06:12:04 2015
(r278839)
@@ -669,11 +669,11 @@ chosen:
EFSYS_ASSERT(emop != NULL);
 
epp-ep_mac_type = type;
-   
+
if (emop-emo_reset != NULL) {
if ((rc = emop-emo_reset(enp)) != 0)
goto fail1;
-   
+
EFSYS_ASSERT(enp-en_reset_flags  EFX_RESET_MAC);
enp-en_reset_flags = ~EFX_RESET_MAC;
}

Modified: head/sys/dev/sfxge/common/efx_mcdi.c
==
--- head/sys/dev/sfxge/common/efx_mcdi.cMon Feb 16 06:10:17 2015
(r278838)
+++ head/sys/dev/sfxge/common/efx_mcdi.cMon Feb 16 06:12:04 2015
(r278839)
@@ -44,7 +44,8 @@ __FBSDID($FreeBSD$);
 #defineMCDI_P1_REBOOT_OFST 0x1fe
 #defineMCDI_P2_REBOOT_OFST 0x1ff
 
-/* A reboot/assertion causes the MCDI status word to be set after the
+/*
+ * A reboot/assertion causes the MCDI status word to be set after the
  * command word is set or a REBOOT event is sent. If we notice a reboot
  * via these mechanisms then wait 10ms for the status word to be set.
  */
@@ -459,7 +460,8 @@ efx_mcdi_ev_death(
++emip-emi_aborted;
}
 
-   /* Since we're running in parallel with a request, consume the
+   /*
+* Since we're running in parallel with a request, consume the
 * status word before dropping the lock.
 */
if (rc == EIO || rc == EINTR) {

Modified: head/sys/dev/sfxge/common/efx_nic.c
==
--- head/sys/dev/sfxge/common/efx_nic.c Mon Feb 16 06:10:17 2015
(r278838)
+++ head/sys/dev/sfxge/common/efx_nic.c Mon Feb 16 06:12:04 2015
(r278839)
@@ -253,7 +253,8 @@ efx_nic_create(
EFX_FEATURE_LFSR_HASH_INSERT |
EFX_FEATURE_LINK_EVENTS | EFX_FEATURE_PERIODIC_MAC_STATS |
EFX_FEATURE_WOL | EFX_FEATURE_MCDI |
-   EFX_FEATURE_LOOKAHEAD_SPLIT | 
EFX_FEATURE_MAC_HEADER_FILTERS;
+   EFX_FEATURE_LOOKAHEAD_SPLIT |
+   EFX_FEATURE_MAC_HEADER_FILTERS;
break;
 #endif /* EFSYS_OPT_SIENA */
 

Modified: head/sys/dev/sfxge/common/efx_rx.c
==
--- head/sys/dev/sfxge/common/efx_rx.c  Mon Feb 16 06:10:17 2015
(r278838)
+++ head/sys/dev/sfxge/common/efx_rx.c  Mon Feb 16 06:12:04 2015
(r278839)
@@ -527,7 +527,7 @@ efx_rx_filter_insert(
EFSYS_ASSERT3P(spec, !=, NULL);
 
spec-efs_dmaq_id = (uint16_t)erp-er_index;
-   return efx_filter_insert_filter(erp-er_enp, spec, B_FALSE);
+   return (efx_filter_insert_filter(erp-er_enp, spec, B_FALSE));
 }
 #endif
 
@@ -541,7 +541,7 @@ efx_rx_filter_remove(

svn commit: r278841 - head/sys/dev/sfxge

2015-02-15 Thread Andrew Rybchenko
Author: arybchik
Date: Mon Feb 16 06:16:38 2015
New Revision: 278841
URL: https://svnweb.freebsd.org/changeset/base/278841

Log:
  sfxge: flush all Tx queues from if_qflush
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor), glebius

Modified:
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Mon Feb 16 06:12:55 2015
(r278840)
+++ head/sys/dev/sfxge/sfxge_tx.c   Mon Feb 16 06:16:38 2015
(r278841)
@@ -649,7 +649,7 @@ sfxge_if_qflush(struct ifnet *ifp)
 
sc = ifp-if_softc;
 
-   for (i = 0; i  SFXGE_TX_SCALE(sc); i++)
+   for (i = 0; i  SFXGE_TXQ_IP_TCP_UDP_CKSUM + SFXGE_TX_SCALE(sc); i++)
sfxge_tx_qdpl_flush(sc-txq[i]);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278833 - head/sys/dev/sfxge

2015-02-15 Thread Andrew Rybchenko
Author: arybchik
Date: Mon Feb 16 06:00:43 2015
New Revision: 278833
URL: https://svnweb.freebsd.org/changeset/base/278833

Log:
  sfxge: remove unused variable
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor), glebius

Modified:
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Mon Feb 16 05:58:32 2015
(r278832)
+++ head/sys/dev/sfxge/sfxge_tx.c   Mon Feb 16 06:00:43 2015
(r278833)
@@ -1280,7 +1280,6 @@ fail:
 void
 sfxge_tx_stop(struct sfxge_softc *sc)
 {
-   const efx_nic_cfg_t *encp;
int index;
 
index = SFXGE_TX_SCALE(sc);
@@ -1289,7 +1288,6 @@ sfxge_tx_stop(struct sfxge_softc *sc)
 
sfxge_tx_qstop(sc, SFXGE_TXQ_IP_CKSUM);
 
-   encp = efx_nic_cfg_get(sc-enp);
sfxge_tx_qstop(sc, SFXGE_TXQ_NON_CKSUM);
 
/* Tear down the transmit module */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278835 - head/sys/dev/sfxge

2015-02-15 Thread Andrew Rybchenko
Author: arybchik
Date: Mon Feb 16 06:04:26 2015
New Revision: 278835
URL: https://svnweb.freebsd.org/changeset/base/278835

Log:
  sfxge: remove full_packet_size from sfxge_tso_state
  
  It makes sfxge_tso_state smaller and even makes tso_start_new_packet()
  few bytes smaller. Data used to calculate packet size are used nearby,
  so it should be no problems with cache etc.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor), glebius

Modified:
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Mon Feb 16 06:02:46 2015
(r278834)
+++ head/sys/dev/sfxge/sfxge_tx.c   Mon Feb 16 06:04:26 2015
(r278835)
@@ -792,8 +792,6 @@ struct sfxge_tso_state {
ssize_t nh_off; /* Offset of network header */
ssize_t tcph_off;   /* Offset of TCP header */
unsigned header_len;/* Number of bytes of header */
-   int full_packet_size;   /* Number of bytes to put in each outgoing
-* segment */
 };
 
 static inline const struct ip *tso_iph(const struct sfxge_tso_state *tso)
@@ -895,7 +893,6 @@ static void tso_start(struct sfxge_tso_s
}
 
tso-header_len = tso-tcph_off + 4 * tso_tcph(tso)-th_off;
-   tso-full_packet_size = tso-header_len + mbuf-m_pkthdr.tso_segsz;
 
tso-seqnum = ntohl(tso_tcph(tso)-th_seq);
 
@@ -1015,7 +1012,8 @@ static int tso_start_new_packet(struct s
tso-seqnum += tso-mbuf-m_pkthdr.tso_segsz;
if (tso-out_len  tso-mbuf-m_pkthdr.tso_segsz) {
/* This packet will not finish the TSO burst. */
-   ip_length = tso-full_packet_size - tso-nh_off;
+   ip_length = tso-header_len - tso-nh_off +
+   tso-mbuf-m_pkthdr.tso_segsz;
tsoh_th-th_flags = ~(TH_FIN | TH_PUSH);
} else {
/* This packet will be the last in the TSO burst. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278836 - head/sys/dev/sfxge

2015-02-15 Thread Andrew Rybchenko
Author: arybchik
Date: Mon Feb 16 06:07:01 2015
New Revision: 278836
URL: https://svnweb.freebsd.org/changeset/base/278836

Log:
  sfxge: remove used sfxge_tso_state member dma_seg_i
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Mon Feb 16 06:04:26 2015
(r278835)
+++ head/sys/dev/sfxge/sfxge_tx.c   Mon Feb 16 06:07:01 2015
(r278836)
@@ -783,7 +783,6 @@ struct sfxge_tso_state {
unsigned packet_space;  /* Remaining space in current packet */
 
/* Input position */
-   unsigned dma_seg_i; /* Current DMA segment number */
uint64_t dma_addr;  /* DMA address of current position */
unsigned in_len;/* Remaining length in current mbuf */
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278838 - head/sys/dev/sfxge

2015-02-15 Thread Andrew Rybchenko
Author: arybchik
Date: Mon Feb 16 06:10:17 2015
New Revision: 278838
URL: https://svnweb.freebsd.org/changeset/base/278838

Log:
  sfxge: SYSCTL_IN/OUT should not be called with non-sleepable lock held
  
  The problem is found using WITNESS option enabled.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_port.c

Modified: head/sys/dev/sfxge/sfxge_port.c
==
--- head/sys/dev/sfxge/sfxge_port.c Mon Feb 16 06:08:13 2015
(r278837)
+++ head/sys/dev/sfxge/sfxge_port.c Mon Feb 16 06:10:17 2015
(r278838)
@@ -91,16 +91,15 @@ sfxge_mac_stat_handler(SYSCTL_HANDLER_AR
struct sfxge_softc *sc = arg1;
unsigned int id = arg2;
int rc;
+   uint64_t val;
 
SFXGE_PORT_LOCK(sc-port);
-   if ((rc = sfxge_mac_stat_update(sc)) != 0)
-   goto out;
-
-   rc = SYSCTL_OUT(req,
-   (uint64_t *)sc-port.mac_stats.decode_buf + id,
-   sizeof(uint64_t));
-out:
+   if ((rc = sfxge_mac_stat_update(sc)) == 0)
+   val = ((uint64_t *)sc-port.mac_stats.decode_buf)[id];
SFXGE_PORT_UNLOCK(sc-port);
+
+   if (rc == 0)
+   rc = SYSCTL_OUT(req, val, sizeof(val));
return (rc);
 }
 
@@ -173,28 +172,29 @@ sfxge_port_wanted_fc_handler(SYSCTL_HAND
sc = arg1;
port = sc-port;
 
-   SFXGE_PORT_LOCK(port);
-
if (req-newptr != NULL) {
if ((error = SYSCTL_IN(req, fcntl, sizeof(fcntl))) != 0)
-   goto out;
-
-   if (port-wanted_fc == fcntl)
-   goto out;
+   return (error);
 
-   port-wanted_fc = fcntl;
+   SFXGE_PORT_LOCK(port);
 
-   if (port-init_state != SFXGE_PORT_STARTED)
-   goto out;
+   if (port-wanted_fc != fcntl) {
+   if (port-init_state == SFXGE_PORT_STARTED)
+   error = efx_mac_fcntl_set(sc-enp,
+ port-wanted_fc,
+ B_TRUE);
+   if (error == 0)
+   port-wanted_fc = fcntl;
+   }
 
-   error = efx_mac_fcntl_set(sc-enp, port-wanted_fc, B_TRUE);
+   SFXGE_PORT_UNLOCK(port);
} else {
-   error = SYSCTL_OUT(req, port-wanted_fc,
-  sizeof(port-wanted_fc));
-   }
+   SFXGE_PORT_LOCK(port);
+   fcntl = port-wanted_fc;
+   SFXGE_PORT_UNLOCK(port);
 
-out:
-   SFXGE_PORT_UNLOCK(port);
+   error = SYSCTL_OUT(req, fcntl, sizeof(fcntl));
+   }
 
return (error);
 }
@@ -205,7 +205,6 @@ sfxge_port_link_fc_handler(SYSCTL_HANDLE
struct sfxge_softc *sc;
struct sfxge_port *port;
unsigned int wanted_fc, link_fc;
-   int error;
 
sc = arg1;
port = sc-port;
@@ -215,10 +214,9 @@ sfxge_port_link_fc_handler(SYSCTL_HANDLE
efx_mac_fcntl_get(sc-enp, wanted_fc, link_fc);
else
link_fc = 0;
-   error = SYSCTL_OUT(req, link_fc, sizeof(link_fc));
SFXGE_PORT_UNLOCK(port);
 
-   return (error);
+   return (SYSCTL_OUT(req, link_fc, sizeof(link_fc)));
 }
 
 #endif /* SFXGE_HAVE_PAUSE_MEDIAOPTS */
@@ -499,16 +497,15 @@ sfxge_phy_stat_handler(SYSCTL_HANDLER_AR
struct sfxge_softc *sc = arg1;
unsigned int id = arg2;
int rc;
+   uint32_t val;
 
SFXGE_PORT_LOCK(sc-port);
-   if ((rc = sfxge_phy_stat_update(sc)) != 0)
-   goto out;
-
-   rc = SYSCTL_OUT(req,
-   (uint32_t *)sc-port.phy_stats.decode_buf + id,
-   sizeof(uint32_t));
-out:
+   if ((rc = sfxge_phy_stat_update(sc)) == 0)
+   val = ((uint32_t *)sc-port.phy_stats.decode_buf)[id];
SFXGE_PORT_UNLOCK(sc-port);
+
+   if (rc == 0)
+   rc = SYSCTL_OUT(req, val, sizeof(val));
return (rc);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278837 - head/sys/dev/sfxge

2015-02-15 Thread Andrew Rybchenko
Author: arybchik
Date: Mon Feb 16 06:08:13 2015
New Revision: 278837
URL: https://svnweb.freebsd.org/changeset/base/278837

Log:
  sfxge: remove inline specifiers
  
  Now compiler does not need any help.
  The patch does not change generated code.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor), glebius

Modified:
  head/sys/dev/sfxge/sfxge_rx.c
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_rx.c
==
--- head/sys/dev/sfxge/sfxge_rx.c   Mon Feb 16 06:07:01 2015
(r278836)
+++ head/sys/dev/sfxge/sfxge_rx.c   Mon Feb 16 06:08:13 2015
(r278837)
@@ -92,8 +92,8 @@ static int lro_loss_packets = 20;
 #defineSFXGE_LRO_CONN_IS_TCPIPV4(c) (!((c)-l2_id  
SFXGE_LRO_L2_ID_IPV6))
 
 /* Compare IPv6 addresses, avoiding conditional branches */
-static __inline unsigned long ipv6_addr_cmp(const struct in6_addr *left,
-   const struct in6_addr *right)
+static unsigned long ipv6_addr_cmp(const struct in6_addr *left,
+  const struct in6_addr *right)
 {
 #if LONG_BIT == 64
const uint64_t *left64 = (const uint64_t *)left;
@@ -167,7 +167,7 @@ sfxge_rx_schedule_refill(struct sfxge_rx
 sfxge_rx_post_refill, rxq);
 }
 
-static inline struct mbuf *sfxge_rx_alloc_mbuf(struct sfxge_softc *sc)
+static struct mbuf *sfxge_rx_alloc_mbuf(struct sfxge_softc *sc)
 {
struct mb_args args;
struct mbuf *m;

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Mon Feb 16 06:07:01 2015
(r278836)
+++ head/sys/dev/sfxge/sfxge_tx.c   Mon Feb 16 06:08:13 2015
(r278837)
@@ -107,7 +107,7 @@ SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_dpl_p
 
 
 /* Forward declarations. */
-static inline void sfxge_tx_qdpl_service(struct sfxge_txq *txq);
+static void sfxge_tx_qdpl_service(struct sfxge_txq *txq);
 static void sfxge_tx_qlist_post(struct sfxge_txq *txq);
 static void sfxge_tx_qunblock(struct sfxge_txq *txq);
 static int sfxge_tx_queue_tso(struct sfxge_txq *txq, struct mbuf *mbuf,
@@ -156,7 +156,7 @@ sfxge_tx_qcomplete(struct sfxge_txq *txq
 
 #ifdef SFXGE_HAVE_MQ
 
-static inline unsigned int
+static unsigned int
 sfxge_is_mbuf_non_tcp(struct mbuf *mbuf)
 {
/* Absense of TCP checksum flags does not mean that it is non-TCP
@@ -481,7 +481,7 @@ sfxge_tx_qdpl_drain(struct sfxge_txq *tx
  *
  * NOTE: drops the txq mutex!
  */
-static inline void
+static void
 sfxge_tx_qdpl_service(struct sfxge_txq *txq)
 {
SFXGE_TXQ_LOCK_ASSERT_OWNED(txq);
@@ -509,7 +509,7 @@ sfxge_tx_qdpl_service(struct sfxge_txq *
  * overload the csum_data field in the mbuf to keep track of this length
  * because there is no cheap alternative to avoid races.
  */
-static inline int
+static int
 sfxge_tx_qdpl_put(struct sfxge_txq *txq, struct mbuf *mbuf, int locked)
 {
struct sfxge_tx_dpl *stdp;
@@ -758,7 +758,7 @@ void sfxge_if_start(struct ifnet *ifp)
SFXGE_TXQ_UNLOCK(sc-txq[0]);
 }
 
-static inline void
+static void
 sfxge_tx_qdpl_service(struct sfxge_txq *txq)
 {
struct ifnet *ifp = txq-sc-ifnet;
@@ -793,19 +793,19 @@ struct sfxge_tso_state {
unsigned header_len;/* Number of bytes of header */
 };
 
-static inline const struct ip *tso_iph(const struct sfxge_tso_state *tso)
+static const struct ip *tso_iph(const struct sfxge_tso_state *tso)
 {
KASSERT(tso-protocol == htons(ETHERTYPE_IP),
(tso_iph() in non-IPv4 state));
return (const struct ip *)(tso-mbuf-m_data + tso-nh_off);
 }
-static inline const struct ip6_hdr *tso_ip6h(const struct sfxge_tso_state *tso)
+static __unused const struct ip6_hdr *tso_ip6h(const struct sfxge_tso_state 
*tso)
 {
KASSERT(tso-protocol == htons(ETHERTYPE_IPV6),
(tso_ip6h() in non-IPv6 state));
return (const struct ip6_hdr *)(tso-mbuf-m_data + tso-nh_off);
 }
-static inline const struct tcphdr *tso_tcph(const struct sfxge_tso_state *tso)
+static const struct tcphdr *tso_tcph(const struct sfxge_tso_state *tso)
 {
return (const struct tcphdr *)(tso-mbuf-m_data + tso-tcph_off);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r276809 - head/share/misc

2015-01-07 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Jan  8 05:46:16 2015
New Revision: 276809
URL: https://svnweb.freebsd.org/changeset/base/276809

Log:
  Add myself (arybchik) to committers-src.dot
  
  Approved by:gnn (mentor)

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Thu Jan  8 03:59:03 2015
(r276808)
+++ head/share/misc/committers-src.dot  Thu Jan  8 05:46:16 2015
(r276809)
@@ -113,6 +113,7 @@ andrew [label=Andrew Turner\nandrew@Fre
 antoine [label=Antoine Brodin\nanto...@freebsd.org\n2008/02/03]
 ariff [label=Ariff Abdullah\nar...@freebsd.org\n2005/11/14]
 art [label=Artem Belevich\n...@freebsd.org\n2011/03/29]
+arybchik [label=Andrew Rybchenko\narybc...@freebsd.org\n2014/10/12]
 asomers [label=Alan Somers\nasom...@freebsd.org\n2013/04/24]
 avg [label=Andriy Gapon\n...@freebsd.org\n2009/02/18]
 bapt [label=Baptiste Daroussin\nb...@freebsd.org\n2011/12/23]
@@ -438,6 +439,7 @@ gnn - vanhu
 gnn - lstewart
 gnn - np
 gnn - davide
+gnn - arybchik
 
 grehan - bryanv
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280163 - head/sys/dev/sfxge

2015-03-17 Thread Andrew Rybchenko
Author: arybchik
Date: Tue Mar 17 08:23:15 2015
New Revision: 280163
URL: https://svnweb.freebsd.org/changeset/base/280163

Log:
  sfxge: prefetch txq-common if TxQ is started only
  
  Transmit may be called when TxQ is not started yet (i.e. txq-common is
  invalid). TxQ state is checked below when mbuf is processed and dropped
  if TxQ is not started.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Tue Mar 17 08:21:31 2015
(r280162)
+++ head/sys/dev/sfxge/sfxge_tx.c   Tue Mar 17 08:23:15 2015
(r280163)
@@ -423,8 +423,10 @@ sfxge_tx_qdpl_drain(struct sfxge_txq *tx
stdp = txq-dpl;
pushed = txq-added;
 
-   prefetch_read_many(sc-enp);
-   prefetch_read_many(txq-common);
+   if (__predict_true(txq-init_state == SFXGE_TXQ_STARTED)) {
+   prefetch_read_many(sc-enp);
+   prefetch_read_many(txq-common);
+   }
 
mbuf = stdp-std_get;
count = stdp-std_get_count;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280162 - in head/sys: dev/sfxge modules/sfxge

2015-03-17 Thread Andrew Rybchenko
Author: arybchik
Date: Tue Mar 17 08:21:31 2015
New Revision: 280162
URL: https://svnweb.freebsd.org/changeset/base/280162

Log:
  sfxge: adding version info to device description
  
  The information is required for NIC update and config tools.
  
  Submitted by:   Artem V. Andreev Artem.Andreev at oktetlabs.ru
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Added:
  head/sys/dev/sfxge/sfxge_version.h   (contents, props changed)
Modified:
  head/sys/dev/sfxge/sfxge.c
  head/sys/modules/sfxge/Makefile

Modified: head/sys/dev/sfxge/sfxge.c
==
--- head/sys/dev/sfxge/sfxge.c  Tue Mar 17 08:16:37 2015(r280161)
+++ head/sys/dev/sfxge/sfxge.c  Tue Mar 17 08:21:31 2015(r280162)
@@ -57,6 +57,7 @@ __FBSDID($FreeBSD$);
 
 #include sfxge.h
 #include sfxge_rx.h
+#include sfxge_version.h
 
 #defineSFXGE_CAP (IFCAP_VLAN_MTU | \
   IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM | IFCAP_TSO |   \
@@ -475,6 +476,12 @@ sfxge_create(struct sfxge_softc *sc)
if ((error = efx_nic_probe(enp)) != 0)
goto fail5;
 
+   SYSCTL_ADD_STRING(device_get_sysctl_ctx(dev),
+ SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
+ OID_AUTO, version, CTLFLAG_RD,
+ SFXGE_VERSION_STRING, 0,
+ Driver version);
+
/* Initialize the NVRAM. */
if ((error = efx_nvram_init(enp)) != 0)
goto fail6;

Added: head/sys/dev/sfxge/sfxge_version.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/sfxge/sfxge_version.h  Tue Mar 17 08:21:31 2015
(r280162)
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2015 Solarflare Communications, Inc.
+ * All rights reserved.
+ *
+ * This software was developed in part by OKTET Labs under contract for
+ * Solarflare Communications, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SFXGE_VERSION_H
+#define_SFXGE_VERSION_H
+
+#defineSFXGE_VERSION_STRINGv3.3.4.6363
+
+#endif /* _SFXGE_DRIVER_VERSION_H */

Modified: head/sys/modules/sfxge/Makefile
==
--- head/sys/modules/sfxge/Makefile Tue Mar 17 08:16:37 2015
(r280161)
+++ head/sys/modules/sfxge/Makefile Tue Mar 17 08:21:31 2015
(r280162)
@@ -11,7 +11,7 @@ SRCS+=opt_inet.h opt_inet6.h opt_sched.
 SRCS+= sfxge.c sfxge_dma.c sfxge_ev.c
 SRCS+= sfxge_intr.c sfxge_mcdi.c
 SRCS+= sfxge_port.c sfxge_rx.c sfxge_tx.c
-SRCS+= sfxge.h sfxge_rx.h sfxge_tx.h
+SRCS+= sfxge.h sfxge_rx.h sfxge_tx.h sfxge_version.h
 
 .PATH: ${.CURDIR}/../../dev/sfxge/common
 SRCS+= efx_ev.c efx_intr.c efx_mac.c efx_mcdi.c efx_nic.c 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280160 - in head: share/man/man4 sys/dev/sfxge

2015-03-17 Thread Andrew Rybchenko
Author: arybchik
Date: Tue Mar 17 08:14:46 2015
New Revision: 280160
URL: https://svnweb.freebsd.org/changeset/base/280160

Log:
  sfxge: add tunables to control LRO parameters on driver load time
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/share/man/man4/sfxge.4
  head/sys/dev/sfxge/sfxge_rx.c

Modified: head/share/man/man4/sfxge.4
==
--- head/share/man/man4/sfxge.4 Tue Mar 17 05:48:45 2015(r280159)
+++ head/share/man/man4/sfxge.4 Tue Mar 17 08:14:46 2015(r280160)
@@ -120,6 +120,27 @@ The value must be greater than or equal 
 The maximum number of allocated RSS channels for the Nth adapter.
 If set to 0 or unset, the number of channels is determined by the number
 of CPU cores.
+.It Va hw.sfxge.lro.table_size
+Size of the LRO hash table.
+Must be a power of 2.
+A larger table means we can accelerate a larger number of streams.
+.It Va hw.sfxge.lro.chain_max
+The maximum length of a hash chain.
+If chains get too long then the lookup time increases and may exceed
+the benefit of LRO.
+.It Va hw.sfxge.lro.idle_ticks
+The maximum time (in ticks) that a connection can be idle before it's LRO
+state is discarded.
+.It Va hw.sfxge.lro.slow_start_packets
+Number of packets with payload that must arrive in-order before a connection
+is eligible for LRO.
+The idea is we should avoid coalescing segments when the sender is in
+slow-start because reducing the ACK rate can damage performance.
+.It Va hw.sfxge.lro.loss_packets
+Number of packets with payload that must arrive in-order following loss
+before a connection is eligible for LRO.
+The idea is we should avoid coalescing segments when the sender is recovering
+from loss, because reducing the ACK rate can damage performance.
 .El
 .Sh SUPPORT
 For general information and support,

Modified: head/sys/dev/sfxge/sfxge_rx.c
==
--- head/sys/dev/sfxge/sfxge_rx.c   Tue Mar 17 05:48:45 2015
(r280159)
+++ head/sys/dev/sfxge/sfxge_rx.c   Tue Mar 17 08:14:46 2015
(r280160)
@@ -36,6 +36,7 @@ __FBSDID($FreeBSD$);
 #include sys/socket.h
 #include sys/sysctl.h
 #include sys/limits.h
+#include sys/syslog.h
 
 #include net/ethernet.h
 #include net/if.h
@@ -58,20 +59,38 @@ __FBSDID($FreeBSD$);
 
 #ifdef SFXGE_LRO
 
+SYSCTL_NODE(_hw_sfxge, OID_AUTO, lro, CTLFLAG_RD, NULL,
+   Large receive offload (LRO) parameters);
+
+#defineSFXGE_LRO_PARAM(_param) SFXGE_PARAM(lro._param)
+
 /* Size of the LRO hash table.  Must be a power of 2.  A larger table
  * means we can accelerate a larger number of streams.
  */
 static unsigned lro_table_size = 128;
+TUNABLE_INT(SFXGE_LRO_PARAM(table_size), lro_table_size);
+SYSCTL_UINT(_hw_sfxge_lro, OID_AUTO, table_size, CTLFLAG_RDTUN,
+   lro_table_size, 0,
+   Size of the LRO hash table (must be a power of 2));
 
 /* Maximum length of a hash chain.  If chains get too long then the lookup
  * time increases and may exceed the benefit of LRO.
  */
 static unsigned lro_chain_max = 20;
+TUNABLE_INT(SFXGE_LRO_PARAM(chain_max), lro_chain_max);
+SYSCTL_UINT(_hw_sfxge_lro, OID_AUTO, chain_max, CTLFLAG_RDTUN,
+   lro_chain_max, 0,
+   The maximum length of a hash chain);
 
 /* Maximum time (in ticks) that a connection can be idle before it's LRO
  * state is discarded.
  */
 static unsigned lro_idle_ticks; /* initialised in sfxge_rx_init() */
+TUNABLE_INT(SFXGE_LRO_PARAM(idle_ticks), lro_idle_ticks);
+SYSCTL_UINT(_hw_sfxge_lro, OID_AUTO, idle_ticks, CTLFLAG_RDTUN,
+   lro_idle_ticks, 0,
+   The maximum time (in ticks) that a connection can be idle 
+   before it's LRO state is discarded);
 
 /* Number of packets with payload that must arrive in-order before a
  * connection is eligible for LRO.  The idea is we should avoid coalescing
@@ -79,6 +98,11 @@ static unsigned lro_idle_ticks; /* initi
  * can damage performance.
  */
 static int lro_slow_start_packets = 2000;
+TUNABLE_INT(SFXGE_LRO_PARAM(slow_start_packets), lro_slow_start_packets);
+SYSCTL_UINT(_hw_sfxge_lro, OID_AUTO, slow_start_packets, CTLFLAG_RDTUN,
+   lro_slow_start_packets, 0,
+   Number of packets with payload that must arrive in-order before 
+   a connection is eligible for LRO);
 
 /* Number of packets with payload that must arrive in-order following loss
  * before a connection is eligible for LRO.  The idea is we should avoid
@@ -86,6 +110,11 @@ static int lro_slow_start_packets = 2000
  * reducing the ACK rate can damage performance.
  */
 static int lro_loss_packets = 20;
+TUNABLE_INT(SFXGE_LRO_PARAM(loss_packets), lro_loss_packets);
+SYSCTL_UINT(_hw_sfxge_lro, OID_AUTO, loss_packets, CTLFLAG_RDTUN,
+   lro_loss_packets, 0,
+   Number of packets with payload that must arrive in-order 
+   following loss before a 

svn commit: r280161 - head/sys/dev/sfxge

2015-03-17 Thread Andrew Rybchenko
Author: arybchik
Date: Tue Mar 17 08:16:37 2015
New Revision: 280161
URL: https://svnweb.freebsd.org/changeset/base/280161

Log:
  sfxge: move deferred packet list statistics to dedicated node
  
  It is done to structure sysctl and do not mix with Tx queue statistics
  to be added.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Tue Mar 17 08:14:46 2015
(r280160)
+++ head/sys/dev/sfxge/sfxge_tx.c   Tue Mar 17 08:16:37 2015
(r280161)
@@ -1380,11 +1380,13 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
 enum sfxge_txq_type type, unsigned int evq_index)
 {
char name[16];
+   struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc-dev);
struct sysctl_oid *txq_node;
struct sfxge_txq *txq;
struct sfxge_evq *evq;
 #ifdef SFXGE_HAVE_MQ
struct sfxge_tx_dpl *stdp;
+   struct sysctl_oid *dpl_node;
 #endif
efsys_mem_t *esmp;
unsigned int nmaps;
@@ -1433,10 +1435,8 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
}
 
snprintf(name, sizeof(name), %u, txq_index);
-   txq_node = SYSCTL_ADD_NODE(
-   device_get_sysctl_ctx(sc-dev),
-   SYSCTL_CHILDREN(sc-txqs_node),
-   OID_AUTO, name, CTLFLAG_RD, NULL, );
+   txq_node = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(sc-txqs_node),
+  OID_AUTO, name, CTLFLAG_RD, NULL, );
if (txq_node == NULL) {
rc = ENOMEM;
goto fail_txq_node;
@@ -1476,21 +1476,25 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
 
SFXGE_TXQ_LOCK_INIT(txq, device_get_nameunit(sc-dev), txq_index);
 
-   SYSCTL_ADD_UINT(device_get_sysctl_ctx(sc-dev),
-   SYSCTL_CHILDREN(txq_node), OID_AUTO,
-   dpl_get_count, CTLFLAG_RD | CTLFLAG_STATS,
+   dpl_node = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(txq_node), OID_AUTO,
+  dpl, CTLFLAG_RD, NULL,
+  Deferred packet list statistics);
+   if (dpl_node == NULL) {
+   rc = ENOMEM;
+   goto fail_dpl_node;
+   }
+
+   SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(dpl_node), OID_AUTO,
+   get_count, CTLFLAG_RD | CTLFLAG_STATS,
stdp-std_get_count, 0, );
-   SYSCTL_ADD_UINT(device_get_sysctl_ctx(sc-dev),
-   SYSCTL_CHILDREN(txq_node), OID_AUTO,
-   dpl_get_non_tcp_count, CTLFLAG_RD | CTLFLAG_STATS,
+   SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(dpl_node), OID_AUTO,
+   get_non_tcp_count, CTLFLAG_RD | CTLFLAG_STATS,
stdp-std_get_non_tcp_count, 0, );
-   SYSCTL_ADD_UINT(device_get_sysctl_ctx(sc-dev),
-   SYSCTL_CHILDREN(txq_node), OID_AUTO,
-   dpl_get_hiwat, CTLFLAG_RD | CTLFLAG_STATS,
+   SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(dpl_node), OID_AUTO,
+   get_hiwat, CTLFLAG_RD | CTLFLAG_STATS,
stdp-std_get_hiwat, 0, );
-   SYSCTL_ADD_UINT(device_get_sysctl_ctx(sc-dev),
-   SYSCTL_CHILDREN(txq_node), OID_AUTO,
-   dpl_put_hiwat, CTLFLAG_RD | CTLFLAG_STATS,
+   SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(dpl_node), OID_AUTO,
+   put_hiwat, CTLFLAG_RD | CTLFLAG_STATS,
stdp-std_put_hiwat, 0, );
 #endif
 
@@ -1501,6 +1505,7 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
 
return (0);
 
+fail_dpl_node:
 fail_tx_dpl_put_max:
 fail_tx_dpl_get_max:
 fail3:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280164 - head/sys/dev/sfxge

2015-03-17 Thread Andrew Rybchenko
Author: arybchik
Date: Tue Mar 17 08:23:46 2015
New Revision: 280164
URL: https://svnweb.freebsd.org/changeset/base/280164

Log:
  sfxge: increase default put-list limit to 1024
  
  Drops are observed under multi-stream TCP traffic due to put-list
  overflow with limit equal to 64.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_tx.h

Modified: head/sys/dev/sfxge/sfxge_tx.h
==
--- head/sys/dev/sfxge/sfxge_tx.h   Tue Mar 17 08:23:15 2015
(r280163)
+++ head/sys/dev/sfxge/sfxge_tx.h   Tue Mar 17 08:23:46 2015
(r280164)
@@ -81,7 +81,7 @@ struct sfxge_tx_mapping {
 
 #defineSFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT  (64 * 1024)
 #defineSFXGE_TX_DPL_GET_NON_TCP_PKT_LIMIT_DEFAULT  1024
-#defineSFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT  64
+#defineSFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT  1024
 
 /*
  * Deferred packet list.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280432 - head/sys/dev/sfxge

2015-03-24 Thread Andrew Rybchenko
Author: arybchik
Date: Tue Mar 24 11:25:19 2015
New Revision: 280432
URL: https://svnweb.freebsd.org/changeset/base/280432

Log:
  sfxge: cleanup: add a blank line before each #if to improve readability
  
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  head/sys/dev/sfxge/sfxge.h

Modified: head/sys/dev/sfxge/sfxge.h
==
--- head/sys/dev/sfxge/sfxge.h  Tue Mar 24 11:22:12 2015(r280431)
+++ head/sys/dev/sfxge/sfxge.h  Tue Mar 24 11:25:19 2015(r280432)
@@ -55,25 +55,32 @@
  */
 #defineCACHE_LINE_SIZE 128
 #endif
+
 #ifndef IFCAP_LINKSTATE
 #defineIFCAP_LINKSTATE 0
 #endif
+
 #ifndef IFCAP_VLAN_HWTSO
 #defineIFCAP_VLAN_HWTSO 0
 #endif
+
 #ifndef IFM_10G_T
 #defineIFM_10G_T IFM_UNKNOWN
 #endif
+
 #ifndef IFM_10G_KX4
 #defineIFM_10G_KX4 IFM_10G_CX4
 #endif
+
 #if (__FreeBSD_version = 800501  __FreeBSD_version  90) || \
__FreeBSD_version = 93
 #defineSFXGE_HAVE_DESCRIBE_INTR
 #endif
+
 #ifdef IFM_ETH_RXPAUSE
 #defineSFXGE_HAVE_PAUSE_MEDIAOPTS
 #endif
+
 #ifndef CTLTYPE_U64
 #defineCTLTYPE_U64 CTLTYPE_QUAD
 #endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280433 - head/sys/dev/sfxge

2015-03-24 Thread Andrew Rybchenko
Author: arybchik
Date: Tue Mar 24 11:33:34 2015
New Revision: 280433
URL: https://svnweb.freebsd.org/changeset/base/280433

Log:
  sfxge: cleanup: fix index variable type to match upper boundary type
  
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Tue Mar 24 11:25:19 2015
(r280432)
+++ head/sys/dev/sfxge/sfxge_tx.c   Tue Mar 24 11:33:34 2015
(r280433)
@@ -667,7 +667,7 @@ void
 sfxge_if_qflush(struct ifnet *ifp)
 {
struct sfxge_softc *sc;
-   int i;
+   unsigned int i;
 
sc = ifp-if_softc;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280431 - head/sys/modules/sfxge

2015-03-24 Thread Andrew Rybchenko
Author: arybchik
Date: Tue Mar 24 11:22:12 2015
New Revision: 280431
URL: https://svnweb.freebsd.org/changeset/base/280431

Log:
  sfxge: cleanup: remove trailing whitespaces
  
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  head/sys/modules/sfxge/Makefile

Modified: head/sys/modules/sfxge/Makefile
==
--- head/sys/modules/sfxge/Makefile Tue Mar 24 09:46:47 2015
(r280430)
+++ head/sys/modules/sfxge/Makefile Tue Mar 24 11:22:12 2015
(r280431)
@@ -14,7 +14,7 @@ SRCS+=sfxge_port.c sfxge_rx.c sfxge_tx.
 SRCS+= sfxge.h sfxge_rx.h sfxge_tx.h sfxge_version.h
 
 .PATH: ${.CURDIR}/../../dev/sfxge/common
-SRCS+= efx_ev.c efx_intr.c efx_mac.c efx_mcdi.c efx_nic.c 
+SRCS+= efx_ev.c efx_intr.c efx_mac.c efx_mcdi.c efx_nic.c
 SRCS+= efx_nvram.c efx_phy.c efx_port.c efx_rx.c efx_sram.c efx_tx.c
 SRCS+= efx_vpd.c efx_wol.c
 SRCS+= efsys.h
@@ -22,7 +22,7 @@ SRCS+=efx.h efx_impl.h efx_mcdi.h efx_r
 SRCS+= efx_regs_mcdi.h efx_regs_pci.h efx_types.h
 
 SRCS+= siena_mac.c siena_nic.c siena_nvram.c siena_phy.c
-SRCS+= siena_sram.c siena_vpd.c 
+SRCS+= siena_sram.c siena_vpd.c
 SRCS+= siena_flash.h siena_impl.h
 
 DEBUG_FLAGS= -DDEBUG=1
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280496 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 09:40:48 2015
New Revision: 280496
URL: https://svnweb.freebsd.org/changeset/base/280496

Log:
  MFC: 263297
  
  Return error when packet is dropped because of link down.
  
  Submitted by:   Boris Misenov Boris.Misenov at oktetlabs.ru
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 08:55:34 2015
(r280495)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 09:40:48 2015
(r280496)
@@ -604,7 +604,7 @@ sfxge_if_transmit(struct ifnet *ifp, str
 
if (!SFXGE_LINK_UP(sc)) {
m_freem(m);
-   return (0);
+   return (ENETDOWN);
}
 
/* Pick the desired transmit queue. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280497 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 09:45:07 2015
New Revision: 280497
URL: https://svnweb.freebsd.org/changeset/base/280497

Log:
  MFC: 263332
  
  Add counter for Tx errors returned from if_transmit.
  
  Submitted by:   Boris Misenov Boris.Misenov at oktetlabs.ru
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.c
  stable/10/sys/dev/sfxge/sfxge_tx.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 09:40:48 2015
(r280496)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 09:45:07 2015
(r280497)
@@ -515,6 +515,11 @@ sfxge_tx_packet_add(struct sfxge_txq *tx
int locked;
int rc;
 
+   if (!SFXGE_LINK_UP(txq-sc)) {
+   rc = ENETDOWN;
+   goto fail;
+   }
+
/*
 * Try to grab the txq lock.  If we are able to get the lock,
 * the packet will be appended to the get list of the deferred
@@ -552,6 +557,7 @@ sfxge_tx_packet_add(struct sfxge_txq *tx
 
 fail:
m_freem(m);
+   atomic_add_long(txq-early_drops, 1);
return (rc);

 }
@@ -602,11 +608,6 @@ sfxge_if_transmit(struct ifnet *ifp, str
 
KASSERT(ifp-if_flags  IFF_UP, (interface not up));
 
-   if (!SFXGE_LINK_UP(sc)) {
-   m_freem(m);
-   return (ENETDOWN);
-   }
-
/* Pick the desired transmit queue. */
if (m-m_pkthdr.csum_flags  (CSUM_DELAY_DATA | CSUM_TSO)) {
int index = 0;
@@ -1406,6 +1407,7 @@ static const struct {
SFXGE_TX_STAT(tso_long_headers, tso_long_headers),
SFXGE_TX_STAT(tx_collapses, collapses),
SFXGE_TX_STAT(tx_drops, drops),
+   SFXGE_TX_STAT(tx_early_drops, early_drops),
 };
 
 static int

Modified: stable/10/sys/dev/sfxge/sfxge_tx.h
==
--- stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 09:40:48 2015
(r280496)
+++ stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 09:45:07 2015
(r280497)
@@ -159,6 +159,7 @@ struct sfxge_txq {
unsigned long   tso_long_headers;
unsigned long   collapses;
unsigned long   drops;
+   unsigned long   early_drops;
 
/* The following fields change more often, and are used mostly
 * on the completion path
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280503 - stable/10/share/man/man4

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:02:14 2015
New Revision: 280503
URL: https://svnweb.freebsd.org/changeset/base/280503

Log:
  MFC: 272329
  
  Update SolarFlare driver manual page with new tunables.
  
  Submitted by:   Andrew Rybchenko arybchenko at solarflare.com
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  stable/10/share/man/man4/sfxge.4
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/sfxge.4
==
--- stable/10/share/man/man4/sfxge.4Wed Mar 25 10:01:07 2015
(r280502)
+++ stable/10/share/man/man4/sfxge.4Wed Mar 25 10:02:14 2015
(r280503)
@@ -76,6 +76,32 @@ The
 .Nm
 driver supports all 10Gb Ethernet adapters based on Solarflare SFC9000
 family controllers.
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+Actual values can be obtained using
+.Xr sysctl 8 .
+.Bl -tag -width indent
+.It Va hw.sfxge.rx_ring
+Maximum number of descriptors in a receive queue ring.
+Supported values are: 512, 1024, 2048 and 4096.
+.It Va hw.sfxge.tx_ring
+Maximum number of descriptors in a transmit queue ring.
+Supported values are: 512, 1024, 2048 and 4096.
+.It Va hw.sfxge.tx_dpl_get_max
+The maximum length of the deferred packet 'get-list' for queued transmit
+packets, used only if the transmit queue lock can be acquired.
+If packet is dropped, \fItx_early_drops\fR counter grows and local sender
+gets ENOBUFS error.
+Value must be greater than 0.
+.It Va hw.sfxge.tx_dpl_put_max
+The maximum length of the deferred packet 'put-list' for queued transmit
+packets, used if the transmit queue lock cannot be acquired.
+If packet is dropped, \fItx_early_drops\fR counter grows and local sender
+gets ENOBUFS error.
+Value must be greater or equal to 0.
 .Sh SUPPORT
 For general information and support,
 go to the Solarflare support website at:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280506 - stable/10/share/man/man4

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:06:26 2015
New Revision: 280506
URL: https://svnweb.freebsd.org/changeset/base/280506

Log:
  MFC: 272377
  
  Some cleanup for sfxge.4
  
  Use standard mdoc macros instead of pure roff, fix some other mdoc
  usage,
  make the style consistent, and fix some grammar issues.
  
  Approved by:hrs (mentor)

Modified:
  stable/10/share/man/man4/sfxge.4
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/sfxge.4
==
--- stable/10/share/man/man4/sfxge.4Wed Mar 25 10:05:19 2015
(r280505)
+++ stable/10/share/man/man4/sfxge.4Wed Mar 25 10:06:26 2015
(r280506)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 8, 2012
+.Dd September 30, 2014
 .Dt SFXGE 4
 .Os
 .Sh NAME
@@ -85,23 +85,30 @@ Actual values can be obtained using
 .Xr sysctl 8 .
 .Bl -tag -width indent
 .It Va hw.sfxge.rx_ring
-Maximum number of descriptors in a receive queue ring.
+The maximum number of descriptors in a receive queue ring.
 Supported values are: 512, 1024, 2048 and 4096.
 .It Va hw.sfxge.tx_ring
-Maximum number of descriptors in a transmit queue ring.
+The maximum number of descriptors in a transmit queue ring.
 Supported values are: 512, 1024, 2048 and 4096.
 .It Va hw.sfxge.tx_dpl_get_max
-The maximum length of the deferred packet 'get-list' for queued transmit
+The maximum length of the deferred packet
+.Dq get-list
+for queued transmit
 packets, used only if the transmit queue lock can be acquired.
-If packet is dropped, \fItx_early_drops\fR counter grows and local sender
-gets ENOBUFS error.
-Value must be greater than 0.
+If a packet is dropped, the
+.Va tx_early_drops
+counter is incremented and the local sender receives ENOBUFS.
+The value must be greater than 0.
 .It Va hw.sfxge.tx_dpl_put_max
-The maximum length of the deferred packet 'put-list' for queued transmit
+The maximum length of the deferred packet
+.Dq put-list
+for queued transmit
 packets, used if the transmit queue lock cannot be acquired.
-If packet is dropped, \fItx_early_drops\fR counter grows and local sender
-gets ENOBUFS error.
-Value must be greater or equal to 0.
+If a packet is dropped, the
+.Va tx_early_drops
+counter is incremented and the local sender receives ENOBUFS.
+The value must be greater than or equal to 0.
+.El
 .Sh SUPPORT
 For general information and support,
 go to the Solarflare support website at:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280508 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:11:17 2015
New Revision: 280508
URL: https://svnweb.freebsd.org/changeset/base/280508

Log:
  MFC: 277884
  
  sfxge: Change sfxge_ev_qpoll() proto to avoid EVQ pointers array access
  
  It was the only place on data path where sc-evq array is accessed.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge.h
  stable/10/sys/dev/sfxge/sfxge_ev.c
  stable/10/sys/dev/sfxge/sfxge_intr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge.h
==
--- stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 10:08:28 2015
(r280507)
+++ stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 10:11:17 2015
(r280508)
@@ -280,7 +280,7 @@ extern int sfxge_ev_init(struct sfxge_so
 extern void sfxge_ev_fini(struct sfxge_softc *sc);
 extern int sfxge_ev_start(struct sfxge_softc *sc);
 extern void sfxge_ev_stop(struct sfxge_softc *sc);
-extern int sfxge_ev_qpoll(struct sfxge_softc *sc, unsigned int index);
+extern int sfxge_ev_qpoll(struct sfxge_evq *evq);
 
 /*
  * From sfxge_intr.c.

Modified: stable/10/sys/dev/sfxge/sfxge_ev.c
==
--- stable/10/sys/dev/sfxge/sfxge_ev.c  Wed Mar 25 10:08:28 2015
(r280507)
+++ stable/10/sys/dev/sfxge/sfxge_ev.c  Wed Mar 25 10:11:17 2015
(r280508)
@@ -564,13 +564,10 @@ static const efx_ev_callbacks_t sfxge_ev
 
 
 int
-sfxge_ev_qpoll(struct sfxge_softc *sc, unsigned int index)
+sfxge_ev_qpoll(struct sfxge_evq *evq)
 {
-   struct sfxge_evq *evq;
int rc;
 
-   evq = sc-evq[index];
-
mtx_lock(evq-lock);
 
if (evq-init_state != SFXGE_EVQ_STARTING 

Modified: stable/10/sys/dev/sfxge/sfxge_intr.c
==
--- stable/10/sys/dev/sfxge/sfxge_intr.cWed Mar 25 10:08:28 2015
(r280507)
+++ stable/10/sys/dev/sfxge/sfxge_intr.cWed Mar 25 10:11:17 2015
(r280508)
@@ -106,9 +106,8 @@ static void
 sfxge_intr_line(void *arg)
 {
struct sfxge_evq *evq = arg;
-   struct sfxge_softc *sc = evq-sc;
 
-   (void)sfxge_ev_qpoll(sc, 0);
+   (void)sfxge_ev_qpoll(evq);
 }
 
 static void
@@ -142,7 +141,7 @@ sfxge_intr_message(void *arg)
return;
}
 
-   (void)sfxge_ev_qpoll(sc, index);
+   (void)sfxge_ev_qpoll(evq);
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280513 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:17:24 2015
New Revision: 280513
URL: https://svnweb.freebsd.org/changeset/base/280513

Log:
  MFC: 277889
  
  sfxge: Add evq argument to sfxge_tx_qcomplete()
  
  It removes necessity to get evq pointer by its index in soft context.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_ev.c
  stable/10/sys/dev/sfxge/sfxge_tx.c
  stable/10/sys/dev/sfxge/sfxge_tx.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_ev.c
==
--- stable/10/sys/dev/sfxge/sfxge_ev.c  Wed Mar 25 10:16:33 2015
(r280512)
+++ stable/10/sys/dev/sfxge/sfxge_ev.c  Wed Mar 25 10:17:24 2015
(r280513)
@@ -63,7 +63,7 @@ sfxge_ev_qcomplete(struct sfxge_evq *evq
(txq-evq_index != index));
 
if (txq-pending != txq-completed)
-   sfxge_tx_qcomplete(txq);
+   sfxge_tx_qcomplete(txq, evq);
 
txq = next;
} while (txq != NULL);
@@ -257,7 +257,7 @@ sfxge_ev_tx(void *arg, uint32_t label, u
}
 
if (txq-pending - txq-completed = SFXGE_TX_BATCH)
-   sfxge_tx_qcomplete(txq);
+   sfxge_tx_qcomplete(txq, evq);
 
 done:
return (evq-tx_done = SFXGE_EV_BATCH);

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:16:33 2015
(r280512)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:17:24 2015
(r280513)
@@ -105,15 +105,10 @@ static int sfxge_tx_queue_tso(struct sfx
  const bus_dma_segment_t *dma_seg, int n_dma_seg);
 
 void
-sfxge_tx_qcomplete(struct sfxge_txq *txq)
+sfxge_tx_qcomplete(struct sfxge_txq *txq, struct sfxge_evq *evq)
 {
-   struct sfxge_softc *sc;
-   struct sfxge_evq *evq;
unsigned int completed;
 
-   sc = txq-sc;
-   evq = sc-evq[txq-evq_index];
-
mtx_assert(evq-lock, MA_OWNED);
 
completed = txq-completed;
@@ -1146,7 +1141,7 @@ sfxge_tx_qstop(struct sfxge_softc *sc, u
txq-blocked = 0;
txq-pending = txq-added;
 
-   sfxge_tx_qcomplete(txq);
+   sfxge_tx_qcomplete(txq, evq);
KASSERT(txq-completed == txq-added,
(txq-completed != txq-added));
 

Modified: stable/10/sys/dev/sfxge/sfxge_tx.h
==
--- stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 10:16:33 2015
(r280512)
+++ stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 10:17:24 2015
(r280513)
@@ -175,13 +175,15 @@ struct sfxge_txq {
struct sfxge_txq*next;
 };
 
+struct sfxge_evq;
+
 extern int sfxge_tx_packet_add(struct sfxge_txq *, struct mbuf *);
 
 extern int sfxge_tx_init(struct sfxge_softc *sc);
 extern void sfxge_tx_fini(struct sfxge_softc *sc);
 extern int sfxge_tx_start(struct sfxge_softc *sc);
 extern void sfxge_tx_stop(struct sfxge_softc *sc);
-extern void sfxge_tx_qcomplete(struct sfxge_txq *txq);
+extern void sfxge_tx_qcomplete(struct sfxge_txq *txq, struct sfxge_evq *evq);
 extern void sfxge_tx_qflush_done(struct sfxge_txq *txq);
 #ifdef SFXGE_HAVE_MQ
 extern void sfxge_if_qflush(struct ifnet *ifp);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280512 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:16:33 2015
New Revision: 280512
URL: https://svnweb.freebsd.org/changeset/base/280512

Log:
  MFC: 277888
  
  sfxge: fixed TSO code to cope with VLAN headers
  
  Submitted by:   Artem V. Andreev Artem.Andreev at oktetlabs.ru
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:14:30 2015
(r280511)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:16:33 2015
(r280512)
@@ -854,9 +854,7 @@ static void tso_start(struct sfxge_tso_s
tso-tcph_off = tso-nh_off + sizeof(struct ip6_hdr);
}
 
-   /* We assume all headers are linear in the head mbuf */
tso-header_len = tso-tcph_off + 4 * tso_tcph(tso)-th_off;
-   KASSERT(tso-header_len = mbuf-m_len, (packet headers fragmented));
tso-full_packet_size = tso-header_len + mbuf-m_pkthdr.tso_segsz;
 
tso-seqnum = ntohl(tso_tcph(tso)-th_seq);
@@ -971,7 +969,7 @@ static int tso_start_new_packet(struct s
tsoh_th = (struct tcphdr *)(header + tso-tcph_off);
 
/* Copy and update the headers. */
-   memcpy(header, tso-mbuf-m_data, tso-header_len);
+   m_copydata(tso-mbuf, 0, tso-header_len, header);
 
tsoh_th-th_seq = htonl(tso-seqnum);
tso-seqnum += tso-mbuf-m_pkthdr.tso_segsz;
@@ -1017,20 +1015,18 @@ sfxge_tx_queue_tso(struct sfxge_txq *txq
 {
struct sfxge_tso_state tso;
unsigned int id, next_id;
+   unsigned skipped = 0;
 
tso_start(tso, mbuf);
 
-   /* Grab the first payload fragment. */
-   if (dma_seg-ds_len == tso.header_len) {
+   while (dma_seg-ds_len + skipped = tso.header_len) {
+   skipped += dma_seg-ds_len;
--n_dma_seg;
KASSERT(n_dma_seg, (no payload found in TSO packet));
++dma_seg;
-   tso.in_len = dma_seg-ds_len;
-   tso.dma_addr = dma_seg-ds_addr;
-   } else {
-   tso.in_len = dma_seg-ds_len - tso.header_len;
-   tso.dma_addr = dma_seg-ds_addr + tso.header_len;
}
+   tso.in_len = dma_seg-ds_len + (tso.header_len - skipped);
+   tso.dma_addr = dma_seg-ds_addr + (tso.header_len - skipped);
 
id = txq-added  txq-ptr_mask;
if (__predict_false(tso_start_new_packet(txq, tso, id)))
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280514 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:18:23 2015
New Revision: 280514
URL: https://svnweb.freebsd.org/changeset/base/280514

Log:
  MFC: 277890
  
  sfxge: Do not bzero() DMA allocated memory once again
  
  sfxge_dma_alloc() calls bus_dmamem_alloc() with BUS_DMA_ZERO flag, so
  allocated memory is already filled in by zeros
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_port.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_port.c
==
--- stable/10/sys/dev/sfxge/sfxge_port.cWed Mar 25 10:17:24 2015
(r280513)
+++ stable/10/sys/dev/sfxge/sfxge_port.cWed Mar 25 10:18:23 2015
(r280514)
@@ -583,7 +583,6 @@ sfxge_port_init(struct sfxge_softc *sc)
M_SFXGE, M_WAITOK | M_ZERO);
if ((rc = sfxge_dma_alloc(sc, EFX_PHY_STATS_SIZE, phy_stats_buf)) != 0)
goto fail;
-   bzero(phy_stats_buf-esm_base, phy_stats_buf-esm_size);
sfxge_phy_stat_init(sc);
 
sysctl_ctx = device_get_sysctl_ctx(sc-dev);
@@ -605,7 +604,6 @@ sfxge_port_init(struct sfxge_softc *sc)
M_SFXGE, M_WAITOK | M_ZERO);
if ((rc = sfxge_dma_alloc(sc, EFX_MAC_STATS_SIZE, mac_stats_buf)) != 0)
goto fail2;
-   bzero(mac_stats_buf-esm_base, mac_stats_buf-esm_size);
sfxge_mac_stat_init(sc);
 
port-init_state = SFXGE_PORT_INITIALIZED;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280519 - in stable/10: share/man/man4 sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:25:45 2015
New Revision: 280519
URL: https://svnweb.freebsd.org/changeset/base/280519

Log:
  MFC: 277895
  
  sfxge: Separate software Tx queue limit for non-TCP traffic
  
  Add separate software Tx queue limit for non-TCP traffic to make total
  limit higher and avoid local drops of TCP packets because of no
  backpressure.
  There is no point to make non-TCP limit high since without backpressure
  UDP stream easily overflows any sensible limit.
  
  Split early drops statistics since it is better to have separate counter
  for each drop reason to make it unabmiguous.
  
  Add software Tx queue high watermark. The information is very useful to
  understand how big queues grow under traffic load.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/share/man/man4/sfxge.4
  stable/10/sys/dev/sfxge/sfxge_tx.c
  stable/10/sys/dev/sfxge/sfxge_tx.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/sfxge.4
==
--- stable/10/share/man/man4/sfxge.4Wed Mar 25 10:23:00 2015
(r280518)
+++ stable/10/share/man/man4/sfxge.4Wed Mar 25 10:25:45 2015
(r280519)
@@ -93,10 +93,18 @@ Supported values are: 512, 1024, 2048 an
 .It Va hw.sfxge.tx_dpl_get_max
 The maximum length of the deferred packet
 .Dq get-list
-for queued transmit
-packets, used only if the transmit queue lock can be acquired.
+for queued transmit packets (TCP and non-TCP), used only if the transmit
+queue lock can be acquired.
 If a packet is dropped, the
-.Va tx_early_drops
+.Va tx_get_overflow
+counter is incremented and the local sender receives ENOBUFS.
+The value must be greater than 0.
+.It Va hw.sfxge.tx_dpl_get_non_tcp_max
+The maximum number of non-TCP packets in the deferred packet
+.Dq get-list
+, used only if the transmit queue lock can be acquired.
+If packet is dropped, the
+.Va tx_get_non_tcp_overflow
 counter is incremented and the local sender receives ENOBUFS.
 The value must be greater than 0.
 .It Va hw.sfxge.tx_dpl_put_max
@@ -105,7 +113,7 @@ The maximum length of the deferred packe
 for queued transmit
 packets, used if the transmit queue lock cannot be acquired.
 If a packet is dropped, the
-.Va tx_early_drops
+.Va tx_put_overflow
 counter is incremented and the local sender receives ENOBUFS.
 The value must be greater than or equal to 0.
 .It Va hw.sfxge.N.max_rss_channels

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:23:00 2015
(r280518)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:25:45 2015
(r280519)
@@ -85,14 +85,23 @@ static int sfxge_tx_dpl_get_max = SFXGE_
 TUNABLE_INT(SFXGE_PARAM_TX_DPL_GET_MAX, sfxge_tx_dpl_get_max);
 SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_dpl_get_max, CTLFLAG_RDTUN,
   sfxge_tx_dpl_get_max, 0,
-  Maximum number of packets in deferred packet get-list);
+  Maximum number of any packets in deferred packet get-list);
+
+#defineSFXGE_PARAM_TX_DPL_GET_NON_TCP_MAX \
+   SFXGE_PARAM(tx_dpl_get_non_tcp_max)
+static int sfxge_tx_dpl_get_non_tcp_max =
+   SFXGE_TX_DPL_GET_NON_TCP_PKT_LIMIT_DEFAULT;
+TUNABLE_INT(SFXGE_PARAM_TX_DPL_GET_NON_TCP_MAX, sfxge_tx_dpl_get_non_tcp_max);
+SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_dpl_get_non_tcp_max, CTLFLAG_RDTUN,
+  sfxge_tx_dpl_get_non_tcp_max, 0,
+  Maximum number of non-TCP packets in deferred packet get-list);
 
 #defineSFXGE_PARAM_TX_DPL_PUT_MAX  SFXGE_PARAM(tx_dpl_put_max)
 static int sfxge_tx_dpl_put_max = SFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT;
 TUNABLE_INT(SFXGE_PARAM_TX_DPL_PUT_MAX, sfxge_tx_dpl_put_max);
 SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_dpl_put_max, CTLFLAG_RDTUN,
   sfxge_tx_dpl_put_max, 0,
-  Maximum number of packets in deferred packet put-list);
+  Maximum number of any packets in deferred packet put-list);
 
 #endif
 
@@ -147,6 +156,15 @@ sfxge_tx_qcomplete(struct sfxge_txq *txq
 
 #ifdef SFXGE_HAVE_MQ
 
+static inline unsigned int
+sfxge_is_mbuf_non_tcp(struct mbuf *mbuf)
+{
+   /* Absense of TCP checksum flags does not mean that it is non-TCP
+* but it should be true if user wants to achieve high throughput.
+*/
+   return (!(mbuf-m_pkthdr.csum_flags  (CSUM_IP_TCP | CSUM_IP6_TCP)));
+}
+
 /*
  * Reorder the put list and append it to the get list.
  */
@@ -158,6 +176,7 @@ sfxge_tx_qdpl_swizzle(struct sfxge_txq *
volatile uintptr_t *putp;
uintptr_t put;
unsigned int count;
+   unsigned int non_tcp_count;
 
mtx_assert(txq-lock, MA_OWNED);
 
@@ -176,9 +195,11 @@ sfxge_tx_qdpl_swizzle(struct sfxge_txq *
get_next = NULL;
 
count = 0;
+   non_tcp_count = 0;
do {
struct mbuf *put_next;
 
+   

svn commit: r280523 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:29:08 2015
New Revision: 280523
URL: https://svnweb.freebsd.org/changeset/base/280523

Log:
  MFC: 278248
  
  sfxge: access statistics buffers under port lock
  
  Allow access to statistics data not only from sysctl handlers.
  
  Submitted by:   Boris Misenov Boris.Misenov at oktetlabs.ru
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_port.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_port.c
==
--- stable/10/sys/dev/sfxge/sfxge_port.cWed Mar 25 10:27:54 2015
(r280522)
+++ stable/10/sys/dev/sfxge/sfxge_port.cWed Mar 25 10:29:08 2015
(r280523)
@@ -48,7 +48,7 @@ sfxge_mac_stat_update(struct sfxge_softc
unsigned int count;
int rc;
 
-   SFXGE_PORT_LOCK(port);
+   SFXGE_PORT_LOCK_ASSERT_OWNED(port);
 
if (port-init_state != SFXGE_PORT_STARTED) {
rc = 0;
@@ -82,7 +82,6 @@ sfxge_mac_stat_update(struct sfxge_softc
 
rc = ETIMEDOUT;
 out:
-   SFXGE_PORT_UNLOCK(port);
return (rc);
 }
 
@@ -93,12 +92,16 @@ sfxge_mac_stat_handler(SYSCTL_HANDLER_AR
unsigned int id = arg2;
int rc;
 
+   SFXGE_PORT_LOCK(sc-port);
if ((rc = sfxge_mac_stat_update(sc)) != 0)
-   return (rc);
+   goto out;
 
-   return (SYSCTL_OUT(req,
- (uint64_t *)sc-port.mac_stats.decode_buf + id,
- sizeof(uint64_t)));
+   rc = SYSCTL_OUT(req,
+   (uint64_t *)sc-port.mac_stats.decode_buf + id,
+   sizeof(uint64_t));
+out:
+   SFXGE_PORT_UNLOCK(sc-port);
+   return (rc);
 }
 
 static void
@@ -453,7 +456,7 @@ sfxge_phy_stat_update(struct sfxge_softc
unsigned int count;
int rc;
 
-   SFXGE_PORT_LOCK(port);
+   SFXGE_PORT_LOCK_ASSERT_OWNED(port);
 
if (port-init_state != SFXGE_PORT_STARTED) {
rc = 0;
@@ -487,7 +490,6 @@ sfxge_phy_stat_update(struct sfxge_softc
 
rc = ETIMEDOUT;
 out:
-   SFXGE_PORT_UNLOCK(port);
return (rc);
 }
 
@@ -498,12 +500,16 @@ sfxge_phy_stat_handler(SYSCTL_HANDLER_AR
unsigned int id = arg2;
int rc;
 
+   SFXGE_PORT_LOCK(sc-port);
if ((rc = sfxge_phy_stat_update(sc)) != 0)
-   return (rc);
+   goto out;
 
-   return (SYSCTL_OUT(req,
- (uint32_t *)sc-port.phy_stats.decode_buf + id,
- sizeof(uint32_t)));
+   rc = SYSCTL_OUT(req,
+   (uint32_t *)sc-port.phy_stats.decode_buf + id,
+   sizeof(uint32_t));
+out:
+   SFXGE_PORT_UNLOCK(sc-port);
+   return (rc);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280525 - stable/10/sys/dev/sfxge/common

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:31:43 2015
New Revision: 280525
URL: https://svnweb.freebsd.org/changeset/base/280525

Log:
  MFC: 278254
  
  sfxge: using 64-bit access for x86-64
  
  Submitted by:   Artem V. Andreev Artem.Andreev at oktetlabs.ru
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/common/efsys.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/efsys.h
==
--- stable/10/sys/dev/sfxge/common/efsys.h  Wed Mar 25 10:30:45 2015
(r280524)
+++ stable/10/sys/dev/sfxge/common/efsys.h  Wed Mar 25 10:31:43 2015
(r280525)
@@ -51,7 +51,11 @@ extern C {
 #include machine/endian.h
 
 #defineEFSYS_HAS_UINT64 1
+#if defined(__x86_64__)
+#defineEFSYS_USE_UINT64 1
+#else
 #defineEFSYS_USE_UINT64 0
+#endif
 #if _BYTE_ORDER == _BIG_ENDIAN
 #defineEFSYS_IS_BIG_ENDIAN 1
 #defineEFSYS_IS_LITTLE_ENDIAN 0
@@ -398,6 +402,26 @@ typedef struct efsys_mem_s {
_NOTE(CONSTANTCONDITION)\
} while (B_FALSE)
 
+#if defined(__x86_64__)
+#defineEFSYS_MEM_READQ(_esmp, _offset, _eqp)   
\
+   do {\
+   uint64_t *addr; \
+   \
+   _NOTE(CONSTANTCONDITION)\
+   KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)),\
+   (not power of 2 aligned));\
+   \
+   addr = (void *)((_esmp)-esm_base + (_offset)); \
+   \
+   (_eqp)-eq_u64[0] = *addr;  \
+   \
+   EFSYS_PROBE3(mem_readq, unsigned int, (_offset),\
+   uint32_t, (_eqp)-eq_u32[1],\
+   uint32_t, (_eqp)-eq_u32[0]);   \
+   \
+   _NOTE(CONSTANTCONDITION)\
+   } while (B_FALSE)
+#else
 #defineEFSYS_MEM_READQ(_esmp, _offset, _eqp)   
\
do {\
uint32_t *addr; \
@@ -417,7 +441,31 @@ typedef struct efsys_mem_s {
\
_NOTE(CONSTANTCONDITION)\
} while (B_FALSE)
+#endif
 
+#if defined(__x86_64__)
+#defineEFSYS_MEM_READO(_esmp, _offset, _eop)   
\
+   do {\
+   uint64_t *addr; \
+   \
+   _NOTE(CONSTANTCONDITION)\
+   KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_oword_t)),\
+   (not power of 2 aligned));\
+   \
+   addr = (void *)((_esmp)-esm_base + (_offset)); \
+   \
+   (_eop)-eo_u64[0] = *addr++;\
+   (_eop)-eo_u64[1] = *addr;  \
+   \
+   EFSYS_PROBE5(mem_reado, unsigned int, (_offset),\
+   uint32_t, (_eop)-eo_u32[3],\
+   uint32_t, (_eop)-eo_u32[2],\
+   uint32_t, (_eop)-eo_u32[1],\
+   uint32_t, (_eop)-eo_u32[0]);   \
+   \
+   _NOTE(CONSTANTCONDITION)\
+   } while (B_FALSE)
+#else
 #defineEFSYS_MEM_READO(_esmp, _offset, _eop)   
\
do {\
uint32_t *addr; \
@@ -441,6 +489,7 @@ typedef struct efsys_mem_s {
\
_NOTE(CONSTANTCONDITION)\
} while (B_FALSE)

svn commit: r280530 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:36:37 2015
New Revision: 280530
URL: https://svnweb.freebsd.org/changeset/base/280530

Log:
  MFC: 278836
  
  sfxge: remove used sfxge_tso_state member dma_seg_i
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:35:54 2015
(r280529)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:36:37 2015
(r280530)
@@ -782,7 +782,6 @@ struct sfxge_tso_state {
unsigned packet_space;  /* Remaining space in current packet */
 
/* Input position */
-   unsigned dma_seg_i; /* Current DMA segment number */
uint64_t dma_addr;  /* DMA address of current position */
unsigned in_len;/* Remaining length in current mbuf */
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280499 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 09:56:48 2015
New Revision: 280499
URL: https://svnweb.freebsd.org/changeset/base/280499

Log:
  MFC: 263649
  
  sfxge: limit software Tx queue size.
  
  Previous implementation limits put queue size only (when Tx lock can't
  be acquired), but get queue may grow unboundedly which results in mbuf
  pools exhaustion and latency growth.
  
  Submitted by:   Andrew Rybchenko Andrew.Rybchenko at oktetlabs.ru
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.c
  stable/10/sys/dev/sfxge/sfxge_tx.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 09:54:07 2015
(r280498)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 09:56:48 2015
(r280499)
@@ -476,6 +476,9 @@ sfxge_tx_qdpl_put(struct sfxge_txq *txq,
 
sfxge_tx_qdpl_swizzle(txq);
 
+   if (stdp-std_count = SFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT)
+   return (ENOBUFS);
+
*(stdp-std_getp) = mbuf;
stdp-std_getp = mbuf-m_nextpkt;
stdp-std_count++;
@@ -495,8 +498,8 @@ sfxge_tx_qdpl_put(struct sfxge_txq *txq,
old_len = mp-m_pkthdr.csum_data;
} else
old_len = 0;
-   if (old_len = SFXGE_TX_MAX_DEFERRED)
-   return ENOBUFS;
+   if (old_len = SFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT)
+   return (ENOBUFS);
mbuf-m_pkthdr.csum_data = old_len + 1;
mbuf-m_nextpkt = (void *)old;
} while (atomic_cmpset_ptr(putp, old, new) == 0);
@@ -527,12 +530,9 @@ sfxge_tx_packet_add(struct sfxge_txq *tx
 */
locked = mtx_trylock(txq-lock);
 
-   /*
-* Can only fail if we weren't able to get the lock.
-*/
if (sfxge_tx_qdpl_put(txq, m, locked) != 0) {
-   KASSERT(!locked,
-   (sfxge_tx_qdpl_put() failed locked));
+   if (locked)
+   mtx_unlock(txq-lock);
rc = ENOBUFS;
goto fail;
}

Modified: stable/10/sys/dev/sfxge/sfxge_tx.h
==
--- stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 09:54:07 2015
(r280498)
+++ stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 09:56:48 2015
(r280499)
@@ -75,7 +75,8 @@ struct sfxge_tx_mapping {
enum sfxge_tx_buf_flags flags;
 };
 
-#define SFXGE_TX_MAX_DEFERRED 64
+#defineSFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT  64
+#defineSFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT  64
 
 /*
  * Deferred packet list.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280501 - in stable/10/sys/dev/sfxge: . common

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 09:59:38 2015
New Revision: 280501
URL: https://svnweb.freebsd.org/changeset/base/280501

Log:
  MFC: 272325
  
  cleanup: code style fixes
  
  Remove trailing whitespaces and tabs.
  Enclose value in return statements in parentheses.
  Use tabs after #define.
  Do not skip comparison with 0/NULL in boolean expressions.
  
  Submitted by:   Andrew Rybchenko arybchenko at solarflare.com
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  stable/10/sys/dev/sfxge/common/efsys.h
  stable/10/sys/dev/sfxge/sfxge.c
  stable/10/sys/dev/sfxge/sfxge.h
  stable/10/sys/dev/sfxge/sfxge_dma.c
  stable/10/sys/dev/sfxge/sfxge_ev.c
  stable/10/sys/dev/sfxge/sfxge_intr.c
  stable/10/sys/dev/sfxge/sfxge_port.c
  stable/10/sys/dev/sfxge/sfxge_rx.c
  stable/10/sys/dev/sfxge/sfxge_rx.h
  stable/10/sys/dev/sfxge/sfxge_tx.c
  stable/10/sys/dev/sfxge/sfxge_tx.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/efsys.h
==
--- stable/10/sys/dev/sfxge/common/efsys.h  Wed Mar 25 09:58:02 2015
(r280500)
+++ stable/10/sys/dev/sfxge/common/efsys.h  Wed Mar 25 09:59:38 2015
(r280501)
@@ -53,44 +53,44 @@ extern C {
 #defineEFSYS_HAS_UINT64 1
 #defineEFSYS_USE_UINT64 0
 #if _BYTE_ORDER == _BIG_ENDIAN
-#define EFSYS_IS_BIG_ENDIAN 1
-#define EFSYS_IS_LITTLE_ENDIAN 0
+#defineEFSYS_IS_BIG_ENDIAN 1
+#defineEFSYS_IS_LITTLE_ENDIAN 0
 #elif _BYTE_ORDER == _LITTLE_ENDIAN
-#define EFSYS_IS_BIG_ENDIAN 0
-#define EFSYS_IS_LITTLE_ENDIAN 1
+#defineEFSYS_IS_BIG_ENDIAN 0
+#defineEFSYS_IS_LITTLE_ENDIAN 1
 #endif
 #include efx_types.h
 
 /* Common code requires this */
 #if __FreeBSD_version  800068
-#define memmove(d, s, l) bcopy(s, d, l)
+#definememmove(d, s, l) bcopy(s, d, l)
 #endif
-   
+
 /* FreeBSD equivalents of Solaris things */
 #ifndef _NOTE
-#define _NOTE(s)
+#define_NOTE(s)
 #endif
 
 #ifndef B_FALSE
-#define B_FALSE FALSE
+#defineB_FALSE FALSE
 #endif
 #ifndef B_TRUE
-#define B_TRUE TRUE
+#defineB_TRUE  TRUE
 #endif
 
 #ifndef IS_P2ALIGNED
-#defineIS_P2ALIGNED(v, a) uintptr_t)(v))  ((uintptr_t)(a) - 1)) 
== 0)
+#defineIS_P2ALIGNED(v, a)  uintptr_t)(v))  ((uintptr_t)(a) - 
1)) == 0)
 #endif
 
 #ifndef P2ROUNDUP
-#define P2ROUNDUP(x, align) (-(-(x)  -(align)))
+#defineP2ROUNDUP(x, align) (-(-(x)  -(align)))
 #endif
 
 #ifndef IS2P
-#define ISP2(x) (((x)  ((x) - 1)) == 0)
+#defineISP2(x) (((x)  ((x) - 1)) == 0)
 #endif
 
-#define ENOTACTIVE EINVAL
+#defineENOTACTIVE EINVAL
 
 /* Memory type to use on FreeBSD */
 MALLOC_DECLARE(M_SFXGE);
@@ -242,7 +242,7 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, b
 #defineEFSYS_OPT_PHY_PROPS 0
 #defineEFSYS_OPT_PHY_BIST 1
 #defineEFSYS_OPT_PHY_LED_CONTROL 1
-#define EFSYS_OPT_PHY_FLAGS 0
+#defineEFSYS_OPT_PHY_FLAGS 0
 
 #defineEFSYS_OPT_VPD 1
 #defineEFSYS_OPT_NVRAM 1
@@ -256,8 +256,8 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, b
 #defineEFSYS_OPT_WOL 1
 #defineEFSYS_OPT_RX_SCALE 1
 #defineEFSYS_OPT_QSTATS 1
-#define EFSYS_OPT_FILTER 0
-#define EFSYS_OPT_RX_SCATTER 0
+#defineEFSYS_OPT_FILTER 0
+#defineEFSYS_OPT_RX_SCATTER 0
 #defineEFSYS_OPT_RX_HDR_SPLIT 0
 
 #defineEFSYS_OPT_EV_PREFETCH 0
@@ -272,7 +272,7 @@ typedef struct __efsys_identifier_s efsy
 
 #ifndef KDTRACE_HOOKS
 
-#define EFSYS_PROBE(_name)
+#defineEFSYS_PROBE(_name)
 
 #defineEFSYS_PROBE1(_name, _type1, _arg1)
 
@@ -815,16 +815,16 @@ extern void   sfxge_err(efsys_identifier_t
panic(#_exp);   \
} while (0)
 
-#define EFSYS_ASSERT3(_x, _op, _y, _t) do {\
+#defineEFSYS_ASSERT3(_x, _op, _y, _t) do { 
\
const _t __x = (_t)(_x);\
const _t __y = (_t)(_y);\
if (!(__x _op __y)) \
-   panic(assertion failed at %s:%u, __FILE__, __LINE__); \
+   panic(assertion failed at %s:%u, __FILE__, __LINE__); \
} while(0)
 
-#define EFSYS_ASSERT3U(_x, _op, _y)EFSYS_ASSERT3(_x, _op, _y, uint64_t)
-#define EFSYS_ASSERT3S(_x, _op, _y)EFSYS_ASSERT3(_x, _op, _y, int64_t)
-#define EFSYS_ASSERT3P(_x, _op, _y)EFSYS_ASSERT3(_x, _op, _y, uintptr_t)
+#defineEFSYS_ASSERT3U(_x, _op, _y) EFSYS_ASSERT3(_x, _op, _y, 
uint64_t)
+#defineEFSYS_ASSERT3S(_x, _op, _y) EFSYS_ASSERT3(_x, _op, _y, 
int64_t)
+#defineEFSYS_ASSERT3P(_x, _op, _y) EFSYS_ASSERT3(_x, _op, _y, 
uintptr_t)
 
 #ifdef __cplusplus
 }

Modified: stable/10/sys/dev/sfxge/sfxge.c

svn commit: r280504 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:03:41 2015
New Revision: 280504
URL: https://svnweb.freebsd.org/changeset/base/280504

Log:
  MFC: 272330
  
  The patch allows to check state of the software Tx queues at run time.
  
  Submitted by:   Andrew Rybchenko arybchenko at solarflare.com
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  stable/10/sys/dev/sfxge/sfxge.h
  stable/10/sys/dev/sfxge/sfxge_tx.c
  stable/10/sys/dev/sfxge/sfxge_tx.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge.h
==
--- stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 10:02:14 2015
(r280503)
+++ stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 10:03:41 2015
(r280504)
@@ -201,6 +201,7 @@ struct sfxge_softc {
struct ifnet*ifnet;
unsigned intif_flags;
struct sysctl_oid   *stats_node;
+   struct sysctl_oid   *txqs_node;
 
struct task task_reset;
 

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:02:14 2015
(r280503)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:03:41 2015
(r280504)
@@ -176,7 +176,7 @@ sfxge_tx_qdpl_swizzle(struct sfxge_txq *
KASSERT(*get_tailp == NULL, (*get_tailp != NULL));
*stdp-std_getp = get_next;
stdp-std_getp = get_tailp;
-   stdp-std_count += count;
+   stdp-std_get_count += count;
 }
 
 #endif /* SFXGE_HAVE_MQ */
@@ -380,7 +380,7 @@ sfxge_tx_qdpl_drain(struct sfxge_txq *tx
prefetch_read_many(txq-common);
 
mbuf = stdp-std_get;
-   count = stdp-std_count;
+   count = stdp-std_get_count;
 
while (count != 0) {
KASSERT(mbuf != NULL, (mbuf == NULL));
@@ -412,17 +412,17 @@ sfxge_tx_qdpl_drain(struct sfxge_txq *tx
if (count == 0) {
KASSERT(mbuf == NULL, (mbuf != NULL));
stdp-std_get = NULL;
-   stdp-std_count = 0;
+   stdp-std_get_count = 0;
stdp-std_getp = stdp-std_get;
} else {
stdp-std_get = mbuf;
-   stdp-std_count = count;
+   stdp-std_get_count = count;
}
 
if (txq-added != pushed)
efx_tx_qpush(txq-common, txq-added);
 
-   KASSERT(txq-blocked || stdp-std_count == 0,
+   KASSERT(txq-blocked || stdp-std_get_count == 0,
(queue unblocked but count is non-zero));
 }
 
@@ -476,12 +476,12 @@ sfxge_tx_qdpl_put(struct sfxge_txq *txq,
 
sfxge_tx_qdpl_swizzle(txq);
 
-   if (stdp-std_count = SFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT)
+   if (stdp-std_get_count = SFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT)
return (ENOBUFS);
 
*(stdp-std_getp) = mbuf;
stdp-std_getp = mbuf-m_nextpkt;
-   stdp-std_count++;
+   stdp-std_get_count++;
} else {
volatile uintptr_t *putp;
uintptr_t old;
@@ -575,7 +575,7 @@ sfxge_tx_qdpl_flush(struct sfxge_txq *tx
m_freem(mbuf);
}
stdp-std_get = NULL;
-   stdp-std_count = 0;
+   stdp-std_get_count = 0;
stdp-std_getp = stdp-std_get;
 
mtx_unlock(txq-lock);
@@ -1315,6 +1315,8 @@ static int
 sfxge_tx_qinit(struct sfxge_softc *sc, unsigned int txq_index,
 enum sfxge_txq_type type, unsigned int evq_index)
 {
+   char name[16];
+   struct sysctl_oid *txq_node;
struct sfxge_txq *txq;
struct sfxge_evq *evq;
 #ifdef SFXGE_HAVE_MQ
@@ -1367,6 +1369,16 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
goto fail2;
}
 
+   snprintf(name, sizeof(name), %u, txq_index);
+   txq_node = SYSCTL_ADD_NODE(
+   device_get_sysctl_ctx(sc-dev),
+   SYSCTL_CHILDREN(sc-txqs_node),
+   OID_AUTO, name, CTLFLAG_RD, NULL, );
+   if (txq_node == NULL) {
+   rc = ENOMEM;
+   goto fail_txq_node;
+   }
+
if (type == SFXGE_TXQ_IP_TCP_UDP_CKSUM 
(rc = tso_init(txq)) != 0)
goto fail3;
@@ -1377,6 +1389,11 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
stdp-std_getp = stdp-std_get;
 
mtx_init(txq-lock, txq, NULL, MTX_DEF);
+
+   SYSCTL_ADD_UINT(device_get_sysctl_ctx(sc-dev),
+   SYSCTL_CHILDREN(txq_node), OID_AUTO,
+   dpl_get_count, CTLFLAG_RD | CTLFLAG_STATS,
+   stdp-std_get_count, 0, );
 #endif
 
txq-type = type;
@@ -1387,6 +1404,7 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
return (0);
 
 fail3:
+fail_txq_node:
free(txq-pend_desc, M_SFXGE);
 fail2:
while (nmaps-- != 0)
@@ -1480,6 +1498,15

svn commit: r280507 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:08:28 2015
New Revision: 280507
URL: https://svnweb.freebsd.org/changeset/base/280507

Log:
  MFC: 272411
  
  Properly handle a case that should never happen (the bus_dma
  callback being called with error set to non-zero).

Modified:
  stable/10/sys/dev/sfxge/sfxge_dma.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_dma.c
==
--- stable/10/sys/dev/sfxge/sfxge_dma.c Wed Mar 25 10:06:26 2015
(r280506)
+++ stable/10/sys/dev/sfxge/sfxge_dma.c Wed Mar 25 10:08:28 2015
(r280507)
@@ -160,11 +160,14 @@ sfxge_dma_alloc(struct sfxge_softc *sc, 
 
/*
 * The callback gets error information about the mapping
-* and will have set our vaddr to NULL if something went
+* and will have set esm_addr to 0 if something went
 * wrong.
 */
-   if (vaddr == NULL)
+   if (esmp-esm_addr == 0) {
+   bus_dmamem_free(esmp-esm_tag, esmp-esm_base, esmp-esm_map);
+   bus_dma_tag_destroy(esmp-esm_tag); 
return (ENOMEM);
+   }
 
esmp-esm_base = vaddr;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280509 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:12:13 2015
New Revision: 280509
URL: https://svnweb.freebsd.org/changeset/base/280509

Log:
  MFC: 277885
  
  sfxge: Move txq-next pointer to part writable on completion path
  
  In fact the pointer is used only if more than one TXQ is processed in
  one interrupt.
  It is used (read-write) on completion path only.
  Also it makes the first part of the structure smaller and it fits now
  into one 128byte cache line. So, TXQ structure becomes 128 bytes
  smaller.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.h
==
--- stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 10:11:17 2015
(r280508)
+++ stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 10:12:13 2015
(r280509)
@@ -139,7 +139,6 @@ struct sfxge_txq {
bus_dma_tag_t   packet_dma_tag;
efx_buffer_t*pend_desc;
efx_txq_t   *common;
-   struct sfxge_txq*next;
 
efsys_mem_t *tsoh_buffer;
 
@@ -173,6 +172,7 @@ struct sfxge_txq {
 */
unsigned intpending __aligned(CACHE_LINE_SIZE);
unsigned intcompleted;
+   struct sfxge_txq*next;
 };
 
 extern int sfxge_tx_packet_add(struct sfxge_txq *, struct mbuf *);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280510 - in stable/10/sys/dev/sfxge: . common

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:13:19 2015
New Revision: 280510
URL: https://svnweb.freebsd.org/changeset/base/280510

Log:
  MFC: 277886
  
  sfxge: Make it possible to build without EVQ statistics
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/common/efx_ev.c
  stable/10/sys/dev/sfxge/common/efx_tx.c
  stable/10/sys/dev/sfxge/sfxge.h
  stable/10/sys/dev/sfxge/sfxge_ev.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/efx_ev.c
==
--- stable/10/sys/dev/sfxge/common/efx_ev.c Wed Mar 25 10:12:13 2015
(r280509)
+++ stable/10/sys/dev/sfxge/common/efx_ev.c Wed Mar 25 10:13:19 2015
(r280510)
@@ -995,6 +995,7 @@ fail1:
return (rc);
 }
 
+#if EFSYS_OPT_QSTATS
 #if EFSYS_OPT_NAMES
 /* START MKCONFIG GENERATED EfxEventQueueStatNamesBlock 67e9bdcd920059bd */
 static const char  __cs * __cs __efx_ev_qstat_name[] = {
@@ -1052,6 +1053,7 @@ efx_ev_qstat_name(
return (__efx_ev_qstat_name[id]);
 }
 #endif /* EFSYS_OPT_NAMES */
+#endif /* EFSYS_OPT_QSTATS */
 
 #if EFSYS_OPT_QSTATS
void

Modified: stable/10/sys/dev/sfxge/common/efx_tx.c
==
--- stable/10/sys/dev/sfxge/common/efx_tx.c Wed Mar 25 10:12:13 2015
(r280509)
+++ stable/10/sys/dev/sfxge/common/efx_tx.c Wed Mar 25 10:13:19 2015
(r280510)
@@ -358,6 +358,7 @@ fail1:
return (rc);
 }
 
+#if EFSYS_OPT_QSTATS
 #if EFSYS_OPT_NAMES
 /* START MKCONFIG GENERATED EfxTransmitQueueStatNamesBlock 78ca9ab00287fffb */
 static const char  __cs * __cs __efx_tx_qstat_name[] = {
@@ -378,6 +379,7 @@ efx_tx_qstat_name(
return (__efx_tx_qstat_name[id]);
 }
 #endif /* EFSYS_OPT_NAMES */
+#endif /* EFSYS_OPT_QSTATS */
 
 #if EFSYS_OPT_QSTATS
void

Modified: stable/10/sys/dev/sfxge/sfxge.h
==
--- stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 10:12:13 2015
(r280509)
+++ stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 10:13:19 2015
(r280510)
@@ -224,8 +224,10 @@ struct sfxge_softc {
 
struct sfxge_evq*evq[SFXGE_RX_SCALE_MAX];
unsigned intev_moderation;
+#if EFSYS_OPT_QSTATS
clock_t ev_stats_update_time;
uint64_tev_stats[EV_NQSTATS];
+#endif
 
uma_zone_t  rxq_cache;
struct sfxge_rxq*rxq[SFXGE_RX_SCALE_MAX];

Modified: stable/10/sys/dev/sfxge/sfxge_ev.c
==
--- stable/10/sys/dev/sfxge/sfxge_ev.c  Wed Mar 25 10:12:13 2015
(r280509)
+++ stable/10/sys/dev/sfxge/sfxge_ev.c  Wed Mar 25 10:13:19 2015
(r280510)
@@ -401,6 +401,8 @@ sfxge_ev_wake_up(void *arg, uint32_t ind
return (B_FALSE);
 }
 
+#if EFSYS_OPT_QSTATS
+
 static void
 sfxge_ev_stat_update(struct sfxge_softc *sc)
 {
@@ -462,6 +464,8 @@ sfxge_ev_stat_init(struct sfxge_softc *s
}
 }
 
+#endif /* EFSYS_OPT_QSTATS */
+
 static void
 sfxge_ev_qmoderate(struct sfxge_softc *sc, unsigned int idx, unsigned int us)
 {
@@ -622,8 +626,10 @@ sfxge_ev_qstop(struct sfxge_softc *sc, u
evq-read_ptr = 0;
evq-exception = B_FALSE;
 
+#if EFSYS_OPT_QSTATS
/* Add event counts before discarding the common evq state */
efx_ev_qstats_update(evq-common, sc-ev_stats);
+#endif
 
efx_ev_qdestroy(evq-common);
efx_sram_buf_tbl_clear(sc-enp, evq-buf_base_id,
@@ -878,7 +884,9 @@ sfxge_ev_init(struct sfxge_softc *sc)
goto fail;
}
 
+#if EFSYS_OPT_QSTATS
sfxge_ev_stat_init(sc);
+#endif
 
return (0);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280515 - stable/10/sys/dev/sfxge/common

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:19:43 2015
New Revision: 280515
URL: https://svnweb.freebsd.org/changeset/base/280515

Log:
  MFC: 277891
  
  sfxge: Remove unused esm_size member of the efsys_mem_t structure
  
  esm_size is not even initialized properly when memory is allocated.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/common/efsys.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/efsys.h
==
--- stable/10/sys/dev/sfxge/common/efsys.h  Wed Mar 25 10:18:23 2015
(r280514)
+++ stable/10/sys/dev/sfxge/common/efsys.h  Wed Mar 25 10:19:43 2015
(r280515)
@@ -370,7 +370,6 @@ typedef struct efsys_mem_s {
bus_dmamap_tesm_map;
caddr_t esm_base;
efsys_dma_addr_tesm_addr;
-   size_t  esm_size;
 } efsys_mem_t;
 
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280518 - in stable/10: share/man/man4 sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:23:00 2015
New Revision: 280518
URL: https://svnweb.freebsd.org/changeset/base/280518

Log:
  MFC: 277894
  
  sfxge: implemented parameter to restrict RSS channels
  
  Submitted by:   Artem V. Andreev Artem.Andreev at oktetlabs.ru
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/share/man/man4/sfxge.4
  stable/10/sys/dev/sfxge/sfxge.c
  stable/10/sys/dev/sfxge/sfxge.h
  stable/10/sys/dev/sfxge/sfxge_intr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/sfxge.4
==
--- stable/10/share/man/man4/sfxge.4Wed Mar 25 10:21:42 2015
(r280517)
+++ stable/10/share/man/man4/sfxge.4Wed Mar 25 10:23:00 2015
(r280518)
@@ -108,6 +108,10 @@ If a packet is dropped, the
 .Va tx_early_drops
 counter is incremented and the local sender receives ENOBUFS.
 The value must be greater than or equal to 0.
+.It Va hw.sfxge.N.max_rss_channels
+The maximum number of allocated RSS channels for the Nth adapter.
+If set to 0 or unset, the number of channels is determined by the number
+of CPU cores.
 .El
 .Sh SUPPORT
 For general information and support,

Modified: stable/10/sys/dev/sfxge/sfxge.c
==
--- stable/10/sys/dev/sfxge/sfxge.c Wed Mar 25 10:21:42 2015
(r280517)
+++ stable/10/sys/dev/sfxge/sfxge.c Wed Mar 25 10:23:00 2015
(r280518)
@@ -396,11 +396,18 @@ sfxge_create(struct sfxge_softc *sc)
device_t dev;
efx_nic_t *enp;
int error;
+   char rss_param_name[sizeof(SFXGE_PARAM(%d.max_rss_channels))];
 
dev = sc-dev;
 
sx_init(sc-softc_lock, sfxge_softc);
 
+   sc-max_rss_channels = 0;
+   snprintf(rss_param_name, sizeof(rss_param_name),
+SFXGE_PARAM(%d.max_rss_channels),
+(int)device_get_unit(dev));
+   TUNABLE_INT_FETCH(rss_param_name, sc-max_rss_channels);
+
sc-stats_node = SYSCTL_ADD_NODE(
device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),

Modified: stable/10/sys/dev/sfxge/sfxge.h
==
--- stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 10:21:42 2015
(r280517)
+++ stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 10:23:00 2015
(r280518)
@@ -229,6 +229,7 @@ struct sfxge_softc {
uint64_tev_stats[EV_NQSTATS];
 #endif
 
+   unsigned intmax_rss_channels;
uma_zone_t  rxq_cache;
struct sfxge_rxq*rxq[SFXGE_RX_SCALE_MAX];
unsigned intrx_indir_table[SFXGE_RX_SCALE_MAX];

Modified: stable/10/sys/dev/sfxge/sfxge_intr.c
==
--- stable/10/sys/dev/sfxge/sfxge_intr.cWed Mar 25 10:21:42 2015
(r280517)
+++ stable/10/sys/dev/sfxge/sfxge_intr.cWed Mar 25 10:23:00 2015
(r280518)
@@ -298,6 +298,9 @@ sfxge_intr_setup_msix(struct sfxge_softc
if (count  EFX_MAXRSS)
count = EFX_MAXRSS;
 
+   if (sc-max_rss_channels  0  count  sc-max_rss_channels)
+   count = sc-max_rss_channels;
+
rid = PCIR_BAR(4);
resp = bus_alloc_resource_any(dev, SYS_RES_MEMORY, rid, RF_ACTIVE);
if (resp == NULL)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280521 - stable/10/sys/dev/sfxge/common

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:26:45 2015
New Revision: 280521
URL: https://svnweb.freebsd.org/changeset/base/280521

Log:
  MFC: 278220
  
  sfxge: Implement EFSYS_MEM_READ_BARRIER()
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/common/efsys.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/efsys.h
==
--- stable/10/sys/dev/sfxge/common/efsys.h  Wed Mar 25 10:26:07 2015
(r280520)
+++ stable/10/sys/dev/sfxge/common/efsys.h  Wed Mar 25 10:26:45 2015
(r280521)
@@ -677,8 +677,7 @@ typedef struct efsys_bar_s {
 
 /* BARRIERS */
 
-/* Strict ordering guaranteed by devacc.devacc_attr_dataorder */
-#defineEFSYS_MEM_READ_BARRIER()
+#defineEFSYS_MEM_READ_BARRIER()rmb()
 #defineEFSYS_PIO_WRITE_BARRIER()
 
 /* TIMESTAMP */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280526 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:32:49 2015
New Revision: 280526
URL: https://svnweb.freebsd.org/changeset/base/280526

Log:
  MFC: 278255
  
  sfxge: Add statistics for partially dropped TSO packets
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.c
  stable/10/sys/dev/sfxge/sfxge_tx.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:31:43 2015
(r280525)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:32:49 2015
(r280526)
@@ -1093,12 +1093,16 @@ sfxge_tx_queue_tso(struct sfxge_txq *txq
 * roll back the work we have done.
 */
if (txq-n_pend_desc 
-   SFXGE_TSO_MAX_DESC - (1 + SFXGE_TX_MAPPING_MAX_SEG))
+   SFXGE_TSO_MAX_DESC - (1 + 
SFXGE_TX_MAPPING_MAX_SEG)) {
+   txq-tso_pdrop_too_many++;
break;
+   }
next_id = (id + 1)  txq-ptr_mask;
if (__predict_false(tso_start_new_packet(txq, tso,
-next_id)))
+next_id))) {
+   txq-tso_pdrop_no_rsrc++;
break;
+   }
id = next_id;
}
}
@@ -1515,6 +1519,8 @@ static const struct {
SFXGE_TX_STAT(tso_bursts, tso_bursts),
SFXGE_TX_STAT(tso_packets, tso_packets),
SFXGE_TX_STAT(tso_long_headers, tso_long_headers),
+   SFXGE_TX_STAT(tso_pdrop_too_many, tso_pdrop_too_many),
+   SFXGE_TX_STAT(tso_pdrop_no_rsrc, tso_pdrop_no_rsrc),
SFXGE_TX_STAT(tx_collapses, collapses),
SFXGE_TX_STAT(tx_drops, drops),
SFXGE_TX_STAT(tx_get_overflow, get_overflow),

Modified: stable/10/sys/dev/sfxge/sfxge_tx.h
==
--- stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 10:31:43 2015
(r280525)
+++ stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 10:32:49 2015
(r280526)
@@ -201,6 +201,8 @@ struct sfxge_txq {
unsigned long   get_non_tcp_overflow;
unsigned long   put_overflow;
unsigned long   netdown_drops;
+   unsigned long   tso_pdrop_too_many;
+   unsigned long   tso_pdrop_no_rsrc;
 
/* The following fields change more often, and are used mostly
 * on the completion path
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280502 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:01:07 2015
New Revision: 280502
URL: https://svnweb.freebsd.org/changeset/base/280502

Log:
  MFC: 272328
  
  Make size of Tx and Rx rings configurable
  
  Required size of event queue is calculated now.
  
  Submitted by:   Andrew Rybchenko arybchenko at solarflare.com
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  stable/10/sys/dev/sfxge/sfxge.c
  stable/10/sys/dev/sfxge/sfxge.h
  stable/10/sys/dev/sfxge/sfxge_ev.c
  stable/10/sys/dev/sfxge/sfxge_rx.c
  stable/10/sys/dev/sfxge/sfxge_rx.h
  stable/10/sys/dev/sfxge/sfxge_tx.c
  stable/10/sys/dev/sfxge/sfxge_tx.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge.c
==
--- stable/10/sys/dev/sfxge/sfxge.c Wed Mar 25 09:59:38 2015
(r280501)
+++ stable/10/sys/dev/sfxge/sfxge.c Wed Mar 25 10:01:07 2015
(r280502)
@@ -42,6 +42,7 @@ __FBSDID($FreeBSD$);
 #include sys/taskqueue.h
 #include sys/sockio.h
 #include sys/sysctl.h
+#include sys/syslog.h
 
 #include dev/pci/pcireg.h
 #include dev/pci/pcivar.h
@@ -66,6 +67,25 @@ __FBSDID($FreeBSD$);
 
 MALLOC_DEFINE(M_SFXGE, sfxge, Solarflare 10GigE driver);
 
+
+SYSCTL_NODE(_hw, OID_AUTO, sfxge, CTLFLAG_RD, 0,
+   SFXGE driver parameters);
+
+#defineSFXGE_PARAM_RX_RING SFXGE_PARAM(rx_ring)
+static int sfxge_rx_ring_entries = SFXGE_NDESCS;
+TUNABLE_INT(SFXGE_PARAM_RX_RING, sfxge_rx_ring_entries);
+SYSCTL_INT(_hw_sfxge, OID_AUTO, rx_ring, CTLFLAG_RDTUN,
+  sfxge_rx_ring_entries, 0,
+  Maximum number of descriptors in a receive ring);
+
+#defineSFXGE_PARAM_TX_RING SFXGE_PARAM(tx_ring)
+static int sfxge_tx_ring_entries = SFXGE_NDESCS;
+TUNABLE_INT(SFXGE_PARAM_TX_RING, sfxge_tx_ring_entries);
+SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_ring, CTLFLAG_RDTUN,
+  sfxge_tx_ring_entries, 0,
+  Maximum number of descriptors in a transmit ring);
+
+
 static void
 sfxge_reset(void *arg, int npending);
 
@@ -313,8 +333,8 @@ sfxge_ifnet_init(struct ifnet *ifp, stru
ifp-if_qflush = sfxge_if_qflush;
 #else
ifp-if_start = sfxge_if_start;
-   IFQ_SET_MAXLEN(ifp-if_snd, SFXGE_NDESCS - 1);
-   ifp-if_snd.ifq_drv_maxlen = SFXGE_NDESCS - 1;
+   IFQ_SET_MAXLEN(ifp-if_snd, sc-txq_entries - 1);
+   ifp-if_snd.ifq_drv_maxlen = sc-txq_entries - 1;
IFQ_SET_READY(ifp-if_snd);
 
mtx_init(sc-tx_lock, txq, NULL, MTX_DEF);
@@ -413,6 +433,26 @@ sfxge_create(struct sfxge_softc *sc)
goto fail3;
sc-enp = enp;
 
+   if (!ISP2(sfxge_rx_ring_entries) ||
+   !(sfxge_rx_ring_entries  EFX_RXQ_NDESCS_MASK)) {
+   log(LOG_ERR, %s=%d must be power of 2 from %u to %u,
+   SFXGE_PARAM_RX_RING, sfxge_rx_ring_entries,
+   EFX_RXQ_MINNDESCS, EFX_RXQ_MAXNDESCS);
+   error = EINVAL;
+   goto fail_rx_ring_entries;
+   }
+   sc-rxq_entries = sfxge_rx_ring_entries;
+
+   if (!ISP2(sfxge_tx_ring_entries) ||
+   !(sfxge_tx_ring_entries  EFX_TXQ_NDESCS_MASK)) {
+   log(LOG_ERR, %s=%d must be power of 2 from %u to %u,
+   SFXGE_PARAM_TX_RING, sfxge_tx_ring_entries,
+   EFX_TXQ_MINNDESCS, EFX_TXQ_MAXNDESCS);
+   error = EINVAL;
+   goto fail_tx_ring_entries;
+   }
+   sc-txq_entries = sfxge_tx_ring_entries;
+
/* Initialize MCDI to talk to the microcontroller. */
if ((error = sfxge_mcdi_init(sc)) != 0)
goto fail4;
@@ -485,6 +525,8 @@ fail5:
sfxge_mcdi_fini(sc);
 
 fail4:
+fail_tx_ring_entries:
+fail_rx_ring_entries:
sc-enp = NULL;
efx_nic_destroy(enp);
mtx_destroy(sc-enp_lock);

Modified: stable/10/sys/dev/sfxge/sfxge.h
==
--- stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 09:59:38 2015
(r280501)
+++ stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 10:01:07 2015
(r280502)
@@ -86,6 +86,8 @@
 #include sfxge_rx.h
 #include sfxge_tx.h
 
+#defineROUNDUP_POW_OF_TWO(_n)  (1ULL  flsl((_n) - 1))
+
 #defineSFXGE_IP_ALIGN  2
 
 #defineSFXGE_ETHERTYPE_LOOPBACK0x9000  /* Xerox loopback */
@@ -105,6 +107,7 @@ struct sfxge_evq {
 
enum sfxge_evq_stateinit_state;
unsigned intindex;
+   unsigned intentries;
efsys_mem_t mem;
unsigned intbuf_base_id;
 
@@ -120,7 +123,6 @@ struct sfxge_evq {
struct sfxge_txq**txqs;
 };
 
-#defineSFXGE_NEVS  4096
 #defineSFXGE_NDESCS1024
 #defineSFXGE_MODERATION30
 
@@ -208,6 +210,9 @@ struct sfxge_softc {
efx_nic_t   *enp;
struct mtx  enp_lock;
 
+   unsigned intrxq_entries

svn commit: r280505 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:05:19 2015
New Revision: 280505
URL: https://svnweb.freebsd.org/changeset/base/280505

Log:
  MFC: 272331
  
  Support tunable to control Tx deferred packet list limits
  
  Also increase default for Tx queue get-list limit.
  Too small limit results in TCP packets drops especiall when many
  streams are running simultaneously.
  Put list may be kept small enough since it is just a temporary
  location if transmit function can't get Tx queue lock.
  
  Submitted by:   Andrew Rybchenko arybchenko at solarflare.com
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.c
  stable/10/sys/dev/sfxge/sfxge_tx.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:03:41 2015
(r280504)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:05:19 2015
(r280505)
@@ -50,6 +50,7 @@ __FBSDID($FreeBSD$);
 #include sys/smp.h
 #include sys/socket.h
 #include sys/sysctl.h
+#include sys/syslog.h
 
 #include net/bpf.h
 #include net/ethernet.h
@@ -77,6 +78,25 @@ __FBSDID($FreeBSD$);
 #defineSFXGE_TSO_MAX_DESC ((65535 / 512) * 2 + 
SFXGE_TX_MAPPING_MAX_SEG - 1)
 #defineSFXGE_TXQ_BLOCK_LEVEL(_entries) ((_entries) - 
SFXGE_TSO_MAX_DESC)
 
+#ifdef SFXGE_HAVE_MQ
+
+#defineSFXGE_PARAM_TX_DPL_GET_MAX  SFXGE_PARAM(tx_dpl_get_max)
+static int sfxge_tx_dpl_get_max = SFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT;
+TUNABLE_INT(SFXGE_PARAM_TX_DPL_GET_MAX, sfxge_tx_dpl_get_max);
+SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_dpl_get_max, CTLFLAG_RDTUN,
+  sfxge_tx_dpl_get_max, 0,
+  Maximum number of packets in deferred packet get-list);
+
+#defineSFXGE_PARAM_TX_DPL_PUT_MAX  SFXGE_PARAM(tx_dpl_put_max)
+static int sfxge_tx_dpl_put_max = SFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT;
+TUNABLE_INT(SFXGE_PARAM_TX_DPL_PUT_MAX, sfxge_tx_dpl_put_max);
+SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_dpl_put_max, CTLFLAG_RDTUN,
+  sfxge_tx_dpl_put_max, 0,
+  Maximum number of packets in deferred packet put-list);
+
+#endif
+
+
 /* Forward declarations. */
 static inline void sfxge_tx_qdpl_service(struct sfxge_txq *txq);
 static void sfxge_tx_qlist_post(struct sfxge_txq *txq);
@@ -476,7 +496,7 @@ sfxge_tx_qdpl_put(struct sfxge_txq *txq,
 
sfxge_tx_qdpl_swizzle(txq);
 
-   if (stdp-std_get_count = SFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT)
+   if (stdp-std_get_count = stdp-std_get_max)
return (ENOBUFS);
 
*(stdp-std_getp) = mbuf;
@@ -498,7 +518,7 @@ sfxge_tx_qdpl_put(struct sfxge_txq *txq,
old_len = mp-m_pkthdr.csum_data;
} else
old_len = 0;
-   if (old_len = SFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT)
+   if (old_len = stdp-std_put_max)
return (ENOBUFS);
mbuf-m_pkthdr.csum_data = old_len + 1;
mbuf-m_nextpkt = (void *)old;
@@ -1384,8 +1404,23 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
goto fail3;
 
 #ifdef SFXGE_HAVE_MQ
+   if (sfxge_tx_dpl_get_max = 0) {
+   log(LOG_ERR, %s=%d must be greater than 0,
+   SFXGE_PARAM_TX_DPL_GET_MAX, sfxge_tx_dpl_get_max);
+   rc = EINVAL;
+   goto fail_tx_dpl_get_max;
+   }
+   if (sfxge_tx_dpl_put_max  0) {
+   log(LOG_ERR, %s=%d must be greater or equal to 0,
+   SFXGE_PARAM_TX_DPL_PUT_MAX, sfxge_tx_dpl_put_max);
+   rc = EINVAL;
+   goto fail_tx_dpl_put_max;
+   }
+
/* Initialize the deferred packet list. */
stdp = txq-dpl;
+   stdp-std_put_max = sfxge_tx_dpl_put_max;
+   stdp-std_get_max = sfxge_tx_dpl_get_max;
stdp-std_getp = stdp-std_get;
 
mtx_init(txq-lock, txq, NULL, MTX_DEF);
@@ -1403,6 +1438,8 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
 
return (0);
 
+fail_tx_dpl_put_max:
+fail_tx_dpl_get_max:
 fail3:
 fail_txq_node:
free(txq-pend_desc, M_SFXGE);

Modified: stable/10/sys/dev/sfxge/sfxge_tx.h
==
--- stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 10:03:41 2015
(r280504)
+++ stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 10:05:19 2015
(r280505)
@@ -75,13 +75,17 @@ struct sfxge_tx_mapping {
enum sfxge_tx_buf_flags flags;
 };
 
-#defineSFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT  64
+#defineSFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT  1024
 #defineSFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT  64
 
 /*
  * Deferred packet list.
  */
 struct sfxge_tx_dpl {
+   unsigned intstd_get_max;/* Maximum number of packets

svn commit: r280511 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:14:30 2015
New Revision: 280511
URL: https://svnweb.freebsd.org/changeset/base/280511

Log:
  MFC: 277887
  
  sfxge: Remove extra cache-line alignment and reorder sfxge_evq_t
  
  Remove the first member alignment to cacheline since it is nop.
  Use __aligned() for the whole structure to make sure that the structure
  size is cacheline aligned.
  Remove lock alignment to make the structure smaller and fit all members
  used on event queue processing into one cacheline (128 bytes) on x86-64.
  The lock is obtained as well from different context when event queue
  statistics are retrived from sysctl context, but it is infrequent.
  Reorder members to avoid padding and go in usage order on event
  processing.
  As the result all structure members used on event queue processing fit
  into exactly one cacheline (128 byte) now.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge.h
==
--- stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 10:13:19 2015
(r280510)
+++ stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 10:14:30 2015
(r280511)
@@ -102,26 +102,26 @@ enum sfxge_evq_state {
 #defineSFXGE_EV_BATCH  16384
 
 struct sfxge_evq {
-   struct sfxge_softc  *sc  __aligned(CACHE_LINE_SIZE);
-   struct mtx  lock __aligned(CACHE_LINE_SIZE);
-
-   enum sfxge_evq_stateinit_state;
+   /* Structure members below are sorted by usage order */
+   struct sfxge_softc  *sc;
+   struct mtx  lock;
unsigned intindex;
-   unsigned intentries;
+   enum sfxge_evq_stateinit_state;
efsys_mem_t mem;
-   unsigned intbuf_base_id;
-
-   boolean_t   exception;
-
efx_evq_t   *common;
unsigned intread_ptr;
+   boolean_t   exception;
unsigned intrx_done;
unsigned inttx_done;
 
/* Linked list of TX queues with completions to process */
struct sfxge_txq*txq;
struct sfxge_txq**txqs;
-};
+
+   /* Structure members not used on event processing path */
+   unsigned intbuf_base_id;
+   unsigned intentries;
+} __aligned(CACHE_LINE_SIZE);
 
 #defineSFXGE_NDESCS1024
 #defineSFXGE_MODERATION30
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280516 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:20:42 2015
New Revision: 280516
URL: https://svnweb.freebsd.org/changeset/base/280516

Log:
  MFC: 277892
  
  sfxge: Pass correct address to free allocated memory in the case of load error
  
  Most likely is was just memory leak on the error handling path since
  typically efsys_mem_t is filled in by zeros on allocation.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_dma.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_dma.c
==
--- stable/10/sys/dev/sfxge/sfxge_dma.c Wed Mar 25 10:19:43 2015
(r280515)
+++ stable/10/sys/dev/sfxge/sfxge_dma.c Wed Mar 25 10:20:42 2015
(r280516)
@@ -153,7 +153,7 @@ sfxge_dma_alloc(struct sfxge_softc *sc, 
if (bus_dmamap_load(esmp-esm_tag, esmp-esm_map, vaddr, len,
sfxge_dma_cb, esmp-esm_addr, 0) != 0) {
device_printf(sc-dev, Couldn't load DMA mapping\n);
-   bus_dmamem_free(esmp-esm_tag, esmp-esm_base, esmp-esm_map);
+   bus_dmamem_free(esmp-esm_tag, vaddr, esmp-esm_map);
bus_dma_tag_destroy(esmp-esm_tag);
return (ENOMEM);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280517 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:21:42 2015
New Revision: 280517
URL: https://svnweb.freebsd.org/changeset/base/280517

Log:
  MFC: 277893
  
  sfxge: Use SFXGE_MODERATION to initialize event moderation
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_ev.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_ev.c
==
--- stable/10/sys/dev/sfxge/sfxge_ev.c  Wed Mar 25 10:20:42 2015
(r280516)
+++ stable/10/sys/dev/sfxge/sfxge_ev.c  Wed Mar 25 10:21:42 2015
(r280517)
@@ -870,7 +870,7 @@ sfxge_ev_init(struct sfxge_softc *sc)
/* Set default interrupt moderation; add a sysctl to
 * read and change it.
 */
-   sc-ev_moderation = 30;
+   sc-ev_moderation = SFXGE_MODERATION;
SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree),
OID_AUTO, int_mod, CTLTYPE_UINT|CTLFLAG_RW,
sc, 0, sfxge_int_mod_handler, IU,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280522 - in stable/10/sys/dev/sfxge: . common

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:27:54 2015
New Revision: 280522
URL: https://svnweb.freebsd.org/changeset/base/280522

Log:
  MFC: 278221
  
  sfxge: Add macros to init, destroy, acquire, release and assert locks
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/common/efsys.h
  stable/10/sys/dev/sfxge/sfxge.c
  stable/10/sys/dev/sfxge/sfxge.h
  stable/10/sys/dev/sfxge/sfxge_ev.c
  stable/10/sys/dev/sfxge/sfxge_mcdi.c
  stable/10/sys/dev/sfxge/sfxge_port.c
  stable/10/sys/dev/sfxge/sfxge_rx.c
  stable/10/sys/dev/sfxge/sfxge_tx.c
  stable/10/sys/dev/sfxge/sfxge_tx.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/efsys.h
==
--- stable/10/sys/dev/sfxge/common/efsys.h  Wed Mar 25 10:26:45 2015
(r280521)
+++ stable/10/sys/dev/sfxge/common/efsys.h  Wed Mar 25 10:27:54 2015
(r280522)
@@ -517,6 +517,15 @@ typedef struct efsys_bar_s {
struct resource *esb_res;
 } efsys_bar_t;
 
+#defineSFXGE_BAR_LOCK_INIT(_esbp, _name)   
\
+   mtx_init((_esbp)-esb_lock, (_name), NULL, MTX_DEF)
+#defineSFXGE_BAR_LOCK_DESTROY(_esbp)   
\
+   mtx_destroy((_esbp)-esb_lock)
+#defineSFXGE_BAR_LOCK(_esbp)   
\
+   mtx_lock((_esbp)-esb_lock)
+#defineSFXGE_BAR_UNLOCK(_esbp) 
\
+   mtx_unlock((_esbp)-esb_lock)
+
 #defineEFSYS_BAR_READD(_esbp, _offset, _edp, _lock)
\
do {\
_NOTE(CONSTANTCONDITION)\
@@ -525,7 +534,7 @@ typedef struct efsys_bar_s {
\
_NOTE(CONSTANTCONDITION)\
if (_lock)  \
-   mtx_lock(((_esbp)-esb_lock)); \
+   SFXGE_BAR_LOCK(_esbp);  \
\
(_edp)-ed_u32[0] = bus_space_read_4((_esbp)-esb_tag,  \
(_esbp)-esb_handle, (_offset));\
@@ -535,7 +544,7 @@ typedef struct efsys_bar_s {
\
_NOTE(CONSTANTCONDITION)\
if (_lock)  \
-   mtx_unlock(((_esbp)-esb_lock));   \
+   SFXGE_BAR_UNLOCK(_esbp);\
_NOTE(CONSTANTCONDITION)\
} while (B_FALSE)
 
@@ -545,7 +554,7 @@ typedef struct efsys_bar_s {
KASSERT(IS_P2ALIGNED(_offset, sizeof (efx_qword_t)),\
(not power of 2 aligned));\
\
-   mtx_lock(((_esbp)-esb_lock)); \
+   SFXGE_BAR_LOCK(_esbp);  \
\
(_eqp)-eq_u32[0] = bus_space_read_4((_esbp)-esb_tag,  \
(_esbp)-esb_handle, (_offset));\
@@ -556,7 +565,7 @@ typedef struct efsys_bar_s {
uint32_t, (_eqp)-eq_u32[1],\
uint32_t, (_eqp)-eq_u32[0]);   \
\
-   mtx_unlock(((_esbp)-esb_lock));   \
+   SFXGE_BAR_UNLOCK(_esbp);\
_NOTE(CONSTANTCONDITION)\
} while (B_FALSE)
 
@@ -568,7 +577,7 @@ typedef struct efsys_bar_s {
\
_NOTE(CONSTANTCONDITION)\
if (_lock)  \
-   mtx_lock(((_esbp)-esb_lock)); \
+   SFXGE_BAR_LOCK(_esbp);  \
\
(_eop)-eo_u32[0] = bus_space_read_4((_esbp)-esb_tag,  \
(_esbp)-esb_handle, (_offset));\
@@ -587,7 +596,7 @@ typedef struct efsys_bar_s {
\
_NOTE(CONSTANTCONDITION)\

svn commit: r280528 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:35:19 2015
New Revision: 280528
URL: https://svnweb.freebsd.org/changeset/base/280528

Log:
  MFC: 278835
  
  sfxge: remove full_packet_size from sfxge_tso_state
  
  It makes sfxge_tso_state smaller and even makes tso_start_new_packet()
  few bytes smaller. Data used to calculate packet size are used nearby,
  so it should be no problems with cache etc.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor), glebius

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:34:20 2015
(r280527)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:35:19 2015
(r280528)
@@ -791,8 +791,6 @@ struct sfxge_tso_state {
ssize_t nh_off; /* Offset of network header */
ssize_t tcph_off;   /* Offset of TCP header */
unsigned header_len;/* Number of bytes of header */
-   int full_packet_size;   /* Number of bytes to put in each outgoing
-* segment */
 };
 
 static inline const struct ip *tso_iph(const struct sfxge_tso_state *tso)
@@ -894,7 +892,6 @@ static void tso_start(struct sfxge_tso_s
}
 
tso-header_len = tso-tcph_off + 4 * tso_tcph(tso)-th_off;
-   tso-full_packet_size = tso-header_len + mbuf-m_pkthdr.tso_segsz;
 
tso-seqnum = ntohl(tso_tcph(tso)-th_seq);
 
@@ -1014,7 +1011,8 @@ static int tso_start_new_packet(struct s
tso-seqnum += tso-mbuf-m_pkthdr.tso_segsz;
if (tso-out_len  tso-mbuf-m_pkthdr.tso_segsz) {
/* This packet will not finish the TSO burst. */
-   ip_length = tso-full_packet_size - tso-nh_off;
+   ip_length = tso-header_len - tso-nh_off +
+   tso-mbuf-m_pkthdr.tso_segsz;
tsoh_th-th_flags = ~(TH_FIN | TH_PUSH);
} else {
/* This packet will be the last in the TSO burst. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280527 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:34:20 2015
New Revision: 280527
URL: https://svnweb.freebsd.org/changeset/base/280527

Log:
  MFC: 278833
  
  sfxge: remove unused variable
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor), glebius

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:32:49 2015
(r280526)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:34:20 2015
(r280527)
@@ -1279,7 +1279,6 @@ fail:
 void
 sfxge_tx_stop(struct sfxge_softc *sc)
 {
-   const efx_nic_cfg_t *encp;
int index;
 
index = SFXGE_TX_SCALE(sc);
@@ -1288,7 +1287,6 @@ sfxge_tx_stop(struct sfxge_softc *sc)
 
sfxge_tx_qstop(sc, SFXGE_TXQ_IP_CKSUM);
 
-   encp = efx_nic_cfg_get(sc-enp);
sfxge_tx_qstop(sc, SFXGE_TXQ_NON_CKSUM);
 
/* Tear down the transmit module */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280533 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:38:22 2015
New Revision: 280533
URL: https://svnweb.freebsd.org/changeset/base/280533

Log:
  MFC: 278838
  
  sfxge: SYSCTL_IN/OUT should not be called with non-sleepable lock held
  
  The problem is found using WITNESS option enabled.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_port.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_port.c
==
--- stable/10/sys/dev/sfxge/sfxge_port.cWed Mar 25 10:37:36 2015
(r280532)
+++ stable/10/sys/dev/sfxge/sfxge_port.cWed Mar 25 10:38:22 2015
(r280533)
@@ -91,16 +91,15 @@ sfxge_mac_stat_handler(SYSCTL_HANDLER_AR
struct sfxge_softc *sc = arg1;
unsigned int id = arg2;
int rc;
+   uint64_t val;
 
SFXGE_PORT_LOCK(sc-port);
-   if ((rc = sfxge_mac_stat_update(sc)) != 0)
-   goto out;
-
-   rc = SYSCTL_OUT(req,
-   (uint64_t *)sc-port.mac_stats.decode_buf + id,
-   sizeof(uint64_t));
-out:
+   if ((rc = sfxge_mac_stat_update(sc)) == 0)
+   val = ((uint64_t *)sc-port.mac_stats.decode_buf)[id];
SFXGE_PORT_UNLOCK(sc-port);
+
+   if (rc == 0)
+   rc = SYSCTL_OUT(req, val, sizeof(val));
return (rc);
 }
 
@@ -173,28 +172,29 @@ sfxge_port_wanted_fc_handler(SYSCTL_HAND
sc = arg1;
port = sc-port;
 
-   SFXGE_PORT_LOCK(port);
-
if (req-newptr != NULL) {
if ((error = SYSCTL_IN(req, fcntl, sizeof(fcntl))) != 0)
-   goto out;
-
-   if (port-wanted_fc == fcntl)
-   goto out;
+   return (error);
 
-   port-wanted_fc = fcntl;
+   SFXGE_PORT_LOCK(port);
 
-   if (port-init_state != SFXGE_PORT_STARTED)
-   goto out;
+   if (port-wanted_fc != fcntl) {
+   if (port-init_state == SFXGE_PORT_STARTED)
+   error = efx_mac_fcntl_set(sc-enp,
+ port-wanted_fc,
+ B_TRUE);
+   if (error == 0)
+   port-wanted_fc = fcntl;
+   }
 
-   error = efx_mac_fcntl_set(sc-enp, port-wanted_fc, B_TRUE);
+   SFXGE_PORT_UNLOCK(port);
} else {
-   error = SYSCTL_OUT(req, port-wanted_fc,
-  sizeof(port-wanted_fc));
-   }
+   SFXGE_PORT_LOCK(port);
+   fcntl = port-wanted_fc;
+   SFXGE_PORT_UNLOCK(port);
 
-out:
-   SFXGE_PORT_UNLOCK(port);
+   error = SYSCTL_OUT(req, fcntl, sizeof(fcntl));
+   }
 
return (error);
 }
@@ -205,7 +205,6 @@ sfxge_port_link_fc_handler(SYSCTL_HANDLE
struct sfxge_softc *sc;
struct sfxge_port *port;
unsigned int wanted_fc, link_fc;
-   int error;
 
sc = arg1;
port = sc-port;
@@ -215,10 +214,9 @@ sfxge_port_link_fc_handler(SYSCTL_HANDLE
efx_mac_fcntl_get(sc-enp, wanted_fc, link_fc);
else
link_fc = 0;
-   error = SYSCTL_OUT(req, link_fc, sizeof(link_fc));
SFXGE_PORT_UNLOCK(port);
 
-   return (error);
+   return (SYSCTL_OUT(req, link_fc, sizeof(link_fc)));
 }
 
 #endif /* SFXGE_HAVE_PAUSE_MEDIAOPTS */
@@ -499,16 +497,15 @@ sfxge_phy_stat_handler(SYSCTL_HANDLER_AR
struct sfxge_softc *sc = arg1;
unsigned int id = arg2;
int rc;
+   uint32_t val;
 
SFXGE_PORT_LOCK(sc-port);
-   if ((rc = sfxge_phy_stat_update(sc)) != 0)
-   goto out;
-
-   rc = SYSCTL_OUT(req,
-   (uint32_t *)sc-port.phy_stats.decode_buf + id,
-   sizeof(uint32_t));
-out:
+   if ((rc = sfxge_phy_stat_update(sc)) == 0)
+   val = ((uint32_t *)sc-port.phy_stats.decode_buf)[id];
SFXGE_PORT_UNLOCK(sc-port);
+
+   if (rc == 0)
+   rc = SYSCTL_OUT(req, val, sizeof(val));
return (rc);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280532 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:37:36 2015
New Revision: 280532
URL: https://svnweb.freebsd.org/changeset/base/280532

Log:
  MFC: 278837
  
  sfxge: remove inline specifiers
  
  Now compiler does not need any help.
  The patch does not change generated code.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor), glebius

Modified:
  stable/10/sys/dev/sfxge/sfxge_rx.c
  stable/10/sys/dev/sfxge/sfxge_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_rx.c
==
--- stable/10/sys/dev/sfxge/sfxge_rx.c  Wed Mar 25 10:37:17 2015
(r280531)
+++ stable/10/sys/dev/sfxge/sfxge_rx.c  Wed Mar 25 10:37:36 2015
(r280532)
@@ -92,8 +92,8 @@ static int lro_loss_packets = 20;
 #defineSFXGE_LRO_CONN_IS_TCPIPV4(c) (!((c)-l2_id  
SFXGE_LRO_L2_ID_IPV6))
 
 /* Compare IPv6 addresses, avoiding conditional branches */
-static __inline unsigned long ipv6_addr_cmp(const struct in6_addr *left,
-   const struct in6_addr *right)
+static unsigned long ipv6_addr_cmp(const struct in6_addr *left,
+  const struct in6_addr *right)
 {
 #if LONG_BIT == 64
const uint64_t *left64 = (const uint64_t *)left;
@@ -167,7 +167,7 @@ sfxge_rx_schedule_refill(struct sfxge_rx
 sfxge_rx_post_refill, rxq);
 }
 
-static inline struct mbuf *sfxge_rx_alloc_mbuf(struct sfxge_softc *sc)
+static struct mbuf *sfxge_rx_alloc_mbuf(struct sfxge_softc *sc)
 {
struct mb_args args;
struct mbuf *m;

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:37:17 2015
(r280531)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 10:37:36 2015
(r280532)
@@ -107,7 +107,7 @@ SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_dpl_p
 
 
 /* Forward declarations. */
-static inline void sfxge_tx_qdpl_service(struct sfxge_txq *txq);
+static void sfxge_tx_qdpl_service(struct sfxge_txq *txq);
 static void sfxge_tx_qlist_post(struct sfxge_txq *txq);
 static void sfxge_tx_qunblock(struct sfxge_txq *txq);
 static int sfxge_tx_queue_tso(struct sfxge_txq *txq, struct mbuf *mbuf,
@@ -156,7 +156,7 @@ sfxge_tx_qcomplete(struct sfxge_txq *txq
 
 #ifdef SFXGE_HAVE_MQ
 
-static inline unsigned int
+static unsigned int
 sfxge_is_mbuf_non_tcp(struct mbuf *mbuf)
 {
/* Absense of TCP checksum flags does not mean that it is non-TCP
@@ -481,7 +481,7 @@ sfxge_tx_qdpl_drain(struct sfxge_txq *tx
  *
  * NOTE: drops the txq mutex!
  */
-static inline void
+static void
 sfxge_tx_qdpl_service(struct sfxge_txq *txq)
 {
SFXGE_TXQ_LOCK_ASSERT_OWNED(txq);
@@ -509,7 +509,7 @@ sfxge_tx_qdpl_service(struct sfxge_txq *
  * overload the csum_data field in the mbuf to keep track of this length
  * because there is no cheap alternative to avoid races.
  */
-static inline int
+static int
 sfxge_tx_qdpl_put(struct sfxge_txq *txq, struct mbuf *mbuf, int locked)
 {
struct sfxge_tx_dpl *stdp;
@@ -757,7 +757,7 @@ void sfxge_if_start(struct ifnet *ifp)
SFXGE_TXQ_UNLOCK(sc-txq[0]);
 }
 
-static inline void
+static void
 sfxge_tx_qdpl_service(struct sfxge_txq *txq)
 {
struct ifnet *ifp = txq-sc-ifnet;
@@ -792,19 +792,19 @@ struct sfxge_tso_state {
unsigned header_len;/* Number of bytes of header */
 };
 
-static inline const struct ip *tso_iph(const struct sfxge_tso_state *tso)
+static const struct ip *tso_iph(const struct sfxge_tso_state *tso)
 {
KASSERT(tso-protocol == htons(ETHERTYPE_IP),
(tso_iph() in non-IPv4 state));
return (const struct ip *)(tso-mbuf-m_data + tso-nh_off);
 }
-static inline const struct ip6_hdr *tso_ip6h(const struct sfxge_tso_state *tso)
+static __unused const struct ip6_hdr *tso_ip6h(const struct sfxge_tso_state 
*tso)
 {
KASSERT(tso-protocol == htons(ETHERTYPE_IPV6),
(tso_ip6h() in non-IPv6 state));
return (const struct ip6_hdr *)(tso-mbuf-m_data + tso-nh_off);
 }
-static inline const struct tcphdr *tso_tcph(const struct sfxge_tso_state *tso)
+static const struct tcphdr *tso_tcph(const struct sfxge_tso_state *tso)
 {
return (const struct tcphdr *)(tso-mbuf-m_data + tso-tcph_off);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280535 - stable/10/sys/dev/sfxge/common

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 10:39:18 2015
New Revision: 280535
URL: https://svnweb.freebsd.org/changeset/base/280535

Log:
  MFC: 278839
  
  sfxge: style fixes
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/common/efx_ev.c
  stable/10/sys/dev/sfxge/common/efx_mac.c
  stable/10/sys/dev/sfxge/common/efx_mcdi.c
  stable/10/sys/dev/sfxge/common/efx_nic.c
  stable/10/sys/dev/sfxge/common/efx_rx.c
  stable/10/sys/dev/sfxge/common/efx_tx.c
  stable/10/sys/dev/sfxge/common/siena_mon.c
  stable/10/sys/dev/sfxge/common/siena_nic.c
  stable/10/sys/dev/sfxge/common/siena_vpd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/efx_ev.c
==
--- stable/10/sys/dev/sfxge/common/efx_ev.c Wed Mar 25 10:38:59 2015
(r280534)
+++ stable/10/sys/dev/sfxge/common/efx_ev.c Wed Mar 25 10:39:18 2015
(r280535)
@@ -89,7 +89,8 @@ efx_ev_rx_not_ok(
if (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_TOBE_DISC) != 0) {
EFX_EV_QSTAT_INCR(eep, EV_RX_TOBE_DISC);
EFSYS_PROBE(tobe_disc);
-   /* Assume this is a unicast address mismatch, unless below
+   /*
+* Assume this is a unicast address mismatch, unless below
 * we find either FSF_AZ_RX_EV_ETH_CRC_ERR or
 * EV_RX_PAUSE_FRM_ERR is set.
 */
@@ -102,7 +103,8 @@ efx_ev_rx_not_ok(
(*flagsp) |= EFX_DISCARD;
 
 #if (EFSYS_OPT_RX_HDR_SPLIT || EFSYS_OPT_RX_SCATTER)
-   /* Lookout for payload queue ran dry errors and ignore them.
+   /*
+* Lookout for payload queue ran dry errors and ignore them.
 *
 * Sadly for the header/data split cases, the descriptor
 * pointer in this event refers to the header queue and

Modified: stable/10/sys/dev/sfxge/common/efx_mac.c
==
--- stable/10/sys/dev/sfxge/common/efx_mac.cWed Mar 25 10:38:59 2015
(r280534)
+++ stable/10/sys/dev/sfxge/common/efx_mac.cWed Mar 25 10:39:18 2015
(r280535)
@@ -669,11 +669,11 @@ chosen:
EFSYS_ASSERT(emop != NULL);
 
epp-ep_mac_type = type;
-   
+
if (emop-emo_reset != NULL) {
if ((rc = emop-emo_reset(enp)) != 0)
goto fail1;
-   
+
EFSYS_ASSERT(enp-en_reset_flags  EFX_RESET_MAC);
enp-en_reset_flags = ~EFX_RESET_MAC;
}

Modified: stable/10/sys/dev/sfxge/common/efx_mcdi.c
==
--- stable/10/sys/dev/sfxge/common/efx_mcdi.c   Wed Mar 25 10:38:59 2015
(r280534)
+++ stable/10/sys/dev/sfxge/common/efx_mcdi.c   Wed Mar 25 10:39:18 2015
(r280535)
@@ -44,7 +44,8 @@ __FBSDID($FreeBSD$);
 #defineMCDI_P1_REBOOT_OFST 0x1fe
 #defineMCDI_P2_REBOOT_OFST 0x1ff
 
-/* A reboot/assertion causes the MCDI status word to be set after the
+/*
+ * A reboot/assertion causes the MCDI status word to be set after the
  * command word is set or a REBOOT event is sent. If we notice a reboot
  * via these mechanisms then wait 10ms for the status word to be set.
  */
@@ -459,7 +460,8 @@ efx_mcdi_ev_death(
++emip-emi_aborted;
}
 
-   /* Since we're running in parallel with a request, consume the
+   /*
+* Since we're running in parallel with a request, consume the
 * status word before dropping the lock.
 */
if (rc == EIO || rc == EINTR) {

Modified: stable/10/sys/dev/sfxge/common/efx_nic.c
==
--- stable/10/sys/dev/sfxge/common/efx_nic.cWed Mar 25 10:38:59 2015
(r280534)
+++ stable/10/sys/dev/sfxge/common/efx_nic.cWed Mar 25 10:39:18 2015
(r280535)
@@ -253,7 +253,8 @@ efx_nic_create(
EFX_FEATURE_LFSR_HASH_INSERT |
EFX_FEATURE_LINK_EVENTS | EFX_FEATURE_PERIODIC_MAC_STATS |
EFX_FEATURE_WOL | EFX_FEATURE_MCDI |
-   EFX_FEATURE_LOOKAHEAD_SPLIT | 
EFX_FEATURE_MAC_HEADER_FILTERS;
+   EFX_FEATURE_LOOKAHEAD_SPLIT |
+   EFX_FEATURE_MAC_HEADER_FILTERS;
break;
 #endif /* EFSYS_OPT_SIENA */
 

Modified: stable/10/sys/dev/sfxge/common/efx_rx.c
==
--- stable/10/sys/dev/sfxge/common/efx_rx.c Wed Mar 25 10:38:59 2015
(r280534)
+++ stable/10/sys/dev/sfxge/common/efx_rx.c Wed Mar 25 10:39:18 2015
(r280535)
@@ -527,7 +527,7 @@ efx_rx_filter_insert(
EFSYS_ASSERT3P(spec, !=, NULL);
 
spec-efs_dmaq_id = (uint16_t)erp-er_index;
-  

svn commit: r280575 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 12:57:43 2015
New Revision: 280575
URL: https://svnweb.freebsd.org/changeset/base/280575

Log:
  MFC: 279147
  
  sfxge: TxQ block level should use EFX_TXQ_LIMIT as maximum TxQ size
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 12:46:19 2015
(r280574)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 12:57:43 2015
(r280575)
@@ -67,16 +67,22 @@ __FBSDID($FreeBSD$);
 #include sfxge.h
 #include sfxge_tx.h
 
-/* Set the block level to ensure there is space to generate a
- * large number of descriptors for TSO.  With minimum MSS and
- * maximum mbuf length we might need more than a ring-ful of
- * descriptors, but this should not happen in practice except
- * due to deliberate attack.  In that case we will truncate
- * the output at a packet boundary.
+/*
+ * Estimate maximum number of Tx descriptors required for TSO packet.
+ * With minimum MSS and maximum mbuf length we might need more (even
+ * than a ring-ful of descriptors), but this should not happen in
+ * practice except due to deliberate attack.  In that case we will
+ * truncate the output at a packet boundary.
  */
 #defineSFXGE_TSO_MAX_DESC  
\
(SFXGE_TSO_MAX_SEGS * 2 + SFXGE_TX_MAPPING_MAX_SEG - 1)
-#defineSFXGE_TXQ_BLOCK_LEVEL(_entries) ((_entries) - 
SFXGE_TSO_MAX_DESC)
+
+/*
+ * Set the block level to ensure there is space to generate a
+ * large number of descriptors for TSO.
+ */
+#defineSFXGE_TXQ_BLOCK_LEVEL(_entries) 
\
+   (EFX_TXQ_LIMIT(_entries) - SFXGE_TSO_MAX_DESC)
 
 #ifdef SFXGE_HAVE_MQ
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280582 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:04:28 2015
New Revision: 280582
URL: https://svnweb.freebsd.org/changeset/base/280582

Log:
  MFC: 279177
  
  sfxge: assert event queue lock in event handlers
  
  It is useful to highlight lock context.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_ev.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_ev.c
==
--- stable/10/sys/dev/sfxge/sfxge_ev.c  Wed Mar 25 13:03:36 2015
(r280581)
+++ stable/10/sys/dev/sfxge/sfxge_ev.c  Wed Mar 25 13:04:28 2015
(r280582)
@@ -45,6 +45,8 @@ sfxge_ev_qcomplete(struct sfxge_evq *evq
struct sfxge_rxq *rxq;
struct sfxge_txq *txq;
 
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq-sc;
index = evq-index;
rxq = sc-rxq[index];
@@ -84,6 +86,8 @@ sfxge_ev_rx(void *arg, uint32_t label, u
struct sfxge_rx_sw_desc *rx_desc;
 
evq = arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq-sc;
 
if (evq-exception)
@@ -135,6 +139,8 @@ sfxge_ev_exception(void *arg, uint32_t c
struct sfxge_softc *sc;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq-sc;
 
evq-exception = B_TRUE;
@@ -160,6 +166,8 @@ sfxge_ev_rxq_flush_done(void *arg, uint3
uint16_t magic;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq-sc;
rxq = sc-rxq[rxq_index];
 
@@ -192,6 +200,8 @@ sfxge_ev_rxq_flush_failed(void *arg, uin
uint16_t magic;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq-sc;
rxq = sc-rxq[rxq_index];
 
@@ -233,6 +243,8 @@ sfxge_ev_tx(void *arg, uint32_t label, u
unsigned int delta;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
txq = sfxge_get_txq_by_label(evq, label);
 
KASSERT(txq != NULL, (txq == NULL));
@@ -273,6 +285,8 @@ sfxge_ev_txq_flush_done(void *arg, uint3
uint16_t magic;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq-sc;
txq = sc-txq[txq_index];
 
@@ -303,6 +317,8 @@ sfxge_ev_software(void *arg, uint16_t ma
unsigned int label;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq-sc;
 
label = magic  SFXGE_MAGIC_DMAQ_LABEL_MASK;
@@ -528,6 +544,7 @@ sfxge_ev_initialized(void *arg)
struct sfxge_evq *evq;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
 
KASSERT(evq-init_state == SFXGE_EVQ_STARTING,
(evq not starting));
@@ -544,6 +561,8 @@ sfxge_ev_link_change(void *arg, efx_link
struct sfxge_softc *sc;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq-sc;
 
sfxge_mac_link_update(sc, link_mode);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280581 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:03:36 2015
New Revision: 280581
URL: https://svnweb.freebsd.org/changeset/base/280581

Log:
  MFC: 279176
  
  sfxge: pass correct address to free allocated memory in the case of load error
  
  It is one more place missed in the previous fix.
  Most likely is was just memory leak on the error handling path since
  typically efsys_mem_t is filled in by zeros on allocation.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_dma.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_dma.c
==
--- stable/10/sys/dev/sfxge/sfxge_dma.c Wed Mar 25 13:02:33 2015
(r280580)
+++ stable/10/sys/dev/sfxge/sfxge_dma.c Wed Mar 25 13:03:36 2015
(r280581)
@@ -164,8 +164,8 @@ sfxge_dma_alloc(struct sfxge_softc *sc, 
 * wrong.
 */
if (esmp-esm_addr == 0) {
-   bus_dmamem_free(esmp-esm_tag, esmp-esm_base, esmp-esm_map);
-   bus_dma_tag_destroy(esmp-esm_tag); 
+   bus_dmamem_free(esmp-esm_tag, vaddr, esmp-esm_map);
+   bus_dma_tag_destroy(esmp-esm_tag);
return (ENOMEM);
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280612 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:56:42 2015
New Revision: 280612
URL: https://svnweb.freebsd.org/changeset/base/280612

Log:
  MFC: 280432
  
  sfxge: cleanup: add a blank line before each #if to improve readability
  
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  stable/10/sys/dev/sfxge/sfxge.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge.h
==
--- stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 13:55:36 2015
(r280611)
+++ stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 13:56:42 2015
(r280612)
@@ -54,25 +54,32 @@
  */
 #defineCACHE_LINE_SIZE 128
 #endif
+
 #ifndef IFCAP_LINKSTATE
 #defineIFCAP_LINKSTATE 0
 #endif
+
 #ifndef IFCAP_VLAN_HWTSO
 #defineIFCAP_VLAN_HWTSO 0
 #endif
+
 #ifndef IFM_10G_T
 #defineIFM_10G_T IFM_UNKNOWN
 #endif
+
 #ifndef IFM_10G_KX4
 #defineIFM_10G_KX4 IFM_10G_CX4
 #endif
+
 #if (__FreeBSD_version = 800501  __FreeBSD_version  90) || \
__FreeBSD_version = 93
 #defineSFXGE_HAVE_DESCRIBE_INTR
 #endif
+
 #ifdef IFM_ETH_RXPAUSE
 #defineSFXGE_HAVE_PAUSE_MEDIAOPTS
 #endif
+
 #ifndef CTLTYPE_U64
 #defineCTLTYPE_U64 CTLTYPE_QUAD
 #endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280615 - in stable/10/sys: dev/sfxge modules/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 14:10:20 2015
New Revision: 280615
URL: https://svnweb.freebsd.org/changeset/base/280615

Log:
  MFC: 279398
  
  sfxge: compile out LRO if kernel is compiled without IPv4 and IPv6
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)
  
  MFC: 279411
  
  Unbreak 'make depend' with sfxge by removing debugging code activated in the
  INET || INET6 case
  
  X-MFC with: r279398
  Pointyhat to: arybchik

Modified:
  stable/10/sys/dev/sfxge/sfxge_rx.c
  stable/10/sys/dev/sfxge/sfxge_rx.h
  stable/10/sys/modules/sfxge/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_rx.c
==
--- stable/10/sys/dev/sfxge/sfxge_rx.c  Wed Mar 25 14:05:51 2015
(r280614)
+++ stable/10/sys/dev/sfxge/sfxge_rx.c  Wed Mar 25 14:10:20 2015
(r280615)
@@ -57,6 +57,8 @@ __FBSDID($FreeBSD$);
 
 #defineRX_REFILL_THRESHOLD(_entries)   (EFX_RXQ_LIMIT(_entries) * 9 / 
10)
 
+#ifdef SFXGE_LRO
+
 SYSCTL_NODE(_hw_sfxge, OID_AUTO, lro, CTLFLAG_RD, NULL,
Large receive offload (LRO) parameters);
 
@@ -136,6 +138,8 @@ static unsigned long ipv6_addr_cmp(const
 #endif
 }
 
+#endif /* SFXGE_LRO */
+
 void
 sfxge_rx_qflush_done(struct sfxge_rxq *rxq)
 {
@@ -342,6 +346,8 @@ sfxge_rx_deliver(struct sfxge_softc *sc,
rx_desc-mbuf = NULL;
 }
 
+#ifdef SFXGE_LRO
+
 static void
 sfxge_lro_deliver(struct sfxge_lro_state *st, struct sfxge_lro_conn *c)
 {
@@ -760,6 +766,20 @@ static void sfxge_lro_end_of_burst(struc
sfxge_lro_purge_idle(rxq, t);
 }
 
+#else  /* !SFXGE_LRO */
+
+static void
+sfxge_lro(struct sfxge_rxq *rxq, struct sfxge_rx_sw_desc *rx_buf)
+{
+}
+
+static void
+sfxge_lro_end_of_burst(struct sfxge_rxq *rxq)
+{
+}
+
+#endif /* SFXGE_LRO */
+
 void
 sfxge_rx_qcomplete(struct sfxge_rxq *rxq, boolean_t eop)
 {
@@ -1040,6 +1060,8 @@ fail:
return (rc);
 }
 
+#ifdef SFXGE_LRO
+
 static void sfxge_lro_init(struct sfxge_rxq *rxq)
 {
struct sfxge_lro_state *st = rxq-lro;
@@ -1092,6 +1114,20 @@ static void sfxge_lro_fini(struct sfxge_
st-conns = NULL;
 }
 
+#else
+
+static void
+sfxge_lro_init(struct sfxge_rxq *rxq)
+{
+}
+
+static void
+sfxge_lro_fini(struct sfxge_rxq *rxq)
+{
+}
+
+#endif /* SFXGE_LRO */
+
 static void
 sfxge_rx_qfini(struct sfxge_softc *sc, unsigned int index)
 {
@@ -1162,6 +1198,7 @@ static const struct {
 } sfxge_rx_stats[] = {
 #defineSFXGE_RX_STAT(name, member) \
{ #name, offsetof(struct sfxge_rxq, member) }
+#ifdef SFXGE_LRO
SFXGE_RX_STAT(lro_merges, lro.n_merges),
SFXGE_RX_STAT(lro_bursts, lro.n_bursts),
SFXGE_RX_STAT(lro_slow_start, lro.n_slow_start),
@@ -1170,6 +1207,7 @@ static const struct {
SFXGE_RX_STAT(lro_new_stream, lro.n_new_stream),
SFXGE_RX_STAT(lro_drop_idle, lro.n_drop_idle),
SFXGE_RX_STAT(lro_drop_closed, lro.n_drop_closed)
+#endif
 };
 
 static int
@@ -1226,6 +1264,7 @@ sfxge_rx_init(struct sfxge_softc *sc)
int index;
int rc;
 
+#ifdef SFXGE_LRO
if (!ISP2(lro_table_size)) {
log(LOG_ERR, %s=%u must be power of 2,
SFXGE_LRO_PARAM(table_size), lro_table_size);
@@ -1235,6 +1274,7 @@ sfxge_rx_init(struct sfxge_softc *sc)
 
if (lro_idle_ticks == 0)
lro_idle_ticks = hz / 10 + 1; /* 100 ms */
+#endif
 
intr = sc-intr;
 
@@ -1260,6 +1300,8 @@ fail:
 
sc-rxq_count = 0;
 
+#ifdef SFXGE_LRO
 fail_lro_table_size:
+#endif
return (rc);
 }

Modified: stable/10/sys/dev/sfxge/sfxge_rx.h
==
--- stable/10/sys/dev/sfxge/sfxge_rx.h  Wed Mar 25 14:05:51 2015
(r280614)
+++ stable/10/sys/dev/sfxge/sfxge_rx.h  Wed Mar 25 14:10:20 2015
(r280615)
@@ -32,6 +32,13 @@
 #ifndef _SFXGE_RX_H
 #define_SFXGE_RX_H
 
+#include opt_inet.h
+#include opt_inet6.h
+
+#if defined(INET) || defined(INET6)
+#defineSFXGE_LRO   1
+#endif
+
 #defineSFXGE_MAGIC_RESERVED0x8000
 
 #defineSFXGE_MAGIC_DMAQ_LABEL_WIDTH6
@@ -59,6 +66,8 @@ struct sfxge_rx_sw_desc {
int size;
 };
 
+#ifdef SFXGE_LRO
+
 /**
  * struct sfxge_lro_conn - Connection state for software LRO
  * @link: Link for hash table and free list.
@@ -139,6 +148,8 @@ struct sfxge_lro_state {
unsigned n_drop_closed;
 };
 
+#endif /* SFXGE_LRO */
+
 enum sfxge_flush_state {
SFXGE_FLUSH_DONE = 0,
SFXGE_FLUSH_PENDING,
@@ -167,7 +178,9 @@ struct sfxge_rxq {
unsigned intpending;
unsigned intcompleted;
unsigned intloopback;
+#ifdef SFXGE_LRO
struct sfxge_lro_state  lro;
+#endif
unsigned intrefill_threshold;
struct callout  refill_callout;

svn commit: r280588 - in stable/10/sys/dev/sfxge: . common

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:11:19 2015
New Revision: 280588
URL: https://svnweb.freebsd.org/changeset/base/280588

Log:
  MFC: 279182
  
  sfxge: correct event queue interrupt moderation timer quanta
  
  Submitted by:   Andrew Lee alee at solarflare.com
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/common/efx.h
  stable/10/sys/dev/sfxge/common/efx_ev.c
  stable/10/sys/dev/sfxge/common/efx_impl.h
  stable/10/sys/dev/sfxge/common/siena_nic.c
  stable/10/sys/dev/sfxge/sfxge_ev.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/efx.h
==
--- stable/10/sys/dev/sfxge/common/efx.hWed Mar 25 13:09:46 2015
(r280587)
+++ stable/10/sys/dev/sfxge/common/efx.hWed Mar 25 13:11:19 2015
(r280588)
@@ -895,7 +895,8 @@ typedef struct efx_nic_cfg_s {
uint32_tenc_txq_limit;
uint32_tenc_rxq_limit;
uint32_tenc_buftbl_limit;
-   uint32_tenc_evq_moderation_max;
+   uint32_tenc_evq_timer_quantum_ns;
+   uint32_tenc_evq_timer_max_us;
uint32_tenc_clk_mult;
 #if EFSYS_OPT_LOOPBACK
uint32_tenc_loopback_types[EFX_LINK_NMODES];

Modified: stable/10/sys/dev/sfxge/common/efx_ev.c
==
--- stable/10/sys/dev/sfxge/common/efx_ev.c Wed Mar 25 13:09:46 2015
(r280587)
+++ stable/10/sys/dev/sfxge/common/efx_ev.c Wed Mar 25 13:11:19 2015
(r280588)
@@ -857,7 +857,7 @@ efx_ev_qmoderate(
 
EFSYS_ASSERT3U(eep-ee_magic, ==, EFX_EVQ_MAGIC);
 
-   if (us  encp-enc_evq_moderation_max) {
+   if (us  encp-enc_evq_timer_max_us) {
rc = EINVAL;
goto fail1;
}
@@ -876,7 +876,7 @@ efx_ev_qmoderate(
uint32_t timer_val;
 
/* Calculate the timer value in quanta */
-   timer_val = us * encp-enc_clk_mult / EFX_EV_TIMER_QUANTUM;
+   timer_val = us * 1000 / encp-enc_evq_timer_quantum_ns;
 
/* Moderation value is base 0 so we need to deduct 1 */
if (timer_val  0)

Modified: stable/10/sys/dev/sfxge/common/efx_impl.h
==
--- stable/10/sys/dev/sfxge/common/efx_impl.h   Wed Mar 25 13:09:46 2015
(r280587)
+++ stable/10/sys/dev/sfxge/common/efx_impl.h   Wed Mar 25 13:11:19 2015
(r280588)
@@ -408,7 +408,8 @@ struct efx_evq_s {
 
 #defineEFX_EVQ_MAGIC   0x08081997
 
-#defineEFX_EV_TIMER_QUANTUM5
+#defineEFX_EVQ_FALCON_TIMER_QUANTUM_NS 4968 /* 621 cycles */
+#defineEFX_EVQ_SIENA_TIMER_QUANTUM_NS  6144 /* 768 cycles */
 
 struct efx_rxq_s {
uint32_ter_magic;

Modified: stable/10/sys/dev/sfxge/common/siena_nic.c
==
--- stable/10/sys/dev/sfxge/common/siena_nic.c  Wed Mar 25 13:09:46 2015
(r280587)
+++ stable/10/sys/dev/sfxge/common/siena_nic.c  Wed Mar 25 13:11:19 2015
(r280588)
@@ -329,8 +329,10 @@ siena_board_cfg(
encp-enc_clk_mult = 2;
}
 
-   encp-enc_evq_moderation_max = EFX_EV_TIMER_QUANTUM 
-   FRF_AB_TIMER_VAL_WIDTH / encp-enc_clk_mult;
+   encp-enc_evq_timer_quantum_ns =
+   EFX_EVQ_SIENA_TIMER_QUANTUM_NS / encp-enc_clk_mult;
+   encp-enc_evq_timer_max_us = (encp-enc_evq_timer_quantum_ns 
+   FRF_CZ_TC_TIMER_VAL_WIDTH) / 1000;
 
/* Resource limits */
req.emr_cmd = MC_CMD_GET_RESOURCE_LIMITS;

Modified: stable/10/sys/dev/sfxge/sfxge_ev.c
==
--- stable/10/sys/dev/sfxge/sfxge_ev.c  Wed Mar 25 13:09:46 2015
(r280587)
+++ stable/10/sys/dev/sfxge/sfxge_ev.c  Wed Mar 25 13:11:19 2015
(r280588)
@@ -517,7 +517,7 @@ sfxge_int_mod_handler(SYSCTL_HANDLER_ARG
 * so we have to range-check the value ourselves.
 */
if (moderation 
-   efx_nic_cfg_get(sc-enp)-enc_evq_moderation_max) {
+   efx_nic_cfg_get(sc-enp)-enc_evq_timer_max_us) {
error = EINVAL;
goto out;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280587 - stable/10/share/man/man4

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:09:46 2015
New Revision: 280587
URL: https://svnweb.freebsd.org/changeset/base/280587

Log:
  MFC: 279181
  
  sfxge: add indefinite article and update timestamp
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/share/man/man4/sfxge.4
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/sfxge.4
==
--- stable/10/share/man/man4/sfxge.4Wed Mar 25 13:08:57 2015
(r280586)
+++ stable/10/share/man/man4/sfxge.4Wed Mar 25 13:09:46 2015
(r280587)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd September 30, 2014
+.Dd February 22, 2015
 .Dt SFXGE 4
 .Os
 .Sh NAME
@@ -103,7 +103,7 @@ The value must be greater than 0.
 The maximum number of non-TCP packets in the deferred packet
 .Dq get-list
 , used only if the transmit queue lock can be acquired.
-If packet is dropped, the
+If a packet is dropped, the
 .Va tx_get_non_tcp_overflow
 counter is incremented and the local sender receives ENOBUFS.
 The value must be greater than 0.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280605 - stable/10/sys/dev/sfxge/common

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:48:54 2015
New Revision: 280605
URL: https://svnweb.freebsd.org/changeset/base/280605

Log:
  MFC: 280375
  
  sfxge: add barriers to BAR write macros
  
  In theory the barriers are required to cope with write combining and
  reordering. Two barriers are added (sometimes merged to one):
   1. Before the first write to guarantee that previous writes to the region
  have been done
   2. Before the last write to guarantee that write to the last dword/qword is
  done after previous writes
  Barriers are inserted before in the assumption that it is better to
  postpone barriers as much as it is possible (more chances that the
  operation has already been already done and barrier does not stall CPU).
  
  On x86 and amd64 bus space write barriers are just compiler memory barriers
  which are definitely required.
  
  Sponsored by:   Solarflare Communications, Inc.
  Original Differential Revision: https://reviews.freebsd.org/D2077

Modified:
  stable/10/sys/dev/sfxge/common/efsys.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/efsys.h
==
--- stable/10/sys/dev/sfxge/common/efsys.h  Wed Mar 25 13:47:48 2015
(r280604)
+++ stable/10/sys/dev/sfxge/common/efsys.h  Wed Mar 25 13:48:54 2015
(r280605)
@@ -786,6 +786,14 @@ typedef struct efsys_bar_s {
EFSYS_PROBE2(bar_writed, unsigned int, (_offset),   \
uint32_t, (_edp)-ed_u32[0]);   \
\
+   /*  \
+* Make sure that previous writes to the dword have \
+* been done. It should be cheaper than barrier just\
+* after the write below.   \
+*/ \
+   bus_space_barrier((_esbp)-esb_tag, (_esbp)-esb_handle,\
+   (_offset), sizeof (efx_dword_t),\
+   BUS_SPACE_BARRIER_WRITE);   \
bus_space_write_stream_4((_esbp)-esb_tag,  \
(_esbp)-esb_handle,\
(_offset), (_edp)-ed_u32[0]);  \
@@ -809,6 +817,14 @@ typedef struct efsys_bar_s {
uint32_t, (_eqp)-eq_u32[1],\
uint32_t, (_eqp)-eq_u32[0]);   \
\
+   /*  \
+* Make sure that previous writes to the qword have \
+* been done. It should be cheaper than barrier just\
+* after the write below.   \
+*/ \
+   bus_space_barrier((_esbp)-esb_tag, (_esbp)-esb_handle,\
+   (_offset), sizeof (efx_qword_t),\
+   BUS_SPACE_BARRIER_WRITE);   \
bus_space_write_stream_8((_esbp)-esb_tag,  \
(_esbp)-esb_handle,\
(_offset), (_eqp)-eq_u64[0]);  \
@@ -829,9 +845,25 @@ typedef struct efsys_bar_s {
uint32_t, (_eqp)-eq_u32[1],\
uint32_t, (_eqp)-eq_u32[0]);   \
\
+   /*  \
+* Make sure that previous writes to the qword have \
+* been done. It should be cheaper than barrier just\
+* after the last write below.  \
+*/ \
+   bus_space_barrier((_esbp)-esb_tag, (_esbp)-esb_handle,\
+   (_offset), sizeof (efx_qword_t),\
+   BUS_SPACE_BARRIER_WRITE);   \
bus_space_write_stream_4((_esbp)-esb_tag,  \
(_esbp)-esb_handle,\
(_offset), (_eqp)-eq_u32[0]);  \
+   /*  \
+* It should be guaranteed that the last dword comes\
+* the last, so barrier entire qword to be sure that\
+* neither above nor below writes are reordered.\
+*/ 

svn commit: r280596 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:18:51 2015
New Revision: 280596
URL: https://svnweb.freebsd.org/changeset/base/280596

Log:
  MFC: 279351
  
  sfxge: expect required init_state on data path and in periodic calls
  
  With the patch applied the number of instruction events is 1% less and
  number of mispredicted branch events is 5% less under multistream TCP
  traffic load close to line rate.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_ev.c
  stable/10/sys/dev/sfxge/sfxge_intr.c
  stable/10/sys/dev/sfxge/sfxge_port.c
  stable/10/sys/dev/sfxge/sfxge_rx.c
  stable/10/sys/dev/sfxge/sfxge_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_ev.c
==
--- stable/10/sys/dev/sfxge/sfxge_ev.c  Wed Mar 25 13:18:36 2015
(r280595)
+++ stable/10/sys/dev/sfxge/sfxge_ev.c  Wed Mar 25 13:18:51 2015
(r280596)
@@ -98,7 +98,7 @@ sfxge_ev_rx(void *arg, uint32_t label, u
KASSERT(evq-index == rxq-index,
(evq-index != rxq-index));
 
-   if (rxq-init_state != SFXGE_RXQ_STARTED)
+   if (__predict_false(rxq-init_state != SFXGE_RXQ_STARTED))
goto done;
 
expected = rxq-pending++  rxq-ptr_mask;
@@ -251,7 +251,7 @@ sfxge_ev_tx(void *arg, uint32_t label, u
KASSERT(evq-index == txq-evq_index,
(evq-index != txq-evq_index));
 
-   if (txq-init_state != SFXGE_TXQ_STARTED)
+   if (__predict_false(txq-init_state != SFXGE_TXQ_STARTED))
goto done;
 
stop = (id + 1)  txq-ptr_mask;
@@ -428,7 +428,7 @@ sfxge_ev_stat_update(struct sfxge_softc 
 
SFXGE_ADAPTER_LOCK(sc);
 
-   if (sc-evq[0]-init_state != SFXGE_EVQ_STARTED)
+   if (__predict_false(sc-evq[0]-init_state != SFXGE_EVQ_STARTED))
goto out;
 
now = ticks;
@@ -593,8 +593,8 @@ sfxge_ev_qpoll(struct sfxge_evq *evq)
 
SFXGE_EVQ_LOCK(evq);
 
-   if (evq-init_state != SFXGE_EVQ_STARTING 
-   evq-init_state != SFXGE_EVQ_STARTED) {
+   if (__predict_false(evq-init_state != SFXGE_EVQ_STARTING 
+   evq-init_state != SFXGE_EVQ_STARTED)) {
rc = EINVAL;
goto fail;
}

Modified: stable/10/sys/dev/sfxge/sfxge_intr.c
==
--- stable/10/sys/dev/sfxge/sfxge_intr.cWed Mar 25 13:18:36 2015
(r280595)
+++ stable/10/sys/dev/sfxge/sfxge_intr.cWed Mar 25 13:18:51 2015
(r280596)
@@ -130,7 +130,7 @@ sfxge_intr_message(void *arg)
KASSERT(intr-type == EFX_INTR_MESSAGE,
(intr-type != EFX_INTR_MESSAGE));
 
-   if (intr-state != SFXGE_INTR_STARTED)
+   if (__predict_false(intr-state != SFXGE_INTR_STARTED))
return;
 
(void)efx_intr_status_message(enp, index, fatal);

Modified: stable/10/sys/dev/sfxge/sfxge_port.c
==
--- stable/10/sys/dev/sfxge/sfxge_port.cWed Mar 25 13:18:36 2015
(r280595)
+++ stable/10/sys/dev/sfxge/sfxge_port.cWed Mar 25 13:18:51 2015
(r280596)
@@ -50,7 +50,7 @@ sfxge_mac_stat_update(struct sfxge_softc
 
SFXGE_PORT_LOCK_ASSERT_OWNED(port);
 
-   if (port-init_state != SFXGE_PORT_STARTED) {
+   if (__predict_false(port-init_state != SFXGE_PORT_STARTED)) {
rc = 0;
goto out;
}
@@ -179,7 +179,7 @@ sfxge_port_wanted_fc_handler(SYSCTL_HAND
SFXGE_PORT_LOCK(port);
 
if (port-wanted_fc != fcntl) {
-   if (port-init_state == SFXGE_PORT_STARTED)
+   if (__predict_false(port-init_state == SFXGE_PORT_STARTED))
error = efx_mac_fcntl_set(sc-enp,
  port-wanted_fc,
  B_TRUE);
@@ -210,7 +210,8 @@ sfxge_port_link_fc_handler(SYSCTL_HANDLE
port = sc-port;
 
SFXGE_PORT_LOCK(port);
-   if (port-init_state == SFXGE_PORT_STARTED  SFXGE_LINK_UP(sc))
+   if (__predict_true(port-init_state == SFXGE_PORT_STARTED) 
+   SFXGE_LINK_UP(sc))
efx_mac_fcntl_get(sc-enp, wanted_fc, link_fc);
else
link_fc = 0;
@@ -265,7 +266,7 @@ sfxge_mac_poll_work(void *arg, int npend
 
SFXGE_PORT_LOCK(port);
 
-   if (port-init_state != SFXGE_PORT_STARTED)
+   if (__predict_false(port-init_state != SFXGE_PORT_STARTED))
goto done;
 
/* This may sleep waiting for MCDI completion */
@@ -332,7 +333,7 @@ sfxge_mac_filter_set(struct sfxge_softc 
 * lock is held in sleeping thread. Both problems are repeatable
 * on LAG with LACP proto bring up.
 */
-   

svn commit: r280599 - in stable/10: share/man/man4 sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:41:26 2015
New Revision: 280599
URL: https://svnweb.freebsd.org/changeset/base/280599

Log:
  MFC: 280160
  
  sfxge: add tunables to control LRO parameters on driver load time
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/share/man/man4/sfxge.4
  stable/10/sys/dev/sfxge/sfxge_rx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/sfxge.4
==
--- stable/10/share/man/man4/sfxge.4Wed Mar 25 13:32:27 2015
(r280598)
+++ stable/10/share/man/man4/sfxge.4Wed Mar 25 13:41:26 2015
(r280599)
@@ -120,6 +120,27 @@ The value must be greater than or equal 
 The maximum number of allocated RSS channels for the Nth adapter.
 If set to 0 or unset, the number of channels is determined by the number
 of CPU cores.
+.It Va hw.sfxge.lro.table_size
+Size of the LRO hash table.
+Must be a power of 2.
+A larger table means we can accelerate a larger number of streams.
+.It Va hw.sfxge.lro.chain_max
+The maximum length of a hash chain.
+If chains get too long then the lookup time increases and may exceed
+the benefit of LRO.
+.It Va hw.sfxge.lro.idle_ticks
+The maximum time (in ticks) that a connection can be idle before it's LRO
+state is discarded.
+.It Va hw.sfxge.lro.slow_start_packets
+Number of packets with payload that must arrive in-order before a connection
+is eligible for LRO.
+The idea is we should avoid coalescing segments when the sender is in
+slow-start because reducing the ACK rate can damage performance.
+.It Va hw.sfxge.lro.loss_packets
+Number of packets with payload that must arrive in-order following loss
+before a connection is eligible for LRO.
+The idea is we should avoid coalescing segments when the sender is recovering
+from loss, because reducing the ACK rate can damage performance.
 .El
 .Sh SUPPORT
 For general information and support,

Modified: stable/10/sys/dev/sfxge/sfxge_rx.c
==
--- stable/10/sys/dev/sfxge/sfxge_rx.c  Wed Mar 25 13:32:27 2015
(r280598)
+++ stable/10/sys/dev/sfxge/sfxge_rx.c  Wed Mar 25 13:41:26 2015
(r280599)
@@ -36,6 +36,7 @@ __FBSDID($FreeBSD$);
 #include sys/socket.h
 #include sys/sysctl.h
 #include sys/limits.h
+#include sys/syslog.h
 
 #include net/ethernet.h
 #include net/if.h
@@ -56,20 +57,38 @@ __FBSDID($FreeBSD$);
 
 #defineRX_REFILL_THRESHOLD(_entries)   (EFX_RXQ_LIMIT(_entries) * 9 / 
10)
 
+SYSCTL_NODE(_hw_sfxge, OID_AUTO, lro, CTLFLAG_RD, NULL,
+   Large receive offload (LRO) parameters);
+
+#defineSFXGE_LRO_PARAM(_param) SFXGE_PARAM(lro._param)
+
 /* Size of the LRO hash table.  Must be a power of 2.  A larger table
  * means we can accelerate a larger number of streams.
  */
 static unsigned lro_table_size = 128;
+TUNABLE_INT(SFXGE_LRO_PARAM(table_size), lro_table_size);
+SYSCTL_UINT(_hw_sfxge_lro, OID_AUTO, table_size, CTLFLAG_RDTUN,
+   lro_table_size, 0,
+   Size of the LRO hash table (must be a power of 2));
 
 /* Maximum length of a hash chain.  If chains get too long then the lookup
  * time increases and may exceed the benefit of LRO.
  */
 static unsigned lro_chain_max = 20;
+TUNABLE_INT(SFXGE_LRO_PARAM(chain_max), lro_chain_max);
+SYSCTL_UINT(_hw_sfxge_lro, OID_AUTO, chain_max, CTLFLAG_RDTUN,
+   lro_chain_max, 0,
+   The maximum length of a hash chain);
 
 /* Maximum time (in ticks) that a connection can be idle before it's LRO
  * state is discarded.
  */
 static unsigned lro_idle_ticks; /* initialised in sfxge_rx_init() */
+TUNABLE_INT(SFXGE_LRO_PARAM(idle_ticks), lro_idle_ticks);
+SYSCTL_UINT(_hw_sfxge_lro, OID_AUTO, idle_ticks, CTLFLAG_RDTUN,
+   lro_idle_ticks, 0,
+   The maximum time (in ticks) that a connection can be idle 
+   before it's LRO state is discarded);
 
 /* Number of packets with payload that must arrive in-order before a
  * connection is eligible for LRO.  The idea is we should avoid coalescing
@@ -77,6 +96,11 @@ static unsigned lro_idle_ticks; /* initi
  * can damage performance.
  */
 static int lro_slow_start_packets = 2000;
+TUNABLE_INT(SFXGE_LRO_PARAM(slow_start_packets), lro_slow_start_packets);
+SYSCTL_UINT(_hw_sfxge_lro, OID_AUTO, slow_start_packets, CTLFLAG_RDTUN,
+   lro_slow_start_packets, 0,
+   Number of packets with payload that must arrive in-order before 
+   a connection is eligible for LRO);
 
 /* Number of packets with payload that must arrive in-order following loss
  * before a connection is eligible for LRO.  The idea is we should avoid
@@ -84,6 +108,11 @@ static int lro_slow_start_packets = 2000
  * reducing the ACK rate can damage performance.
  */
 static int lro_loss_packets = 20;
+TUNABLE_INT(SFXGE_LRO_PARAM(loss_packets), lro_loss_packets);
+SYSCTL_UINT(_hw_sfxge_lro, OID_AUTO, 

svn commit: r280603 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:46:30 2015
New Revision: 280603
URL: https://svnweb.freebsd.org/changeset/base/280603

Log:
  MFC: 280164
  
  sfxge: increase default put-list limit to 1024
  
  Drops are observed under multi-stream TCP traffic due to put-list
  overflow with limit equal to 64.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.h
==
--- stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 13:45:20 2015
(r280602)
+++ stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 13:46:30 2015
(r280603)
@@ -81,7 +81,7 @@ struct sfxge_tx_mapping {
 
 #defineSFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT  (64 * 1024)
 #defineSFXGE_TX_DPL_GET_NON_TCP_PKT_LIMIT_DEFAULT  1024
-#defineSFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT  64
+#defineSFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT  1024
 
 /*
  * Deferred packet list.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280610 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:54:28 2015
New Revision: 280610
URL: https://svnweb.freebsd.org/changeset/base/280610

Log:
  MFC: 280380
  
  sfxge: remove unnecessary and wrong prediction
  
  Sponsored by:   Solarflare Communications, Inc.
  Original Differential Revision: https://reviews.freebsd.org/D2085

Modified:
  stable/10/sys/dev/sfxge/sfxge_port.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_port.c
==
--- stable/10/sys/dev/sfxge/sfxge_port.cWed Mar 25 13:53:28 2015
(r280609)
+++ stable/10/sys/dev/sfxge/sfxge_port.cWed Mar 25 13:54:28 2015
(r280610)
@@ -179,7 +179,7 @@ sfxge_port_wanted_fc_handler(SYSCTL_HAND
SFXGE_PORT_LOCK(port);
 
if (port-wanted_fc != fcntl) {
-   if (__predict_false(port-init_state == SFXGE_PORT_STARTED))
+   if (port-init_state == SFXGE_PORT_STARTED)
error = efx_mac_fcntl_set(sc-enp,
  port-wanted_fc,
  B_TRUE);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280577 - stable/10/sys/dev/sfxge/common

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 12:59:49 2015
New Revision: 280577
URL: https://svnweb.freebsd.org/changeset/base/280577

Log:
  MFC: 279173
  
  sfxge: add missing common code NVRAM types and map from MCDI
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/common/efx.h
  stable/10/sys/dev/sfxge/common/siena_nvram.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/efx.h
==
--- stable/10/sys/dev/sfxge/common/efx.hWed Mar 25 12:59:01 2015
(r280576)
+++ stable/10/sys/dev/sfxge/common/efx.hWed Mar 25 12:59:49 2015
(r280577)
@@ -1024,6 +1024,10 @@ typedef enum efx_nvram_type_e {
EFX_NVRAM_MC_GOLDEN,
EFX_NVRAM_PHY,
EFX_NVRAM_NULLPHY,
+   EFX_NVRAM_FPGA,
+   EFX_NVRAM_FCFW,
+   EFX_NVRAM_CPLD,
+   EFX_NVRAM_FPGA_BACKUP,
EFX_NVRAM_NTYPES,
 } efx_nvram_type_t;
 

Modified: stable/10/sys/dev/sfxge/common/siena_nvram.c
==
--- stable/10/sys/dev/sfxge/common/siena_nvram.cWed Mar 25 12:59:01 
2015(r280576)
+++ stable/10/sys/dev/sfxge/common/siena_nvram.cWed Mar 25 12:59:49 
2015(r280577)
@@ -330,6 +330,14 @@ static siena_parttbl_entry_t siena_partt
{MC_CMD_NVRAM_TYPE_EXP_ROM_CFG_PORT1,   2, EFX_NVRAM_BOOTROM_CFG},
{MC_CMD_NVRAM_TYPE_PHY_PORT0,   1, EFX_NVRAM_PHY},
{MC_CMD_NVRAM_TYPE_PHY_PORT1,   2, EFX_NVRAM_PHY},
+   {MC_CMD_NVRAM_TYPE_FPGA,1, EFX_NVRAM_FPGA},
+   {MC_CMD_NVRAM_TYPE_FPGA,2, EFX_NVRAM_FPGA},
+   {MC_CMD_NVRAM_TYPE_FPGA_BACKUP, 1, EFX_NVRAM_FPGA_BACKUP},
+   {MC_CMD_NVRAM_TYPE_FPGA_BACKUP, 2, EFX_NVRAM_FPGA_BACKUP},
+   {MC_CMD_NVRAM_TYPE_FC_FW,   1, EFX_NVRAM_FCFW},
+   {MC_CMD_NVRAM_TYPE_FC_FW,   2, EFX_NVRAM_FCFW},
+   {MC_CMD_NVRAM_TYPE_CPLD,1, EFX_NVRAM_CPLD},
+   {MC_CMD_NVRAM_TYPE_CPLD,2, EFX_NVRAM_CPLD},
{0, 0, 0},
 };
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280585 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:06:37 2015
New Revision: 280585
URL: https://svnweb.freebsd.org/changeset/base/280585

Log:
  MFC: 279179
  
  sfxge: DMA allocated memory is set to zeros because of BUS_DMA_ZERO flag
  
  It is not required to set it to zeros once again.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_rx.c
  stable/10/sys/dev/sfxge/sfxge_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_rx.c
==
--- stable/10/sys/dev/sfxge/sfxge_rx.c  Wed Mar 25 13:05:33 2015
(r280584)
+++ stable/10/sys/dev/sfxge/sfxge_rx.c  Wed Mar 25 13:06:37 2015
(r280585)
@@ -1113,7 +1113,6 @@ sfxge_rx_qinit(struct sfxge_softc *sc, u
/* Allocate and zero DMA space. */
if ((rc = sfxge_dma_alloc(sc, EFX_RXQ_SIZE(sc-rxq_entries), esmp)) != 
0)
return (rc);
-   (void)memset(esmp-esm_base, 0, EFX_RXQ_SIZE(sc-rxq_entries));
 
/* Allocate buffer table entries. */
sfxge_sram_buf_tbl_alloc(sc, EFX_RXQ_NBUFS(sc-rxq_entries),

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 13:05:33 2015
(r280584)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 13:06:37 2015
(r280585)
@@ -1399,7 +1399,6 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
/* Allocate and zero DMA space for the descriptor ring. */
if ((rc = sfxge_dma_alloc(sc, EFX_TXQ_SIZE(sc-txq_entries), esmp)) != 
0)
return (rc);
-   (void)memset(esmp-esm_base, 0, EFX_TXQ_SIZE(sc-txq_entries));
 
/* Allocate buffer table entries. */
sfxge_sram_buf_tbl_alloc(sc, EFX_TXQ_NBUFS(sc-txq_entries),
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280606 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:50:38 2015
New Revision: 280606
URL: https://svnweb.freebsd.org/changeset/base/280606

Log:
  MFC: 280376
  
  sfxge: remove obsolete Tx non-multi queue support
  
  Tx multi queue is added in FreeBSD 8.0. So, the changeset drops earlier
  versions support.
  
  Sponsored by:   Solarflare Communications, Inc.
  Original Differential Revision: https://reviews.freebsd.org/D2081

Modified:
  stable/10/sys/dev/sfxge/sfxge.c
  stable/10/sys/dev/sfxge/sfxge.h
  stable/10/sys/dev/sfxge/sfxge_rx.c
  stable/10/sys/dev/sfxge/sfxge_tx.c
  stable/10/sys/dev/sfxge/sfxge_tx.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge.c
==
--- stable/10/sys/dev/sfxge/sfxge.c Wed Mar 25 13:48:54 2015
(r280605)
+++ stable/10/sys/dev/sfxge/sfxge.c Wed Mar 25 13:50:38 2015
(r280606)
@@ -329,19 +329,8 @@ sfxge_ifnet_init(struct ifnet *ifp, stru
 
ether_ifattach(ifp, encp-enc_mac_addr);
 
-#ifdef SFXGE_HAVE_MQ
ifp-if_transmit = sfxge_if_transmit;
ifp-if_qflush = sfxge_if_qflush;
-#else
-   ifp-if_start = sfxge_if_start;
-   IFQ_SET_MAXLEN(ifp-if_snd, sc-txq_entries - 1);
-   ifp-if_snd.ifq_drv_maxlen = sc-txq_entries - 1;
-   IFQ_SET_READY(ifp-if_snd);
-
-   snprintf(sc-tx_lock_name, sizeof(sc-tx_lock_name),
-%s:tx, device_get_nameunit(sc-dev));
-   mtx_init(sc-tx_lock, sc-tx_lock_name, NULL, MTX_DEF);
-#endif
 
if ((rc = sfxge_port_ifmedia_init(sc)) != 0)
goto fail;

Modified: stable/10/sys/dev/sfxge/sfxge.h
==
--- stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 13:48:54 2015
(r280605)
+++ stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 13:50:38 2015
(r280606)
@@ -66,12 +66,6 @@
 #ifndef IFM_10G_KX4
 #defineIFM_10G_KX4 IFM_10G_CX4
 #endif
-#if __FreeBSD_version = 800054
-/* Networking core is multiqueue aware. We can manage our own TX
- * queues and use m_pkthdr.flowid.
- */
-#defineSFXGE_HAVE_MQ
-#endif
 #if (__FreeBSD_version = 800501  __FreeBSD_version  90) || \
__FreeBSD_version = 93
 #defineSFXGE_HAVE_DESCRIBE_INTR
@@ -242,11 +236,7 @@ struct sfxge_softc {
struct sfxge_rxq*rxq[SFXGE_RX_SCALE_MAX];
unsigned intrx_indir_table[SFXGE_RX_SCALE_MAX];
 
-#ifdef SFXGE_HAVE_MQ
struct sfxge_txq*txq[SFXGE_TXQ_NTYPES + 
SFXGE_RX_SCALE_MAX];
-#else
-   struct sfxge_txq*txq[SFXGE_TXQ_NTYPES];
-#endif
 
struct ifmedia  media;
 
@@ -254,11 +244,6 @@ struct sfxge_softc {
size_t  rx_buffer_size;
uma_zone_t  rx_buffer_zone;
 
-#ifndef SFXGE_HAVE_MQ
-   struct mtx  tx_lock __aligned(CACHE_LINE_SIZE);
-   chartx_lock_name[SFXGE_LOCK_NAME_MAX];
-#endif
-
unsigned intevq_count;
unsigned intrxq_count;
unsigned inttxq_count;

Modified: stable/10/sys/dev/sfxge/sfxge_rx.c
==
--- stable/10/sys/dev/sfxge/sfxge_rx.c  Wed Mar 25 13:48:54 2015
(r280605)
+++ stable/10/sys/dev/sfxge/sfxge_rx.c  Wed Mar 25 13:50:38 2015
(r280606)
@@ -326,14 +326,12 @@ sfxge_rx_deliver(struct sfxge_softc *sc,
if (rx_desc-flags  EFX_CKSUM_TCPUDP)
csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR;
 
-#ifdef SFXGE_HAVE_MQ
/* The hash covers a 4-tuple for TCP only */
if (rx_desc-flags  EFX_PKT_TCP) {
m-m_pkthdr.flowid = EFX_RX_HASH_VALUE(EFX_RX_HASHALG_TOEPLITZ,
   mtod(m, uint8_t *));
m-m_flags |= M_FLOWID;
}
-#endif
m-m_data += sc-rx_prefix_size;
m-m_len = rx_desc-size - sc-rx_prefix_size;
m-m_pkthdr.len = m-m_len;
@@ -380,10 +378,9 @@ sfxge_lro_deliver(struct sfxge_lro_state
memcpy(c_th + 1, c-th_last + 1, optlen);
}
 
-#ifdef SFXGE_HAVE_MQ
m-m_pkthdr.flowid = c-conn_hash;
m-m_flags |= M_FLOWID;
-#endif
+
m-m_pkthdr.csum_flags = csum_flags;
__sfxge_rx_deliver(sc, m);
 

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 13:48:54 2015
(r280605)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 13:50:38 2015
(r280606)
@@ -84,7 +84,6 @@ __FBSDID($FreeBSD$);
 #defineSFXGE_TXQ_BLOCK_LEVEL(_entries) 
\
(EFX_TXQ_LIMIT(_entries) - SFXGE_TSO_MAX_DESC)
 
-#ifdef SFXGE_HAVE_MQ
 
 #define

svn commit: r280580 - stable/10/sys/dev/sfxge/common

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:02:33 2015
New Revision: 280580
URL: https://svnweb.freebsd.org/changeset/base/280580

Log:
  MFC: 279175
  
  sfxge: using bus_space_*_stream_* API for better portability
  
  Host-bus byte order translation is not requred.
  
  Submitted by:   Artem V. Andreev Artem.Andreev at oktetlabs.ru
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/common/efsys.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/efsys.h
==
--- stable/10/sys/dev/sfxge/common/efsys.h  Wed Mar 25 13:01:51 2015
(r280579)
+++ stable/10/sys/dev/sfxge/common/efsys.h  Wed Mar 25 13:02:33 2015
(r280580)
@@ -94,6 +94,15 @@ extern C {
 #defineISP2(x) (((x)  ((x) - 1)) == 0)
 #endif
 
+#if defined(__x86_64__)
+#if !defined(bus_space_read_stream_8)
+#definebus_space_read_stream_8(t, h, o)
\
+   bus_space_read_8((t), (h), (o))
+#definebus_space_write_stream_8(t, h, o, v)
\
+   bus_space_write_8((t), (h), (o), (v))
+#endif
+#endif
+
 #defineENOTACTIVE EINVAL
 
 /* Memory type to use on FreeBSD */
@@ -641,8 +650,9 @@ typedef struct efsys_bar_s {
if (_lock)  \
SFXGE_BAR_LOCK(_esbp);  \
\
-   (_edp)-ed_u32[0] = bus_space_read_4((_esbp)-esb_tag,  \
-   (_esbp)-esb_handle, (_offset));\
+   (_edp)-ed_u32[0] = bus_space_read_stream_4(\
+   (_esbp)-esb_tag, (_esbp)-esb_handle,  \
+   (_offset)); \
\
EFSYS_PROBE2(bar_readd, unsigned int, (_offset),\
uint32_t, (_edp)-ed_u32[0]);   \
@@ -662,8 +672,9 @@ typedef struct efsys_bar_s {
\
SFXGE_BAR_LOCK(_esbp);  \
\
-   (_eqp)-eq_u64[0] = bus_space_read_8((_esbp)-esb_tag,  \
-   (_esbp)-esb_handle, (_offset));\
+   (_eqp)-eq_u64[0] = bus_space_read_stream_8(\
+   (_esbp)-esb_tag, (_esbp)-esb_handle,  \
+   (_offset)); \
\
EFSYS_PROBE3(bar_readq, unsigned int, (_offset),\
uint32_t, (_eqp)-eq_u32[1],\
@@ -683,10 +694,12 @@ typedef struct efsys_bar_s {
if (_lock)  \
SFXGE_BAR_LOCK(_esbp);  \
\
-   (_eop)-eo_u64[0] = bus_space_read_8((_esbp)-esb_tag,  \
-   (_esbp)-esb_handle, (_offset));\
-   (_eop)-eo_u64[1] = bus_space_read_8((_esbp)-esb_tag,  \
-   (_esbp)-esb_handle, (_offset+8));  \
+   (_eop)-eo_u64[0] = bus_space_read_stream_8(\
+   (_esbp)-esb_tag, (_esbp)-esb_handle,  \
+   (_offset)); \
+   (_eop)-eo_u64[1] = bus_space_read_stream_8(\
+   (_esbp)-esb_tag, (_esbp)-esb_handle,  \
+   (_offset) + 8); \
\
EFSYS_PROBE5(bar_reado, unsigned int, (_offset),\
uint32_t, (_eop)-eo_u32[3],\
@@ -709,10 +722,12 @@ typedef struct efsys_bar_s {
\
SFXGE_BAR_LOCK(_esbp);  \
\
-   (_eqp)-eq_u32[0] = bus_space_read_4((_esbp)-esb_tag,  \
-   (_esbp)-esb_handle, (_offset));\
-   (_eqp)-eq_u32[1] = bus_space_read_4((_esbp)-esb_tag,  \
-   (_esbp)-esb_handle, (_offset+4));  \
+   (_eqp)-eq_u32[0] = bus_space_read_stream_4(\
+   (_esbp)-esb_tag, (_esbp)-esb_handle,  \
+  

svn commit: r280604 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:47:48 2015
New Revision: 280604
URL: https://svnweb.freebsd.org/changeset/base/280604

Log:
  MFC: 280374
  
  sfxge: assert either kernel or internal copy of interface flags
  
  ioctl to put interface down sets ifp-if_flags which holds the intended
  administratively defined state and calls driver callback to apply it.
  When everything is done, driver updates internal copy of
  interface flags sc-if_flags which holds the operational state.
  So, transmit from Rx path is possible when interface is intended to be
  administratively down in accordance with ifp-if_flags, but not applied
  yet and the operational state is up in accordance with sc-if_flags.
  
  Sponsored by:   Solarflare Communications, Inc.
  Original Differential Revision: https://reviews.freebsd.org/D2075

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 13:46:30 2015
(r280603)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 13:47:48 2015
(r280604)
@@ -676,7 +676,16 @@ sfxge_if_transmit(struct ifnet *ifp, str
 
sc = (struct sfxge_softc *)ifp-if_softc;
 
-   KASSERT(ifp-if_flags  IFF_UP, (interface not up));
+   /*
+* Transmit may be called when interface is up from the kernel
+* point of view, but not yet up (in progress) from the driver
+* point of view. I.e. link aggregation bring up.
+* Transmit may be called when interface is up from the driver
+* point of view, but already down from the kernel point of
+* view. I.e. Rx when interface shutdown is in progress.
+*/
+   KASSERT((ifp-if_flags  IFF_UP) || (sc-if_flags  IFF_UP),
+   (interface not up));
 
/* Pick the desired transmit queue. */
if (m-m_pkthdr.csum_flags  (CSUM_DELAY_DATA | CSUM_TSO)) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280609 - stable/10/sys/dev/sfxge/common

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:53:28 2015
New Revision: 280609
URL: https://svnweb.freebsd.org/changeset/base/280609

Log:
  MFC: 280379
  
  sfxge: do not check MCDI status word
  
  This is a temporary workaround until we determine a reliable sequence
  of operations for detecting MC reboots.
  
  Sponsored by:   Solarflare Communications, Inc.
  Original Differential Revision: https://reviews.freebsd.org/D2084

Modified:
  stable/10/sys/dev/sfxge/common/efx_mcdi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/efx_mcdi.c
==
--- stable/10/sys/dev/sfxge/common/efx_mcdi.c   Wed Mar 25 13:52:31 2015
(r280608)
+++ stable/10/sys/dev/sfxge/common/efx_mcdi.c   Wed Mar 25 13:53:28 2015
(r280609)
@@ -213,6 +213,14 @@ static int
 efx_mcdi_poll_reboot(
__inefx_nic_t *enp)
 {
+#ifndef EFX_GRACEFUL_MC_REBOOT
+   /*
+* This function is not being used properly.
+* Until its callers are fixed, it should always return 0.
+*/
+   _NOTE(ARGUNUSED(enp))
+   return (0);
+#else
efx_mcdi_iface_t *emip = (enp-en_u.siena.enu_mip);
unsigned int rebootr;
efx_dword_t dword;
@@ -236,6 +244,7 @@ efx_mcdi_poll_reboot(
return (EINTR);
else
return (EIO);
+#endif
 }
 
__checkReturn   boolean_t
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280593 - stable/10/sys/dev/sfxge/common

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:15:47 2015
New Revision: 280593
URL: https://svnweb.freebsd.org/changeset/base/280593

Log:
  MFC: 279266
  
  sfxge: correct limit for number of Rx queues
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/common/efx_impl.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/efx_impl.h
==
--- stable/10/sys/dev/sfxge/common/efx_impl.h   Wed Mar 25 13:14:50 2015
(r280592)
+++ stable/10/sys/dev/sfxge/common/efx_impl.h   Wed Mar 25 13:15:47 2015
(r280593)
@@ -204,7 +204,7 @@ typedef struct efx_nic_ops_s {
 # define EFX_TXQ_LIMIT_TARGET 259
 #endif
 #ifndef EFX_RXQ_LIMIT_TARGET
-# define EFX_RXQ_LIMIT_TARGET 768
+# define EFX_RXQ_LIMIT_TARGET 512
 #endif
 #ifndef EFX_TXQ_DC_SIZE
 #define EFX_TXQ_DC_SIZE 1 /* 16 descriptors */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280592 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:14:50 2015
New Revision: 280592
URL: https://svnweb.freebsd.org/changeset/base/280592

Log:
  MFC: 279231
  
  sfxge: add put-list high watermark
  
  It is interesting to know how long put-list grows.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.c
  stable/10/sys/dev/sfxge/sfxge_tx.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 13:14:25 2015
(r280591)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 13:14:50 2015
(r280592)
@@ -214,6 +214,9 @@ sfxge_tx_qdpl_swizzle(struct sfxge_txq *
count++;
} while (mbuf != NULL);
 
+   if (count  stdp-std_put_hiwat)
+   stdp-std_put_hiwat = count;
+
/* Append the reversed put list to the get list. */
KASSERT(*get_tailp == NULL, (*get_tailp != NULL));
*stdp-std_getp = get_next;
@@ -1484,6 +1487,10 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
SYSCTL_CHILDREN(txq_node), OID_AUTO,
dpl_get_hiwat, CTLFLAG_RD | CTLFLAG_STATS,
stdp-std_get_hiwat, 0, );
+   SYSCTL_ADD_UINT(device_get_sysctl_ctx(sc-dev),
+   SYSCTL_CHILDREN(txq_node), OID_AUTO,
+   dpl_put_hiwat, CTLFLAG_RD | CTLFLAG_STATS,
+   stdp-std_put_hiwat, 0, );
 #endif
 
txq-type = type;

Modified: stable/10/sys/dev/sfxge/sfxge_tx.h
==
--- stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 13:14:25 2015
(r280591)
+++ stable/10/sys/dev/sfxge/sfxge_tx.h  Wed Mar 25 13:14:50 2015
(r280592)
@@ -102,6 +102,8 @@ struct sfxge_tx_dpl {
 * in get list */
unsigned intstd_get_hiwat;  /* Packets in get list
 * high watermark */
+   unsigned intstd_put_hiwat;  /* Packets in put list
+* high watermark */
 };
 
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280600 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:42:37 2015
New Revision: 280600
URL: https://svnweb.freebsd.org/changeset/base/280600

Log:
  MFC: 280161
  
  sfxge: move deferred packet list statistics to dedicated node
  
  It is done to structure sysctl and do not mix with Tx queue statistics
  to be added.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 13:41:26 2015
(r280599)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 13:42:37 2015
(r280600)
@@ -1379,11 +1379,13 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
 enum sfxge_txq_type type, unsigned int evq_index)
 {
char name[16];
+   struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc-dev);
struct sysctl_oid *txq_node;
struct sfxge_txq *txq;
struct sfxge_evq *evq;
 #ifdef SFXGE_HAVE_MQ
struct sfxge_tx_dpl *stdp;
+   struct sysctl_oid *dpl_node;
 #endif
efsys_mem_t *esmp;
unsigned int nmaps;
@@ -1432,10 +1434,8 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
}
 
snprintf(name, sizeof(name), %u, txq_index);
-   txq_node = SYSCTL_ADD_NODE(
-   device_get_sysctl_ctx(sc-dev),
-   SYSCTL_CHILDREN(sc-txqs_node),
-   OID_AUTO, name, CTLFLAG_RD, NULL, );
+   txq_node = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(sc-txqs_node),
+  OID_AUTO, name, CTLFLAG_RD, NULL, );
if (txq_node == NULL) {
rc = ENOMEM;
goto fail_txq_node;
@@ -1475,21 +1475,25 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
 
SFXGE_TXQ_LOCK_INIT(txq, device_get_nameunit(sc-dev), txq_index);
 
-   SYSCTL_ADD_UINT(device_get_sysctl_ctx(sc-dev),
-   SYSCTL_CHILDREN(txq_node), OID_AUTO,
-   dpl_get_count, CTLFLAG_RD | CTLFLAG_STATS,
+   dpl_node = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(txq_node), OID_AUTO,
+  dpl, CTLFLAG_RD, NULL,
+  Deferred packet list statistics);
+   if (dpl_node == NULL) {
+   rc = ENOMEM;
+   goto fail_dpl_node;
+   }
+
+   SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(dpl_node), OID_AUTO,
+   get_count, CTLFLAG_RD | CTLFLAG_STATS,
stdp-std_get_count, 0, );
-   SYSCTL_ADD_UINT(device_get_sysctl_ctx(sc-dev),
-   SYSCTL_CHILDREN(txq_node), OID_AUTO,
-   dpl_get_non_tcp_count, CTLFLAG_RD | CTLFLAG_STATS,
+   SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(dpl_node), OID_AUTO,
+   get_non_tcp_count, CTLFLAG_RD | CTLFLAG_STATS,
stdp-std_get_non_tcp_count, 0, );
-   SYSCTL_ADD_UINT(device_get_sysctl_ctx(sc-dev),
-   SYSCTL_CHILDREN(txq_node), OID_AUTO,
-   dpl_get_hiwat, CTLFLAG_RD | CTLFLAG_STATS,
+   SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(dpl_node), OID_AUTO,
+   get_hiwat, CTLFLAG_RD | CTLFLAG_STATS,
stdp-std_get_hiwat, 0, );
-   SYSCTL_ADD_UINT(device_get_sysctl_ctx(sc-dev),
-   SYSCTL_CHILDREN(txq_node), OID_AUTO,
-   dpl_put_hiwat, CTLFLAG_RD | CTLFLAG_STATS,
+   SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(dpl_node), OID_AUTO,
+   put_hiwat, CTLFLAG_RD | CTLFLAG_STATS,
stdp-std_put_hiwat, 0, );
 #endif
 
@@ -1500,6 +1504,7 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
 
return (0);
 
+fail_dpl_node:
 fail_tx_dpl_put_max:
 fail_tx_dpl_get_max:
 fail3:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280601 - in stable/10/sys: dev/sfxge modules/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:44:01 2015
New Revision: 280601
URL: https://svnweb.freebsd.org/changeset/base/280601

Log:
  MFC: 280162
  
  sfxge: adding version info to device description
  
  The information is required for NIC update and config tools.
  
  Submitted by:   Artem V. Andreev Artem.Andreev at oktetlabs.ru
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Added:
  stable/10/sys/dev/sfxge/sfxge_version.h
 - copied unchanged from r280162, head/sys/dev/sfxge/sfxge_version.h
Modified:
  stable/10/sys/dev/sfxge/sfxge.c
  stable/10/sys/modules/sfxge/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge.c
==
--- stable/10/sys/dev/sfxge/sfxge.c Wed Mar 25 13:42:37 2015
(r280600)
+++ stable/10/sys/dev/sfxge/sfxge.c Wed Mar 25 13:44:01 2015
(r280601)
@@ -56,6 +56,7 @@ __FBSDID($FreeBSD$);
 
 #include sfxge.h
 #include sfxge_rx.h
+#include sfxge_version.h
 
 #defineSFXGE_CAP (IFCAP_VLAN_MTU | \
   IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM | IFCAP_TSO |   \
@@ -472,6 +473,12 @@ sfxge_create(struct sfxge_softc *sc)
if ((error = efx_nic_probe(enp)) != 0)
goto fail5;
 
+   SYSCTL_ADD_STRING(device_get_sysctl_ctx(dev),
+ SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
+ OID_AUTO, version, CTLFLAG_RD,
+ SFXGE_VERSION_STRING, 0,
+ Driver version);
+
/* Initialize the NVRAM. */
if ((error = efx_nvram_init(enp)) != 0)
goto fail6;

Copied: stable/10/sys/dev/sfxge/sfxge_version.h (from r280162, 
head/sys/dev/sfxge/sfxge_version.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/10/sys/dev/sfxge/sfxge_version.h Wed Mar 25 13:44:01 2015
(r280601, copy of r280162, head/sys/dev/sfxge/sfxge_version.h)
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2015 Solarflare Communications, Inc.
+ * All rights reserved.
+ *
+ * This software was developed in part by OKTET Labs under contract for
+ * Solarflare Communications, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SFXGE_VERSION_H
+#define_SFXGE_VERSION_H
+
+#defineSFXGE_VERSION_STRINGv3.3.4.6363
+
+#endif /* _SFXGE_DRIVER_VERSION_H */

Modified: stable/10/sys/modules/sfxge/Makefile
==
--- stable/10/sys/modules/sfxge/MakefileWed Mar 25 13:42:37 2015
(r280600)
+++ stable/10/sys/modules/sfxge/MakefileWed Mar 25 13:44:01 2015
(r280601)
@@ -11,7 +11,7 @@ SRCS+=opt_inet.h opt_sched.h
 SRCS+= sfxge.c sfxge_dma.c sfxge_ev.c
 SRCS+= sfxge_intr.c sfxge_mcdi.c
 SRCS+= sfxge_port.c sfxge_rx.c sfxge_tx.c
-SRCS+= sfxge.h sfxge_rx.h sfxge_tx.h
+SRCS+= sfxge.h sfxge_rx.h sfxge_tx.h sfxge_version.h
 
 .PATH: ${.CURDIR}/../../dev/sfxge/common
 SRCS+= efx_ev.c efx_intr.c efx_mac.c efx_mcdi.c efx_nic.c 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280576 - stable/10/sys/dev/sfxge/common

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 12:59:01 2015
New Revision: 280576
URL: https://svnweb.freebsd.org/changeset/base/280576

Log:
  MFC: 279172
  
  sfxge: add new identities to Siena static config
  
  Submitted by:   Andrew Jackson ajackson at solarflare.com
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/common/siena_flash.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/siena_flash.h
==
--- stable/10/sys/dev/sfxge/common/siena_flash.hWed Mar 25 12:57:43 
2015(r280575)
+++ stable/10/sys/dev/sfxge/common/siena_flash.hWed Mar 25 12:59:01 
2015(r280576)
@@ -81,7 +81,9 @@ typedef struct siena_mc_static_config_hd
efx_byte_t  green_mode_valid;   /* Whether cal holds a valid 
value */
efx_word_t  mac_addr_count;
efx_word_t  mac_addr_stride;
-   efx_dword_t reserved2[2];   /* (write as zero) */
+   efx_word_t  calibrated_vref;
+   efx_word_t  adc_vref;
+   efx_dword_t reserved2[1];   /* (write as zero) */
efx_dword_t num_dbi_items;
struct {
efx_word_t  addr;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280613 - stable/10/sys/dev/sfxge

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:57:54 2015
New Revision: 280613
URL: https://svnweb.freebsd.org/changeset/base/280613

Log:
  MFC: 280433
  
  sfxge: cleanup: fix index variable type to match upper boundary type
  
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  stable/10/sys/dev/sfxge/sfxge_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_tx.c
==
--- stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 13:56:42 2015
(r280612)
+++ stable/10/sys/dev/sfxge/sfxge_tx.c  Wed Mar 25 13:57:54 2015
(r280613)
@@ -667,7 +667,7 @@ void
 sfxge_if_qflush(struct ifnet *ifp)
 {
struct sfxge_softc *sc;
-   int i;
+   unsigned int i;
 
sc = ifp-if_softc;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r280578 - stable/10/sys/dev/sfxge/common

2015-03-25 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Mar 25 13:01:10 2015
New Revision: 280578
URL: https://svnweb.freebsd.org/changeset/base/280578

Log:
  MFC: 279174
  
  sfxge: add missing Siena sensors to common code
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  stable/10/sys/dev/sfxge/common/siena_mon.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/siena_mon.c
==
--- stable/10/sys/dev/sfxge/common/siena_mon.c  Wed Mar 25 12:59:49 2015
(r280577)
+++ stable/10/sys/dev/sfxge/common/siena_mon.c  Wed Mar 25 13:01:10 2015
(r280578)
@@ -70,6 +70,21 @@ static __cs uint16_t __siena_mon_port0_m
EFX_MON_STAT_2_5V,  /* MC_CMD_SENSOR_IN_2V5 */
EFX_MON_STAT_3_3V,  /* MC_CMD_SENSOR_IN_3V3 */
EFX_MON_STAT_12V,   /* MC_CMD_SENSOR_IN_12V0 */
+   EFX_MON_STAT_1_2VA, /* MC_CMD_SENSOR_IN_1V2A */
+   EFX_MON_STAT_VREF,  /* MC_CMD_SENSOR_IN_VREF */
+   EFX_MON_STAT_VAOE,  /* MC_CMD_SENSOR_OUT_VAOE */
+   EFX_MON_STAT_AOE_TEMP,  /* MC_CMD_SENSOR_AOE_TEMP */
+   EFX_MON_STAT_PSU_AOE_TEMP,  /* MC_CMD_SENSOR_PSU_AOE_TEMP */
+   EFX_MON_STAT_PSU_TEMP,  /* MC_CMD_SENSOR_PSE_TEMP */
+   EFX_MON_STAT_FAN0,  /* MC_CMD_SENSOR_FAN_0 */
+   EFX_MON_STAT_FAN1,  /* MC_CMD_SENSOR_FAN_1 */
+   EFX_MON_STAT_FAN2,  /* MC_CMD_SENSOR_FAN_2 */
+   EFX_MON_STAT_FAN3,  /* MC_CMD_SENSOR_FAN_3 */
+   EFX_MON_STAT_FAN4,  /* MC_CMD_SENSOR_FAN_4 */
+   EFX_MON_STAT_VAOE_IN,   /* MC_CMD_SENSOR_IN_VAOE */
+   EFX_MON_STAT_IAOE,  /* MC_CMD_SENSOR_OUT_IAOE */
+   EFX_MON_STAT_IAOE_IN,   /* MC_CMD_SENSOR_IN_IAOE */
+
 };
 
 static __cs uint16_t __siena_mon_port1_map[] = {
@@ -86,6 +101,21 @@ static __cs uint16_t __siena_mon_port1_m
EFX_MON_STAT_2_5V,  /* MC_CMD_SENSOR_IN_2V5 */
EFX_MON_STAT_3_3V,  /* MC_CMD_SENSOR_IN_3V3 */
EFX_MON_STAT_12V,   /* MC_CMD_SENSOR_IN_12V0 */
+   EFX_MON_STAT_1_2VA, /* MC_CMD_SENSOR_IN_1V2A */
+   EFX_MON_STAT_VREF,  /* MC_CMD_SENSOR_IN_VREF */
+   EFX_MON_STAT_VAOE,  /* MC_CMD_SENSOR_OUT_VAOE */
+   EFX_MON_STAT_AOE_TEMP,  /* MC_CMD_SENSOR_AOE_TEMP */
+   EFX_MON_STAT_PSU_AOE_TEMP,  /* MC_CMD_SENSOR_PSU_AOE_TEMP */
+   EFX_MON_STAT_PSU_TEMP,  /* MC_CMD_SENSOR_PSE_TEMP */
+   EFX_MON_STAT_FAN0,  /* MC_CMD_SENSOR_FAN_0 */
+   EFX_MON_STAT_FAN1,  /* MC_CMD_SENSOR_FAN_1 */
+   EFX_MON_STAT_FAN2,  /* MC_CMD_SENSOR_FAN_2 */
+   EFX_MON_STAT_FAN3,  /* MC_CMD_SENSOR_FAN_3 */
+   EFX_MON_STAT_FAN4,  /* MC_CMD_SENSOR_FAN_4 */
+   EFX_MON_STAT_VAOE_IN,   /* MC_CMD_SENSOR_IN_VAOE */
+   EFX_MON_STAT_IAOE,  /* MC_CMD_SENSOR_OUT_IAOE */
+   EFX_MON_STAT_IAOE_IN,   /* MC_CMD_SENSOR_IN_IAOE */
+
 };
 
 #defineSIENA_STATIC_SENSOR_ASSERT(_field)  
\
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


  1   2   3   4   5   6   7   8   9   10   >