Skip to content

Commit

Permalink
Assorted TSO fixes for em(4)/iflib(9) and dead code removal:
Browse files Browse the repository at this point in the history
- Ever since the workaround for the silicon bug of TSO4 causing MAC hangs
  was committed in r295133, CSUM_TSO always got disabled unconditionally
  by em(4) on the first invocation of em_init_locked(). However, even with
  that problem fixed, it turned out that for at least e. g. 82579 not all
  necessary TSO workarounds are in place, still causing MAC hangs even at
  Gigabit speed. Thus, for stable/11, TSO usage was deliberately disabled
  in r323292 (r323293 for stable/10) for the EM-class by default, allowing
  users to turn it on if it happens to work with their particular EM MAC
  in a Gigabit-only environment.
  In head, the TSO workaround for speeds other than Gigabit was lost with
  the conversion to iflib(9) in r311849 (possibly along with another one
  or two TSO workarounds). Yet at the same time, for EM-class MACs TSO4
  got enabled by default again, causing device hangs. Therefore, change the
  default for this hardware class back to have TSO4 off, allowing users
  to turn it on manually if it happens to work in their environment as
  we do in stable/{10,11}. An alternative would be to add a whitelist of
  EM-class devices where TSO4 actually is reliable with the workarounds in
  place, but given that the advantage of TSO at Gigabit speed is rather
  limited - especially with the overhead of these workarounds -, that's
  really not worth it. [1]
  This change includes the addition of an isc_capabilities to struct
  if_softc_ctx so iflib(9) can also handle interface capabilities that
  shouldn't be enabled by default which is used to handle the default-off
  capabilities of e1000 as suggested by shurd@ and moving their handling
  from em_setup_interface() to em_if_attach_pre() accordingly.
- Although 82543 support TSO4 in theory, the former lem(4) didn't have
  support for TSO4, presumably because TSO4 is even more broken in the
  LEM-class of MACs than the later EM ones. Still, TSO4 for LEM-class
  devices was enabled as part of the conversion to iflib(9) in r311849,
  causing device hangs. So revert back to the pre-r311849 behavior of
  not supporting TSO4 for LEM-class at all, which includes not creating
  a TSO DMA tag in iflib(9) for devices not having IFCAP_TSO4 set. [2]
- In fact, the FreeBSD TCP stack can handle a TSO size of IP_MAXPACKET
  (65535) rather than FREEBSD_TSO_SIZE_MAX (65518). However, the TSO
  DMA must have a maxsize of the maximum TSO size plus the size of a
  VLAN header for software VLAN tagging. The iflib(9) converted em(4),
  thus, first correctly sets scctx->isc_tx_tso_size_max to EM_TSO_SIZE
  in em_if_attach_pre(), but later on overrides it with IP_MAXPACKET
  in em_setup_interface() (apparently, left-over from pre-iflib(9)
  times). So remove the later and correct iflib(9) to correctly cap
  the maximum TSO size reported to the stack at IP_MAXPACKET. While at
  it, let iflib(9) use if_sethwtsomax*().
  This change includes the addition of isc_tso_max{seg,}size DMA engine
  constraints for the TSO DMA tag to struct if_shared_ctx and letting
  iflib_txsd_alloc() automatically adjust the maxsize of that tag in case
  IFCAP_VLAN_MTU is supported as requested by shurd@.
- Move the if_setifheaderlen(9) call for adjusting the maximum Ethernet
  header length from {ixgbe,ixl,ixlv,ixv,em}_setup_interface() to iflib(9)
  so adjustment is automatically done in case IFCAP_VLAN_MTU is supported.
  As a consequence, this adjustment now is also done in case of bnxt(4)
  which missed it previously.
- Move the reduction of the maximum TSO segment count reported to the
  stack by the number of m_pullup(9) calls (which in the worst case,
  can add another mbuf and, thus, the requirement for another DMA
  segment each) in the transmit path for performance reasons from
  em_setup_interface() to iflib_txsd_alloc() as these pull-ups are now
  done in iflib_parse_header() rather than in the no longer existing
  em_xmit(). Moreover, this optimization applies to all drivers using
  iflib(9) and not just em(4); all in-tree iflib(9) consumers still
  have enough room to handle full size TSO packets. Also, reduce the
  adjustment to the maximum number of m_pullup(9)'s now performed in
  iflib_parse_header().
- Prior to the conversion of em(4)/igb(4)/lem(4) and ixl(4) to iflib(9)
  in r311849 and r335338 respectively, these drivers didn't enable
  IFCAP_VLAN_HWFILTER by default due to VLAN events not being passed
  through by lagg(4). With iflib(9), IFCAP_VLAN_HWFILTER was turned on
  by default but also lagg(4) was fixed in that regard in r203548. So
  just remove the now redundant and defunct IFCAP_VLAN_HWFILTER handling
  in {em,ixl,ixlv}_setup_interface().
- Nuke other redundant IFCAP_* setting in {em,ixl,ixlv}_setup_interface()
  which is (more completely) already done in {em,ixl,ixlv}_if_attach_pre()
  now.
- Remove some redundant/dead setting of scctx->isc_tx_csum_flags in
  em_if_attach_pre().
- Remove some IFCAP_* duplicated either directly or indirectly (e. g.
  via IFCAP_HWCSUM) in {EM,IGB,IXL}_CAPS.
- Don't bother to fiddle with IFCAP_HWSTATS in ixgbe(4)/ixgbev(4) as
  iflib(9) adds that capability unconditionally.
- Remove some unused macros from em(4).
- Bump __FreeBSD_version as some of the above changes require the modules
  of drivers using iflib(9) to be recompiled.

Okayed by:	sbruno@ at 201806 DevSummit Transport Working Group [1]
Reviewed by:	sbruno (earlier version), erj
PR:	219428 (part of; comment freebsd#10) [1], 220997 (part of; comment freebsd#3) [2]
Differential Revision:	https://reviews.freebsd.org/D15720


git-svn-id: https://svn.freebsd.org/base/head@336313 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
  • Loading branch information
marius committed Jul 15, 2018
1 parent e9032e9 commit 31b56d6
Show file tree
Hide file tree
Showing 12 changed files with 164 additions and 160 deletions.
12 changes: 7 additions & 5 deletions sys/dev/bnxt/if_bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,12 @@ static struct if_shared_ctx bnxt_sctx_init = {
.isc_nfl = 2, // Number of Free Lists
.isc_flags = IFLIB_HAS_RXCQ | IFLIB_HAS_TXCQ | IFLIB_NEED_ETHER_PAD,
.isc_q_align = PAGE_SIZE,
.isc_tx_maxsize = BNXT_TSO_SIZE,
.isc_tx_maxsegsize = BNXT_TSO_SIZE,
.isc_rx_maxsize = BNXT_TSO_SIZE,
.isc_rx_maxsegsize = BNXT_TSO_SIZE,
.isc_tx_maxsize = BNXT_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_tx_maxsegsize = BNXT_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_tso_maxsize = BNXT_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_tso_maxsegsize = BNXT_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_rx_maxsize = BNXT_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_rx_maxsegsize = BNXT_TSO_SIZE + sizeof(struct ether_vlan_header),

// Only use a single segment to avoid page size constraints
.isc_rx_nsegments = 1,
Expand Down Expand Up @@ -784,7 +786,7 @@ bnxt_attach_pre(if_ctx_t ctx)
scctx->isc_txrx = &bnxt_txrx;
scctx->isc_tx_csum_flags = (CSUM_IP | CSUM_TCP | CSUM_UDP |
CSUM_TCP_IPV6 | CSUM_UDP_IPV6 | CSUM_TSO);
scctx->isc_capenable =
scctx->isc_capabilities = scctx->isc_capenable =
/* These are translated to hwassit bits */
IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6 | IFCAP_TSO4 | IFCAP_TSO6 |
/* These are checked by iflib */
Expand Down
107 changes: 46 additions & 61 deletions sys/dev/e1000/if_em.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,6 @@ static driver_t em_if_driver = {

#define EM_TICKS_TO_USECS(ticks) ((1024 * (ticks) + 500) / 1000)
#define EM_USECS_TO_TICKS(usecs) ((1000 * (usecs) + 512) / 1024)
#define M_TSO_LEN 66

#define MAX_INTS_PER_SEC 8000
#define DEFAULT_ITR (1000000000/(MAX_INTS_PER_SEC * 256))
Expand All @@ -420,8 +419,6 @@ static driver_t em_if_driver = {
#define CSUM_TSO 0
#endif

#define TSO_WORKAROUND 4

static SYSCTL_NODE(_hw, OID_AUTO, em, CTLFLAG_RD, 0, "EM driver parameters");

static int em_disable_crc_stripping = 0;
Expand Down Expand Up @@ -484,8 +481,10 @@ extern struct if_txrx lem_txrx;
static struct if_shared_ctx em_sctx_init = {
.isc_magic = IFLIB_MAGIC,
.isc_q_align = PAGE_SIZE,
.isc_tx_maxsize = EM_TSO_SIZE,
.isc_tx_maxsize = EM_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_tx_maxsegsize = PAGE_SIZE,
.isc_tso_maxsize = EM_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_tso_maxsegsize = EM_TSO_SEG_SIZE,
.isc_rx_maxsize = MJUM9BYTES,
.isc_rx_nsegments = 1,
.isc_rx_maxsegsize = MJUM9BYTES,
Expand Down Expand Up @@ -697,16 +696,19 @@ em_set_num_queues(if_ctx_t ctx)
return (maxqueues);
}

#define LEM_CAPS \
IFCAP_HWCSUM | IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | \
IFCAP_VLAN_HWCSUM | IFCAP_WOL | IFCAP_VLAN_HWFILTER

#define EM_CAPS \
IFCAP_TSO4 | IFCAP_TXCSUM | IFCAP_LRO | IFCAP_RXCSUM | IFCAP_VLAN_HWFILTER | IFCAP_WOL_MAGIC | \
IFCAP_WOL_MCAST | IFCAP_WOL | IFCAP_VLAN_HWTSO | IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | \
IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO | IFCAP_VLAN_MTU;
#define EM_CAPS \
IFCAP_HWCSUM | IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | \
IFCAP_VLAN_HWCSUM | IFCAP_WOL | IFCAP_VLAN_HWFILTER | IFCAP_TSO4 | \
IFCAP_LRO | IFCAP_VLAN_HWTSO

#define IGB_CAPS \
IFCAP_TSO4 | IFCAP_TXCSUM | IFCAP_LRO | IFCAP_RXCSUM | IFCAP_VLAN_HWFILTER | IFCAP_WOL_MAGIC | \
IFCAP_WOL_MCAST | IFCAP_WOL | IFCAP_VLAN_HWTSO | IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWCSUM | \
IFCAP_VLAN_HWTSO | IFCAP_VLAN_MTU | IFCAP_TXCSUM_IPV6 | IFCAP_HWCSUM_IPV6 | IFCAP_JUMBO_MTU;
#define IGB_CAPS \
IFCAP_HWCSUM | IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | \
IFCAP_VLAN_HWCSUM | IFCAP_WOL | IFCAP_VLAN_HWFILTER | IFCAP_TSO4 | \
IFCAP_LRO | IFCAP_VLAN_HWTSO | IFCAP_JUMBO_MTU | IFCAP_HWCSUM_IPV6;

/*********************************************************************
* Device initialization routine
Expand Down Expand Up @@ -773,18 +775,11 @@ em_if_attach_pre(if_ctx_t ctx)
/* Determine hardware and mac info */
em_identify_hardware(ctx);

/* Set isc_msix_bar */
scctx->isc_msix_bar = PCIR_BAR(EM_MSIX_BAR);
scctx->isc_tx_nsegments = EM_MAX_SCATTER;
scctx->isc_tx_tso_segments_max = scctx->isc_tx_nsegments;
scctx->isc_tx_tso_size_max = EM_TSO_SIZE;
scctx->isc_tx_tso_segsize_max = EM_TSO_SEG_SIZE;
scctx->isc_nrxqsets_max = scctx->isc_ntxqsets_max = em_set_num_queues(ctx);
device_printf(dev, "attach_pre capping queues at %d\n", scctx->isc_ntxqsets_max);

scctx->isc_tx_csum_flags = CSUM_TCP | CSUM_UDP | CSUM_IP_TSO;


if (adapter->hw.mac.type >= igb_mac_min) {
int try_second_bar;

Expand All @@ -793,7 +788,10 @@ em_if_attach_pre(if_ctx_t ctx)
scctx->isc_txd_size[0] = sizeof(union e1000_adv_tx_desc);
scctx->isc_rxd_size[0] = sizeof(union e1000_adv_rx_desc);
scctx->isc_txrx = &igb_txrx;
scctx->isc_capenable = IGB_CAPS;
scctx->isc_tx_tso_segments_max = EM_MAX_SCATTER;
scctx->isc_tx_tso_size_max = EM_TSO_SIZE;
scctx->isc_tx_tso_segsize_max = EM_TSO_SEG_SIZE;
scctx->isc_capabilities = scctx->isc_capenable = IGB_CAPS;
scctx->isc_tx_csum_flags = CSUM_TCP | CSUM_UDP | CSUM_TSO | CSUM_IP6_TCP \
| CSUM_IP6_UDP | CSUM_IP6_TCP;
if (adapter->hw.mac.type != e1000_82575)
Expand All @@ -807,26 +805,44 @@ em_if_attach_pre(if_ctx_t ctx)
try_second_bar = pci_read_config(dev, scctx->isc_msix_bar, 4);
if (try_second_bar == 0)
scctx->isc_msix_bar += 4;

} else if (adapter->hw.mac.type >= em_mac_min) {
scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0]* sizeof(struct e1000_tx_desc), EM_DBA_ALIGN);
scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] * sizeof(union e1000_rx_desc_extended), EM_DBA_ALIGN);
scctx->isc_txd_size[0] = sizeof(struct e1000_tx_desc);
scctx->isc_rxd_size[0] = sizeof(union e1000_rx_desc_extended);
scctx->isc_txrx = &em_txrx;
scctx->isc_capenable = EM_CAPS;
scctx->isc_tx_tso_segments_max = EM_MAX_SCATTER;
scctx->isc_tx_tso_size_max = EM_TSO_SIZE;
scctx->isc_tx_tso_segsize_max = EM_TSO_SEG_SIZE;
scctx->isc_capabilities = scctx->isc_capenable = EM_CAPS;
/*
* For EM-class devices, don't enable IFCAP_{TSO4,VLAN_HWTSO}
* by default as we don't have workarounds for all associated
* silicon errata. E. g., with several MACs such as 82573E,
* TSO only works at Gigabit speed and otherwise can cause the
* hardware to hang (which also would be next to impossible to
* work around given that already queued TSO-using descriptors
* would need to be flushed and vlan(4) reconfigured at runtime
* in case of a link speed change). Moreover, MACs like 82579
* still can hang at Gigabit even with all publicly documented
* TSO workarounds implemented. Generally, the penality of
* these workarounds is rather high and may involve copying
* mbuf data around so advantages of TSO lapse. Still, TSO may
* work for a few MACs of this class - at least when sticking
* with Gigabit - in which case users may enable TSO manually.
*/
scctx->isc_capenable &= ~(IFCAP_TSO4 | IFCAP_VLAN_HWTSO);
scctx->isc_tx_csum_flags = CSUM_TCP | CSUM_UDP | CSUM_IP_TSO;
} else {
scctx->isc_txqsizes[0] = roundup2((scctx->isc_ntxd[0] + 1) * sizeof(struct e1000_tx_desc), EM_DBA_ALIGN);
scctx->isc_rxqsizes[0] = roundup2((scctx->isc_nrxd[0] + 1) * sizeof(struct e1000_rx_desc), EM_DBA_ALIGN);
scctx->isc_txd_size[0] = sizeof(struct e1000_tx_desc);
scctx->isc_rxd_size[0] = sizeof(struct e1000_rx_desc);
scctx->isc_tx_csum_flags = CSUM_TCP | CSUM_UDP | CSUM_IP_TSO;
scctx->isc_tx_csum_flags = CSUM_TCP | CSUM_UDP;
scctx->isc_txrx = &lem_txrx;
scctx->isc_capenable = EM_CAPS;
scctx->isc_capabilities = scctx->isc_capenable = LEM_CAPS;
if (adapter->hw.mac.type < e1000_82543)
scctx->isc_capenable &= ~(IFCAP_HWCSUM|IFCAP_VLAN_HWCSUM);
scctx->isc_tx_csum_flags = CSUM_TCP | CSUM_UDP | CSUM_IP_TSO;
scctx->isc_msix_bar = 0;
}

Expand Down Expand Up @@ -1007,6 +1023,11 @@ em_if_attach_pre(if_ctx_t ctx)
*/
em_get_wakeup(ctx);

/* Enable only WOL MAGIC by default */
scctx->isc_capenable &= ~IFCAP_WOL;
if (adapter->wol != 0)
scctx->isc_capenable |= IFCAP_WOL_MAGIC;

iflib_set_mac(ctx, hw->mac.addr);

return (0);
Expand Down Expand Up @@ -2750,51 +2771,15 @@ em_setup_interface(if_ctx_t ctx)
struct ifnet *ifp = iflib_get_ifp(ctx);
struct adapter *adapter = iflib_get_softc(ctx);
if_softc_ctx_t scctx = adapter->shared;
uint64_t cap = 0;

INIT_DEBUGOUT("em_setup_interface: begin");

/* TSO parameters */
if_sethwtsomax(ifp, IP_MAXPACKET);
/* Take m_pullup(9)'s in em_xmit() w/ TSO into acount. */
if_sethwtsomaxsegcount(ifp, EM_MAX_SCATTER - 5);
if_sethwtsomaxsegsize(ifp, EM_TSO_SEG_SIZE);

/* Single Queue */
if (adapter->tx_num_queues == 1) {
if_setsendqlen(ifp, scctx->isc_ntxd[0] - 1);
if_setsendqready(ifp);
}

cap = IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM | IFCAP_TSO4;
cap |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO | IFCAP_VLAN_MTU;

/*
* Tell the upper layer(s) we
* support full VLAN capability
*/
if_setifheaderlen(ifp, sizeof(struct ether_vlan_header));
if_setcapabilitiesbit(ifp, cap, 0);

/*
* Don't turn this on by default, if vlans are
* created on another pseudo device (eg. lagg)
* then vlan events are not passed thru, breaking
* operation, but with HW FILTER off it works. If
* using vlans directly on the em driver you can
* enable this and get full hardware tag filtering.
*/
if_setcapabilitiesbit(ifp, IFCAP_VLAN_HWFILTER,0);

/* Enable only WOL MAGIC by default */
if (adapter->wol) {
if_setcapenablebit(ifp, IFCAP_WOL_MAGIC,
IFCAP_WOL_MCAST| IFCAP_WOL_UCAST);
} else {
if_setcapenablebit(ifp, 0, IFCAP_WOL_MAGIC |
IFCAP_WOL_MCAST| IFCAP_WOL_UCAST);
}

/*
* Specify the media types supported by this adapter and register
* callbacks to update media and link information
Expand Down
7 changes: 1 addition & 6 deletions sys/dev/e1000/if_em.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,6 @@
#define IGB_LINK_ITR 2000
#define I210_LINK_DELAY 1000

#define IGB_MAX_SCATTER 40
#define IGB_VFTA_SIZE 128
#define IGB_BR_SIZE 4096 /* ring buf size */
#define IGB_TSO_SIZE (65535 + sizeof(struct ether_vlan_header))
#define IGB_TSO_SEG_SIZE 4096 /* Max dma segment size */
#define IGB_TXPBSIZE 20408
#define IGB_HDR_BUF 128
#define IGB_PKTTYPE_MASK 0x0000FFF0
Expand Down Expand Up @@ -340,7 +335,7 @@

#define EM_MAX_SCATTER 40
#define EM_VFTA_SIZE 128
#define EM_TSO_SIZE (65535 + sizeof(struct ether_vlan_header))
#define EM_TSO_SIZE 65535
#define EM_TSO_SEG_SIZE 4096 /* Max dma segment size */
#define EM_MSIX_MASK 0x01F00000 /* For 82574 use */
#define EM_MSIX_LINK 0x01000000 /* For 82574 use */
Expand Down
9 changes: 4 additions & 5 deletions sys/dev/ixgbe/if_ix.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,10 @@ extern struct if_txrx ixgbe_txrx;
static struct if_shared_ctx ixgbe_sctx_init = {
.isc_magic = IFLIB_MAGIC,
.isc_q_align = PAGE_SIZE,/* max(DBA_ALIGN, PAGE_SIZE) */
.isc_tx_maxsize = IXGBE_TSO_SIZE,

.isc_tx_maxsize = IXGBE_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_tx_maxsegsize = PAGE_SIZE,

.isc_tso_maxsize = IXGBE_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_tso_maxsegsize = PAGE_SIZE,
.isc_rx_maxsize = PAGE_SIZE*4,
.isc_rx_nsegments = 1,
.isc_rx_maxsegsize = PAGE_SIZE*4,
Expand Down Expand Up @@ -1034,7 +1034,7 @@ ixgbe_if_attach_pre(if_ctx_t ctx)

scctx->isc_txrx = &ixgbe_txrx;

scctx->isc_capenable = IXGBE_CAPS;
scctx->isc_capabilities = scctx->isc_capenable = IXGBE_CAPS;

return (0);

Expand Down Expand Up @@ -1175,7 +1175,6 @@ ixgbe_setup_interface(if_ctx_t ctx)

INIT_DEBUGOUT("ixgbe_setup_interface: begin");

if_setifheaderlen(ifp, sizeof(struct ether_vlan_header));
if_setbaudrate(ifp, IF_Gbps(10));

adapter->max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
Expand Down
13 changes: 6 additions & 7 deletions sys/dev/ixgbe/if_ixv.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ extern struct if_txrx ixgbe_txrx;
static struct if_shared_ctx ixv_sctx_init = {
.isc_magic = IFLIB_MAGIC,
.isc_q_align = PAGE_SIZE,/* max(DBA_ALIGN, PAGE_SIZE) */
.isc_tx_maxsize = IXGBE_TSO_SIZE,

.isc_tx_maxsize = IXGBE_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_tx_maxsegsize = PAGE_SIZE,

.isc_tso_maxsize = IXGBE_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_tso_maxsegsize = PAGE_SIZE,
.isc_rx_maxsize = MJUM16BYTES,
.isc_rx_nsegments = 1,
.isc_rx_maxsegsize = MJUM16BYTES,
Expand Down Expand Up @@ -507,11 +507,11 @@ ixv_if_attach_pre(if_ctx_t ctx)
/*
* Tell the upper layer(s) we support everything the PF
* driver does except...
* hardware stats
* Wake-on-LAN
*/
scctx->isc_capenable = IXGBE_CAPS;
scctx->isc_capenable ^= IFCAP_HWSTATS | IFCAP_WOL;
scctx->isc_capabilities = IXGBE_CAPS;
scctx->isc_capabilities ^= IFCAP_WOL;
scctx->isc_capenable = scctx->isc_capabilities;

INIT_DEBUGOUT("ixv_if_attach_pre: end");

Expand Down Expand Up @@ -1163,7 +1163,6 @@ ixv_setup_interface(if_ctx_t ctx)

INIT_DEBUGOUT("ixv_setup_interface: begin");

if_setifheaderlen(ifp, sizeof(struct ether_vlan_header));
if_setbaudrate(ifp, IF_Gbps(10));
ifp->if_snd.ifq_maxlen = scctx->isc_ntxd[0] - 2;

Expand Down
2 changes: 1 addition & 1 deletion sys/dev/ixgbe/ixgbe.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
#define IXGBE_CAPS (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 | IFCAP_TSO | \
IFCAP_LRO | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO | \
IFCAP_VLAN_HWCSUM | IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU | \
IFCAP_HWSTATS | IFCAP_VLAN_HWFILTER | IFCAP_WOL)
IFCAP_VLAN_HWFILTER | IFCAP_WOL)

/* Backward compatibility items for very old versions */
#ifndef pci_find_cap
Expand Down
7 changes: 4 additions & 3 deletions sys/dev/ixl/if_ixl.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,10 @@ extern struct if_txrx ixl_txrx_dwb;
static struct if_shared_ctx ixl_sctx_init = {
.isc_magic = IFLIB_MAGIC,
.isc_q_align = PAGE_SIZE,
.isc_tx_maxsize = IXL_TSO_SIZE,
.isc_tx_maxsize = IXL_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_tx_maxsegsize = IXL_MAX_DMA_SEG_SIZE,

.isc_tso_maxsize = IXL_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_tso_maxsegsize = IXL_MAX_DMA_SEG_SIZE,
.isc_rx_maxsize = 16384,
.isc_rx_nsegments = IXL_MAX_RX_SEGS,
.isc_rx_maxsegsize = IXL_MAX_DMA_SEG_SIZE,
Expand Down Expand Up @@ -552,7 +553,7 @@ ixl_if_attach_pre(if_ctx_t ctx)
scctx->isc_tx_tso_segsize_max = IXL_MAX_DMA_SEG_SIZE;
scctx->isc_rss_table_size = pf->hw.func_caps.rss_table_size;
scctx->isc_tx_csum_flags = CSUM_OFFLOAD;
scctx->isc_capenable = IXL_CAPS;
scctx->isc_capabilities = scctx->isc_capenable = IXL_CAPS;

INIT_DEBUGOUT("ixl_if_attach_pre: end");
return (0);
Expand Down
23 changes: 4 additions & 19 deletions sys/dev/ixl/if_ixlv.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ extern struct if_txrx ixl_txrx;
static struct if_shared_ctx ixlv_sctx_init = {
.isc_magic = IFLIB_MAGIC,
.isc_q_align = PAGE_SIZE,/* max(DBA_ALIGN, PAGE_SIZE) */
.isc_tx_maxsize = IXL_TSO_SIZE,

.isc_tx_maxsize = IXL_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_tx_maxsegsize = PAGE_SIZE,

.isc_tso_maxsize = IXL_TSO_SIZE + sizeof(struct ether_vlan_header),
.isc_tso_maxsegsize = PAGE_SIZE,
// TODO: Review the rx_maxsize and rx_maxsegsize params
// Where are they used in iflib?
.isc_rx_maxsize = 16384,
Expand Down Expand Up @@ -446,7 +446,7 @@ ixlv_if_attach_pre(if_ctx_t ctx)
// TODO: Probably needs changing
vsi->shared->isc_rss_table_size = sc->hw.func_caps.rss_table_size;
scctx->isc_tx_csum_flags = CSUM_OFFLOAD;
scctx->isc_capenable = IXL_CAPS;
scctx->isc_capabilities = scctx->isc_capenable = IXL_CAPS;

INIT_DBG_DEV(dev, "end");
return (0);
Expand Down Expand Up @@ -1841,11 +1841,6 @@ ixlv_setup_interface(device_t dev, struct ixl_vsi *vsi)

INIT_DBG_DEV(dev, "begin");

/* initialize fast path functions */
cap = IXL_CAPS;
if_setifheaderlen(ifp, sizeof(struct ether_vlan_header));
if_setcapabilitiesbit(ifp, cap, 0);
if_setcapenable(ifp, if_getcapabilities(ifp));
/* TODO: Remove VLAN_ENCAP_LEN? */
vsi->shared->isc_max_frame_size =
ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN
Expand All @@ -1856,16 +1851,6 @@ ixlv_setup_interface(device_t dev, struct ixl_vsi *vsi)
if_initbaudrate(ifp, IF_Gbps(40));
#endif

/*
** Don't turn this on by default, if vlans are
** created on another pseudo device (eg. lagg)
** then vlan events are not passed thru, breaking
** operation, but with HW FILTER off it works. If
** using vlans directly on the ixl driver you can
** enable this and get full hardware tag filtering.
*/
if_setcapabilitiesbit(ifp, IFCAP_VLAN_HWFILTER, 0);

/* Media types based on reported link speed over AdminQ */
ifmedia_add(&sc->media, IFM_ETHER | IFM_100_TX, 0, NULL);
ifmedia_add(&sc->media, IFM_ETHER | IFM_1000_T, 0, NULL);
Expand Down
Loading

0 comments on commit 31b56d6

Please sign in to comment.