Module Name: src Committed By: msaitoh Date: Wed Apr 4 08:13:07 UTC 2018
Modified Files: src/sys/dev/pci/ixgbe: if_bypass.c if_fdir.c if_sriov.c ix_txrx.c ixgbe.c ixgbe.h ixgbe_82598.c ixgbe_82598.h ixgbe_82599.c ixgbe_82599.h ixgbe_api.c ixgbe_api.h ixgbe_common.c ixgbe_common.h ixgbe_dcb.c ixgbe_dcb.h ixgbe_dcb_82598.c ixgbe_dcb_82598.h ixgbe_dcb_82599.c ixgbe_dcb_82599.h ixgbe_fdir.h ixgbe_mbx.c ixgbe_mbx.h ixgbe_osdep.c ixgbe_osdep.h ixgbe_phy.c ixgbe_phy.h ixgbe_rss.h ixgbe_sriov.h ixgbe_type.h ixgbe_vf.c ixgbe_vf.h ixgbe_x540.c ixgbe_x540.h ixv.c Log Message: Sync with the remaining part of FreeBSD r328265 except sfp_reinit stuff: - Always schedule module intterrupt in ixgbe_config_link() when a device is SFP+ based. - Use not loop index but txr->me in ixv_initialize_{transmit,receive}_units(). It's required for VMDQ but NetBSD doesn't use it, so it's not a bug in NetBSD. - Simplify ixgbe_bp_wd_set(). No functional change. - Whitespace. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/ixgbe/if_bypass.c \ src/sys/dev/pci/ixgbe/ixgbe_osdep.c src/sys/dev/pci/ixgbe/ixgbe_rss.h cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/ixgbe/if_fdir.c \ src/sys/dev/pci/ixgbe/ixgbe_fdir.h cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/ixgbe/if_sriov.c \ src/sys/dev/pci/ixgbe/ixgbe_sriov.h cvs rdiff -u -r1.38 -r1.39 src/sys/dev/pci/ixgbe/ix_txrx.c cvs rdiff -u -r1.143 -r1.144 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.40 -r1.41 src/sys/dev/pci/ixgbe/ixgbe.h cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/ixgbe/ixgbe_82598.c \ src/sys/dev/pci/ixgbe/ixgbe_phy.h cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/ixgbe/ixgbe_82598.h \ src/sys/dev/pci/ixgbe/ixgbe_x540.h cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/ixgbe/ixgbe_82599.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/ixgbe/ixgbe_82599.h \ src/sys/dev/pci/ixgbe/ixgbe_dcb.c cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/ixgbe/ixgbe_api.c cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/ixgbe/ixgbe_api.h \ src/sys/dev/pci/ixgbe/ixgbe_mbx.h src/sys/dev/pci/ixgbe/ixgbe_vf.h cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/ixgbe/ixgbe_common.c \ src/sys/dev/pci/ixgbe/ixgbe_osdep.h cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/ixgbe/ixgbe_common.h cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/ixgbe/ixgbe_dcb.h \ src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c \ src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.h \ src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.c \ src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/ixgbe/ixgbe_mbx.c cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/ixgbe/ixgbe_phy.c \ src/sys/dev/pci/ixgbe/ixgbe_vf.c cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/ixgbe/ixgbe_type.h cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/ixgbe/ixgbe_x540.c cvs rdiff -u -r1.90 -r1.91 src/sys/dev/pci/ixgbe/ixv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/ixgbe/if_bypass.c diff -u src/sys/dev/pci/ixgbe/if_bypass.c:1.3 src/sys/dev/pci/ixgbe/if_bypass.c:1.4 --- src/sys/dev/pci/ixgbe/if_bypass.c:1.3 Thu Mar 15 06:48:51 2018 +++ src/sys/dev/pci/ixgbe/if_bypass.c Wed Apr 4 08:13:07 2018 @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/if_bypass.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/if_bypass.c 327031 2017-12-20 18:15:06Z erj $*/ #include "ixgbe.h" @@ -168,13 +168,13 @@ ixgbe_bp_set_state(SYSCTLFN_ARGS) error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &state); ixgbe_bypass_mutex_clear(adapter); - if (error) + if (error != 0) return (error); state = (state >> BYPASS_STATUS_OFF_SHIFT) & 0x3; node.sysctl_data = &state; error = sysctl_lookup(SYSCTLFN_CALL(&node)); - if ((error) || (newp == NULL)) + if ((error != 0) || (newp == NULL)) return (error); /* Sanity check new state */ @@ -452,7 +452,7 @@ ixgbe_bp_wd_set(SYSCTLFN_ARGS) struct ixgbe_hw *hw = &adapter->hw; int error, tmp; static int timeout = 0; - u32 mask, arg = BYPASS_PAGE_CTL0; + u32 mask, arg; /* Get the current hardware value */ ixgbe_bypass_mutex_enter(adapter); @@ -472,48 +472,38 @@ ixgbe_bp_wd_set(SYSCTLFN_ARGS) if ((error) || (newp == NULL)) return (error); - mask = BYPASS_WDT_ENABLE_M; + arg = 0x1 << BYPASS_WDT_ENABLE_SHIFT; + mask = BYPASS_WDT_ENABLE_M | BYPASS_WDT_VALUE_M; switch (timeout) { case 0: /* disables the timer */ + arg = BYPASS_PAGE_CTL0; + mask = BYPASS_WDT_ENABLE_M; break; case 1: - arg = BYPASS_WDT_1_5 << BYPASS_WDT_TIME_SHIFT; - arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT; - mask |= BYPASS_WDT_VALUE_M; + arg |= BYPASS_WDT_1_5 << BYPASS_WDT_TIME_SHIFT; break; case 2: - arg = BYPASS_WDT_2 << BYPASS_WDT_TIME_SHIFT; - arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT; - mask |= BYPASS_WDT_VALUE_M; + arg |= BYPASS_WDT_2 << BYPASS_WDT_TIME_SHIFT; break; case 3: - arg = BYPASS_WDT_3 << BYPASS_WDT_TIME_SHIFT; - arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT; - mask |= BYPASS_WDT_VALUE_M; + arg |= BYPASS_WDT_3 << BYPASS_WDT_TIME_SHIFT; break; case 4: - arg = BYPASS_WDT_4 << BYPASS_WDT_TIME_SHIFT; - arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT; - mask |= BYPASS_WDT_VALUE_M; + arg |= BYPASS_WDT_4 << BYPASS_WDT_TIME_SHIFT; break; case 8: - arg = BYPASS_WDT_8 << BYPASS_WDT_TIME_SHIFT; - arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT; - mask |= BYPASS_WDT_VALUE_M; + arg |= BYPASS_WDT_8 << BYPASS_WDT_TIME_SHIFT; break; case 16: - arg = BYPASS_WDT_16 << BYPASS_WDT_TIME_SHIFT; - arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT; - mask |= BYPASS_WDT_VALUE_M; + arg |= BYPASS_WDT_16 << BYPASS_WDT_TIME_SHIFT; break; case 32: - arg = BYPASS_WDT_32 << BYPASS_WDT_TIME_SHIFT; - arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT; - mask |= BYPASS_WDT_VALUE_M; + arg |= BYPASS_WDT_32 << BYPASS_WDT_TIME_SHIFT; break; default: return (EINVAL); } + /* Set the new watchdog */ ixgbe_bypass_mutex_enter(adapter); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, mask, arg); @@ -559,7 +549,8 @@ ixgbe_bp_wd_reset(SYSCTLFN_ARGS) error = IXGBE_BYPASS_FW_WRITE_FAILURE; break; } - if (hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL1, &reset_wd)) { + error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL1, &reset_wd); + if (error != 0) { error = IXGBE_ERR_INVALID_ARGUMENT; break; } @@ -724,7 +715,7 @@ ixgbe_bp_log(SYSCTLFN_ARGS) /* Another log command can now run */ while (atomic_cas_uint(&adapter->bypass.log, 1, 0) == 0) usec_delay(3000); - return(error); + return (error); unlock_err: ixgbe_bypass_mutex_clear(adapter); @@ -745,9 +736,9 @@ ixgbe_bypass_init(struct adapter *adapte { struct ixgbe_hw *hw = &adapter->hw; device_t dev = adapter->dev; - u32 mask, value, sec, year; struct sysctllog **log; const struct sysctlnode *rnode, *cnode; + u32 mask, value, sec, year; if (!(adapter->feat_cap & IXGBE_FEATURE_BYPASS)) return; @@ -825,7 +816,5 @@ ixgbe_bypass_init(struct adapter *adapte ixgbe_bp_wd_reset, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL); adapter->feat_en |= IXGBE_FEATURE_BYPASS; - - return; } /* ixgbe_bypass_init */ Index: src/sys/dev/pci/ixgbe/ixgbe_osdep.c diff -u src/sys/dev/pci/ixgbe/ixgbe_osdep.c:1.3 src/sys/dev/pci/ixgbe/ixgbe_osdep.c:1.4 --- src/sys/dev/pci/ixgbe/ixgbe_osdep.c:1.3 Thu Mar 15 06:48:51 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_osdep.c Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_osdep.c,v 1.3 2018/03/15 06:48:51 msaitoh Exp $ */ +/* $NetBSD: ixgbe_osdep.c,v 1.4 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_osdep.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_osdep.c 327031 2017-12-20 18:15:06Z erj $*/ #include "ixgbe_osdep.h" #include "ixgbe.h" Index: src/sys/dev/pci/ixgbe/ixgbe_rss.h diff -u src/sys/dev/pci/ixgbe/ixgbe_rss.h:1.3 src/sys/dev/pci/ixgbe/ixgbe_rss.h:1.4 --- src/sys/dev/pci/ixgbe/ixgbe_rss.h:1.3 Fri Feb 16 04:50:19 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_rss.h Wed Apr 4 08:13:07 2018 @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_rss.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_rss.h 324518 2017-10-11 05:55:52Z sephe $*/ #ifndef _IXGBE_RSS_H_ #define _IXGBE_RSS_H_ Index: src/sys/dev/pci/ixgbe/if_fdir.c diff -u src/sys/dev/pci/ixgbe/if_fdir.c:1.1 src/sys/dev/pci/ixgbe/if_fdir.c:1.2 --- src/sys/dev/pci/ixgbe/if_fdir.c:1.1 Wed Aug 30 08:49:18 2017 +++ src/sys/dev/pci/ixgbe/if_fdir.c Wed Apr 4 08:13:07 2018 @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/if_fdir.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/if_fdir.c 327031 2017-12-20 18:15:06Z erj $*/ #include "ixgbe.h" Index: src/sys/dev/pci/ixgbe/ixgbe_fdir.h diff -u src/sys/dev/pci/ixgbe/ixgbe_fdir.h:1.1 src/sys/dev/pci/ixgbe/ixgbe_fdir.h:1.2 --- src/sys/dev/pci/ixgbe/ixgbe_fdir.h:1.1 Wed Aug 30 08:49:18 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_fdir.h Wed Apr 4 08:13:07 2018 @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_fdir.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_fdir.h 327031 2017-12-20 18:15:06Z erj $*/ #ifndef _IXGBE_FDIR_H_ #define _IXGBE_FDIR_H_ Index: src/sys/dev/pci/ixgbe/if_sriov.c diff -u src/sys/dev/pci/ixgbe/if_sriov.c:1.2 src/sys/dev/pci/ixgbe/if_sriov.c:1.3 --- src/sys/dev/pci/ixgbe/if_sriov.c:1.2 Thu Mar 15 06:48:51 2018 +++ src/sys/dev/pci/ixgbe/if_sriov.c Wed Apr 4 08:13:07 2018 @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/if_sriov.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/if_sriov.c 327031 2017-12-20 18:15:06Z erj $*/ #include "ixgbe.h" #include "ixgbe_sriov.h" @@ -90,26 +90,26 @@ ixgbe_align_all_queue_indices(struct ada /* Support functions for SR-IOV/VF management */ static inline void -ixgbe_send_vf_msg(struct ixgbe_hw *hw, struct ixgbe_vf *vf, u32 msg) +ixgbe_send_vf_msg(struct adapter *adapter, struct ixgbe_vf *vf, u32 msg) { if (vf->flags & IXGBE_VF_CTS) msg |= IXGBE_VT_MSGTYPE_CTS; - hw->mbx.ops.write(hw, &msg, 1, vf->pool); + adapter->hw.mbx.ops.write(&adapter->hw, &msg, 1, vf->pool); } static inline void ixgbe_send_vf_ack(struct adapter *adapter, struct ixgbe_vf *vf, u32 msg) { msg &= IXGBE_VT_MSG_MASK; - ixgbe_send_vf_msg(&adapter->hw, vf, msg | IXGBE_VT_MSGTYPE_ACK); + ixgbe_send_vf_msg(adapter, vf, msg | IXGBE_VT_MSGTYPE_ACK); } static inline void ixgbe_send_vf_nack(struct adapter *adapter, struct ixgbe_vf *vf, u32 msg) { msg &= IXGBE_VT_MSG_MASK; - ixgbe_send_vf_msg(&adapter->hw, vf, msg | IXGBE_VT_MSGTYPE_NACK); + ixgbe_send_vf_msg(adapter, vf, msg | IXGBE_VT_MSGTYPE_NACK); } static inline void @@ -205,7 +205,7 @@ ixgbe_ping_all_vfs(struct adapter *adapt for (int i = 0; i < adapter->num_vfs; i++) { vf = &adapter->vfs[i]; if (vf->flags & IXGBE_VF_ACTIVE) - ixgbe_send_vf_msg(&adapter->hw, vf, IXGBE_PF_CONTROL_MSG); + ixgbe_send_vf_msg(adapter, vf, IXGBE_PF_CONTROL_MSG); } } /* ixgbe_ping_all_vfs */ @@ -775,7 +775,7 @@ ixgbe_init_vf(struct adapter *adapter, s ixgbe_vf_enable_transmit(adapter, vf); ixgbe_vf_enable_receive(adapter, vf); - ixgbe_send_vf_msg(&adapter->hw, vf, IXGBE_PF_CONTROL_MSG); + ixgbe_send_vf_msg(adapter, vf, IXGBE_PF_CONTROL_MSG); } /* ixgbe_init_vf */ void Index: src/sys/dev/pci/ixgbe/ixgbe_sriov.h diff -u src/sys/dev/pci/ixgbe/ixgbe_sriov.h:1.2 src/sys/dev/pci/ixgbe/ixgbe_sriov.h:1.3 --- src/sys/dev/pci/ixgbe/ixgbe_sriov.h:1.2 Thu Mar 15 06:48:51 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_sriov.h Wed Apr 4 08:13:07 2018 @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_sriov.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_sriov.h 327031 2017-12-20 18:15:06Z erj $*/ #ifndef _IXGBE_SRIOV_H_ @@ -57,7 +57,7 @@ #define IXGBE_VF_GET_QUEUES_RESP_LEN 5 -#define IXGBE_API_VER_1_0 0 +#define IXGBE_API_VER_1_0 0 #define IXGBE_API_VER_2_0 1 /* Solaris API. Not supported. */ #define IXGBE_API_VER_1_1 2 #define IXGBE_API_VER_UNKNOWN UINT16_MAX Index: src/sys/dev/pci/ixgbe/ix_txrx.c diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.38 src/sys/dev/pci/ixgbe/ix_txrx.c:1.39 --- src/sys/dev/pci/ixgbe/ix_txrx.c:1.38 Mon Apr 2 05:02:55 2018 +++ src/sys/dev/pci/ixgbe/ix_txrx.c Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ix_txrx.c,v 1.38 2018/04/02 05:02:55 knakahara Exp $ */ +/* $NetBSD: ix_txrx.c,v 1.39 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ix_txrx.c 321476 2017-07-25 14:38:30Z sbruno $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ix_txrx.c 327031 2017-12-20 18:15:06Z erj $*/ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.143 src/sys/dev/pci/ixgbe/ixgbe.c:1.144 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.143 Wed Apr 4 06:30:09 2018 +++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.143 2018/04/04 06:30:09 msaitoh Exp $ */ +/* $NetBSD: ixgbe.c,v 1.144 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 320916 2017-07-12 17:35:32Z sbruno $*/ +/*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 327031 2017-12-20 18:15:06Z erj $*/ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -80,7 +80,7 @@ /************************************************************************ * Driver version ************************************************************************/ -char ixgbe_driver_version[] = "3.2.12-k"; +char ixgbe_driver_version[] = "4.0.0-k"; /************************************************************************ @@ -669,7 +669,6 @@ ixgbe_initialize_receive_units(struct ad IXGBE_WRITE_REG(hw, IXGBE_RXCSUM, rxcsum); - return; } /* ixgbe_initialize_receive_units */ /************************************************************************ @@ -680,9 +679,10 @@ ixgbe_initialize_transmit_units(struct a { struct tx_ring *txr = adapter->tx_rings; struct ixgbe_hw *hw = &adapter->hw; + int i; /* Setup the Base and Length of the Tx Descriptor Ring */ - for (int i = 0; i < adapter->num_queues; i++, txr++) { + for (i = 0; i < adapter->num_queues; i++, txr++) { u64 tdba = txr->txdma.dma_paddr; u32 txctrl = 0; int j = txr->me; @@ -827,7 +827,7 @@ ixgbe_attach(device_t parent, device_t d /* * Initialize the shared code */ - if (ixgbe_init_shared_code(hw)) { + if (ixgbe_init_shared_code(hw) != 0) { aprint_error_dev(dev, "Unable to initialize the shared code\n"); error = ENXIO; goto err_out; @@ -1466,23 +1466,23 @@ ixgbe_is_sfp(struct ixgbe_hw *hw) switch (hw->mac.type) { case ixgbe_mac_82598EB: if (hw->phy.type == ixgbe_phy_nl) - return TRUE; - return FALSE; + return (TRUE); + return (FALSE); case ixgbe_mac_82599EB: switch (hw->mac.ops.get_media_type(hw)) { case ixgbe_media_type_fiber: case ixgbe_media_type_fiber_qsfp: - return TRUE; + return (TRUE); default: - return FALSE; + return (FALSE); } case ixgbe_mac_X550EM_x: case ixgbe_mac_X550EM_a: if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) - return TRUE; - return FALSE; + return (TRUE); + return (FALSE); default: - return FALSE; + return (FALSE); } } /* ixgbe_is_sfp */ @@ -1500,16 +1500,14 @@ ixgbe_config_link(struct adapter *adapte if (sfp) { if (hw->phy.multispeed_fiber) { - hw->mac.ops.setup_sfp(hw); ixgbe_enable_tx_laser(hw); kpreempt_disable(); softint_schedule(adapter->msf_si); kpreempt_enable(); - } else { - kpreempt_disable(); - softint_schedule(adapter->mod_si); - kpreempt_enable(); } + kpreempt_disable(); + softint_schedule(adapter->mod_si); + kpreempt_enable(); } else { struct ifmedia *ifm = &adapter->media; @@ -1517,7 +1515,7 @@ ixgbe_config_link(struct adapter *adapte err = ixgbe_check_link(hw, &adapter->link_speed, &adapter->link_up, FALSE); if (err) - goto out; + return; /* * Check if it's the first call. If it's the first call, @@ -1529,14 +1527,12 @@ ixgbe_config_link(struct adapter *adapte err = hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiate); if (err) - goto out; + return; if (hw->mac.ops.setup_link) err = hw->mac.ops.setup_link(hw, autoneg, adapter->link_up); } -out: - return; } /* ixgbe_config_link */ /************************************************************************ @@ -1695,6 +1691,7 @@ ixgbe_add_hw_stats(struct adapter *adapt struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw_stats *stats = &adapter->stats.pf; const char *xname = device_xname(dev); + int i; /* Driver Statistics */ evcnt_attach_dynamic(&adapter->efbig_tx_dma_setup, EVCNT_TYPE_MISC, @@ -1726,7 +1723,7 @@ ixgbe_add_hw_stats(struct adapter *adapt evcnt_attach_dynamic(&adapter->phy_sicount, EVCNT_TYPE_INTR, NULL, xname, "external PHY softint"); - for (int i = 0; i < adapter->num_queues; i++, rxr++, txr++) { + for (i = 0; i < adapter->num_queues; i++, rxr++, txr++) { #ifdef LRO struct lro_ctrl *lro = &rxr->lro; #endif /* LRO */ @@ -2312,7 +2309,6 @@ ixgbe_get_slot_info(struct adapter *adap device_t dev = adapter->dev; struct ixgbe_hw *hw = &adapter->hw; u32 offset; -// struct ixgbe_mac_info *mac = &hw->mac; u16 link; int bus_info_valid = TRUE; @@ -2789,7 +2785,7 @@ ixgbe_media_change(struct ifnet *ifp) return (EINVAL); if (hw->phy.media_type == ixgbe_media_type_backplane) - return (ENODEV); + return (EPERM); /* * We don't actually need to check against the supported @@ -3049,8 +3045,7 @@ ixgbe_eitr_write(struct ix_queue *que, u else itr |= IXGBE_EITR_CNT_WDIS; - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(que->msix), - itr); + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(que->msix), itr); } @@ -3722,7 +3717,7 @@ ixgbe_init_locked(struct adapter *adapte u32 txdctl, mhadd; u32 rxdctl, rxctrl; u32 ctrl_ext; - int err = 0; + int i, j, err; /* XXX check IFF_UP and IFF_RUNNING, power-saving state! */ @@ -3760,7 +3755,9 @@ ixgbe_init_locked(struct adapter *adapte } ixgbe_init_hw(hw); + ixgbe_initialize_iov(adapter); + ixgbe_initialize_transmit_units(adapter); /* Setup Multicast table */ @@ -3795,7 +3792,7 @@ ixgbe_init_locked(struct adapter *adapte } /* Now enable all the queues */ - for (int i = 0; i < adapter->num_queues; i++) { + for (i = 0; i < adapter->num_queues; i++) { txr = &adapter->tx_rings[i]; txdctl = IXGBE_READ_REG(hw, IXGBE_TXDCTL(txr->me)); txdctl |= IXGBE_TXDCTL_ENABLE; @@ -3812,7 +3809,7 @@ ixgbe_init_locked(struct adapter *adapte IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(txr->me), txdctl); } - for (int i = 0, j = 0; i < adapter->num_queues; i++) { + for (i = 0; i < adapter->num_queues; i++) { rxr = &adapter->rx_rings[i]; rxdctl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxr->me)); if (hw->mac.type == ixgbe_mac_82598EB) { @@ -3826,7 +3823,7 @@ ixgbe_init_locked(struct adapter *adapte } rxdctl |= IXGBE_RXDCTL_ENABLE; IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxr->me), rxdctl); - for (; j < 10; j++) { + for (j = 0; j < 10; j++) { if (IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxr->me)) & IXGBE_RXDCTL_ENABLE) break; @@ -3874,7 +3871,7 @@ ixgbe_init_locked(struct adapter *adapte callout_reset(&adapter->timer, hz, ixgbe_local_timer, adapter); - /* Set up MSI-X routing */ + /* Set up MSI/MSI-X routing */ if (adapter->feat_en & IXGBE_FEATURE_MSIX) { ixgbe_configure_ivars(adapter); /* Set up auto-mask */ @@ -3908,6 +3905,9 @@ ixgbe_init_locked(struct adapter *adapte /* Set moderation on the Link interrupt */ IXGBE_WRITE_REG(hw, IXGBE_EITR(adapter->vector), IXGBE_LINK_ITR); + /* Enable power to the phy. */ + ixgbe_set_phy_power(hw, TRUE); + /* Config/Enable Link */ ixgbe_config_link(adapter); @@ -4601,6 +4601,7 @@ ixgbe_update_link_status(struct adapter /* Update DMA coalescing config */ ixgbe_config_dmac(adapter); if_link_state_change(ifp, LINK_STATE_UP); + if (adapter->feat_en & IXGBE_FEATURE_SRIOV) ixgbe_ping_all_vfs(adapter); } @@ -4725,7 +4726,6 @@ ixgbe_enable_intr(struct adapter *adapte IXGBE_WRITE_FLUSH(hw); - return; } /* ixgbe_enable_intr */ /************************************************************************ @@ -4895,8 +4895,6 @@ ixgbe_free_pciintr_resources(struct adap adapter->osdep.nintrs); adapter->osdep.intrs = NULL; } - - return; } /* ixgbe_free_pciintr_resources */ /************************************************************************ @@ -4914,7 +4912,6 @@ ixgbe_free_pci_resources(struct adapter adapter->osdep.mem_size); } - return; } /* ixgbe_free_pci_resources */ /************************************************************************ Index: src/sys/dev/pci/ixgbe/ixgbe.h diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.40 src/sys/dev/pci/ixgbe/ixgbe.h:1.41 --- src/sys/dev/pci/ixgbe/ixgbe.h:1.40 Mon Apr 2 05:02:55 2018 +++ src/sys/dev/pci/ixgbe/ixgbe.h Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.h,v 1.40 2018/04/02 05:02:55 knakahara Exp $ */ +/* $NetBSD: ixgbe.h,v 1.41 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe.h 327031 2017-12-20 18:15:06Z erj $*/ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. Index: src/sys/dev/pci/ixgbe/ixgbe_82598.c diff -u src/sys/dev/pci/ixgbe/ixgbe_82598.c:1.10 src/sys/dev/pci/ixgbe/ixgbe_82598.c:1.11 --- src/sys/dev/pci/ixgbe/ixgbe_82598.c:1.10 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_82598.c Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_82598.c,v 1.10 2017/12/06 04:08:50 msaitoh Exp $ */ +/* $NetBSD: ixgbe_82598.c,v 1.11 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82598.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82598.c 326022 2017-11-20 19:36:21Z pfg $*/ #include "ixgbe_type.h" #include "ixgbe_82598.h" Index: src/sys/dev/pci/ixgbe/ixgbe_phy.h diff -u src/sys/dev/pci/ixgbe/ixgbe_phy.h:1.10 src/sys/dev/pci/ixgbe/ixgbe_phy.h:1.11 --- src/sys/dev/pci/ixgbe/ixgbe_phy.h:1.10 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_phy.h Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_phy.h,v 1.10 2017/12/06 04:08:50 msaitoh Exp $ */ +/* $NetBSD: ixgbe_phy.h,v 1.11 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_phy.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_phy.h 326022 2017-11-20 19:36:21Z pfg $*/ #ifndef _IXGBE_PHY_H_ #define _IXGBE_PHY_H_ Index: src/sys/dev/pci/ixgbe/ixgbe_82598.h diff -u src/sys/dev/pci/ixgbe/ixgbe_82598.h:1.7 src/sys/dev/pci/ixgbe/ixgbe_82598.h:1.8 --- src/sys/dev/pci/ixgbe/ixgbe_82598.h:1.7 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_82598.h Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_82598.h,v 1.7 2017/12/06 04:08:50 msaitoh Exp $ */ +/* $NetBSD: ixgbe_82598.h,v 1.8 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82598.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82598.h 326022 2017-11-20 19:36:21Z pfg $*/ #ifndef _IXGBE_82598_H_ #define _IXGBE_82598_H_ Index: src/sys/dev/pci/ixgbe/ixgbe_x540.h diff -u src/sys/dev/pci/ixgbe/ixgbe_x540.h:1.7 src/sys/dev/pci/ixgbe/ixgbe_x540.h:1.8 --- src/sys/dev/pci/ixgbe/ixgbe_x540.h:1.7 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_x540.h Wed Apr 4 08:13:07 2018 @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_x540.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_x540.h 326022 2017-11-20 19:36:21Z pfg $*/ #ifndef _IXGBE_X540_H_ #define _IXGBE_X540_H_ Index: src/sys/dev/pci/ixgbe/ixgbe_82599.c diff -u src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.17 src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.18 --- src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.17 Fri Mar 30 06:44:30 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_82599.c Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_82599.c,v 1.17 2018/03/30 06:44:30 msaitoh Exp $ */ +/* $NetBSD: ixgbe_82599.c,v 1.18 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82599.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82599.c 326022 2017-11-20 19:36:21Z pfg $*/ #include "ixgbe_type.h" #include "ixgbe_82599.h" Index: src/sys/dev/pci/ixgbe/ixgbe_82599.h diff -u src/sys/dev/pci/ixgbe/ixgbe_82599.h:1.6 src/sys/dev/pci/ixgbe/ixgbe_82599.h:1.7 --- src/sys/dev/pci/ixgbe/ixgbe_82599.h:1.6 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_82599.h Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_82599.h,v 1.6 2017/12/06 04:08:50 msaitoh Exp $ */ +/* $NetBSD: ixgbe_82599.h,v 1.7 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82599.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82599.h 326022 2017-11-20 19:36:21Z pfg $*/ #ifndef _IXGBE_82599_H_ #define _IXGBE_82599_H_ Index: src/sys/dev/pci/ixgbe/ixgbe_dcb.c diff -u src/sys/dev/pci/ixgbe/ixgbe_dcb.c:1.6 src/sys/dev/pci/ixgbe/ixgbe_dcb.c:1.7 --- src/sys/dev/pci/ixgbe/ixgbe_dcb.c:1.6 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_dcb.c Wed Apr 4 08:13:07 2018 @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb.c 326022 2017-11-20 19:36:21Z pfg $*/ #include "ixgbe_type.h" Index: src/sys/dev/pci/ixgbe/ixgbe_api.c diff -u src/sys/dev/pci/ixgbe/ixgbe_api.c:1.18 src/sys/dev/pci/ixgbe/ixgbe_api.c:1.19 --- src/sys/dev/pci/ixgbe/ixgbe_api.c:1.18 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_api.c Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_api.c,v 1.18 2017/12/06 04:08:50 msaitoh Exp $ */ +/* $NetBSD: ixgbe_api.c,v 1.19 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_api.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_api.c 326022 2017-11-20 19:36:21Z pfg $*/ #include "ixgbe_api.h" #include "ixgbe_common.h" Index: src/sys/dev/pci/ixgbe/ixgbe_api.h diff -u src/sys/dev/pci/ixgbe/ixgbe_api.h:1.12 src/sys/dev/pci/ixgbe/ixgbe_api.h:1.13 --- src/sys/dev/pci/ixgbe/ixgbe_api.h:1.12 Fri Mar 30 03:58:20 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_api.h Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_api.h,v 1.12 2018/03/30 03:58:20 knakahara Exp $ */ +/* $NetBSD: ixgbe_api.h,v 1.13 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_api.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_api.h 326022 2017-11-20 19:36:21Z pfg $*/ #ifndef _IXGBE_API_H_ #define _IXGBE_API_H_ Index: src/sys/dev/pci/ixgbe/ixgbe_mbx.h diff -u src/sys/dev/pci/ixgbe/ixgbe_mbx.h:1.12 src/sys/dev/pci/ixgbe/ixgbe_mbx.h:1.13 --- src/sys/dev/pci/ixgbe/ixgbe_mbx.h:1.12 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_mbx.h Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_mbx.h,v 1.12 2017/12/06 04:08:50 msaitoh Exp $ */ +/* $NetBSD: ixgbe_mbx.h,v 1.13 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_mbx.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_mbx.h 326022 2017-11-20 19:36:21Z pfg $*/ #ifndef _IXGBE_MBX_H_ #define _IXGBE_MBX_H_ Index: src/sys/dev/pci/ixgbe/ixgbe_vf.h diff -u src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.12 src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.13 --- src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.12 Thu Mar 15 06:48:51 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_vf.h Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_vf.h,v 1.12 2018/03/15 06:48:51 msaitoh Exp $ */ +/* $NetBSD: ixgbe_vf.h,v 1.13 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_vf.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_vf.h 327031 2017-12-20 18:15:06Z erj $*/ #ifndef _IXGBE_VF_H_ #define _IXGBE_VF_H_ Index: src/sys/dev/pci/ixgbe/ixgbe_common.c diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.20 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.21 --- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.20 Fri Mar 30 06:44:30 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_common.c Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_common.c,v 1.20 2018/03/30 06:44:30 msaitoh Exp $ */ +/* $NetBSD: ixgbe_common.c,v 1.21 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_common.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_common.c 327031 2017-12-20 18:15:06Z erj $*/ #include "ixgbe_common.h" #include "ixgbe_phy.h" Index: src/sys/dev/pci/ixgbe/ixgbe_osdep.h diff -u src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.20 src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.21 --- src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.20 Thu Mar 15 06:48:51 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_osdep.h Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_osdep.h,v 1.20 2018/03/15 06:48:51 msaitoh Exp $ */ +/* $NetBSD: ixgbe_osdep.h,v 1.21 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_osdep.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_osdep.h 327031 2017-12-20 18:15:06Z erj $*/ #ifndef _IXGBE_OSDEP_H_ #define _IXGBE_OSDEP_H_ Index: src/sys/dev/pci/ixgbe/ixgbe_common.h diff -u src/sys/dev/pci/ixgbe/ixgbe_common.h:1.11 src/sys/dev/pci/ixgbe/ixgbe_common.h:1.12 --- src/sys/dev/pci/ixgbe/ixgbe_common.h:1.11 Fri Mar 30 06:44:30 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_common.h Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_common.h,v 1.11 2018/03/30 06:44:30 msaitoh Exp $ */ +/* $NetBSD: ixgbe_common.h,v 1.12 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_common.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_common.h 326022 2017-11-20 19:36:21Z pfg $*/ #ifndef _IXGBE_COMMON_H_ #define _IXGBE_COMMON_H_ Index: src/sys/dev/pci/ixgbe/ixgbe_dcb.h diff -u src/sys/dev/pci/ixgbe/ixgbe_dcb.h:1.5 src/sys/dev/pci/ixgbe/ixgbe_dcb.h:1.6 --- src/sys/dev/pci/ixgbe/ixgbe_dcb.h:1.5 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_dcb.h Wed Apr 4 08:13:07 2018 @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb.h 326022 2017-11-20 19:36:21Z pfg $*/ #ifndef _IXGBE_DCB_H_ #define _IXGBE_DCB_H_ Index: src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c diff -u src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c:1.5 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c:1.6 --- src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c:1.5 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c Wed Apr 4 08:13:07 2018 @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb_82598.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb_82598.c 326022 2017-11-20 19:36:21Z pfg $*/ #include "ixgbe_type.h" Index: src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.h diff -u src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.h:1.5 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.h:1.6 --- src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.h:1.5 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.h Wed Apr 4 08:13:07 2018 @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb_82598.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb_82598.h 326022 2017-11-20 19:36:21Z pfg $*/ #ifndef _IXGBE_DCB_82598_H_ #define _IXGBE_DCB_82598_H_ Index: src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.c diff -u src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.c:1.5 src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.c:1.6 --- src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.c:1.5 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.c Wed Apr 4 08:13:07 2018 @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb_82599.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb_82599.c 326022 2017-11-20 19:36:21Z pfg $*/ #include "ixgbe_type.h" Index: src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h diff -u src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h:1.5 src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h:1.6 --- src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h:1.5 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h Wed Apr 4 08:13:07 2018 @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb_82599.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb_82599.h 326022 2017-11-20 19:36:21Z pfg $*/ #ifndef _IXGBE_DCB_82599_H_ #define _IXGBE_DCB_82599_H_ Index: src/sys/dev/pci/ixgbe/ixgbe_mbx.c diff -u src/sys/dev/pci/ixgbe/ixgbe_mbx.c:1.9 src/sys/dev/pci/ixgbe/ixgbe_mbx.c:1.10 --- src/sys/dev/pci/ixgbe/ixgbe_mbx.c:1.9 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_mbx.c Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_mbx.c,v 1.9 2017/12/06 04:08:50 msaitoh Exp $ */ +/* $NetBSD: ixgbe_mbx.c,v 1.10 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_mbx.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_mbx.c 326022 2017-11-20 19:36:21Z pfg $*/ #include "ixgbe_type.h" #include "ixgbe_mbx.h" Index: src/sys/dev/pci/ixgbe/ixgbe_phy.c diff -u src/sys/dev/pci/ixgbe/ixgbe_phy.c:1.15 src/sys/dev/pci/ixgbe/ixgbe_phy.c:1.16 --- src/sys/dev/pci/ixgbe/ixgbe_phy.c:1.15 Thu Mar 15 06:48:51 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_phy.c Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_phy.c,v 1.15 2018/03/15 06:48:51 msaitoh Exp $ */ +/* $NetBSD: ixgbe_phy.c,v 1.16 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_phy.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_phy.c 327031 2017-12-20 18:15:06Z erj $*/ #include "ixgbe_api.h" #include "ixgbe_common.h" Index: src/sys/dev/pci/ixgbe/ixgbe_vf.c diff -u src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.15 src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.16 --- src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.15 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_vf.c Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_vf.c,v 1.15 2017/12/06 04:08:50 msaitoh Exp $ */ +/* $NetBSD: ixgbe_vf.c,v 1.16 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_vf.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_vf.c 326022 2017-11-20 19:36:21Z pfg $*/ #include "ixgbe_api.h" Index: src/sys/dev/pci/ixgbe/ixgbe_type.h diff -u src/sys/dev/pci/ixgbe/ixgbe_type.h:1.32 src/sys/dev/pci/ixgbe/ixgbe_type.h:1.33 --- src/sys/dev/pci/ixgbe/ixgbe_type.h:1.32 Thu Mar 15 06:48:51 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_type.h Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_type.h,v 1.32 2018/03/15 06:48:51 msaitoh Exp $ */ +/* $NetBSD: ixgbe_type.h,v 1.33 2018/04/04 08:13:07 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_type.h 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_type.h 327031 2017-12-20 18:15:06Z erj $*/ #ifndef _IXGBE_TYPE_H_ #define _IXGBE_TYPE_H_ Index: src/sys/dev/pci/ixgbe/ixgbe_x540.c diff -u src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.13 src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.14 --- src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.13 Thu Mar 15 06:48:51 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_x540.c Wed Apr 4 08:13:07 2018 @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_x540.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_x540.c 326022 2017-11-20 19:36:21Z pfg $*/ #include "ixgbe_x540.h" #include "ixgbe_type.h" Index: src/sys/dev/pci/ixgbe/ixv.c diff -u src/sys/dev/pci/ixgbe/ixv.c:1.90 src/sys/dev/pci/ixgbe/ixv.c:1.91 --- src/sys/dev/pci/ixgbe/ixv.c:1.90 Fri Mar 30 03:58:20 2018 +++ src/sys/dev/pci/ixgbe/ixv.c Wed Apr 4 08:13:07 2018 @@ -1,4 +1,4 @@ -/*$NetBSD: ixv.c,v 1.90 2018/03/30 03:58:20 knakahara Exp $*/ +/*$NetBSD: ixv.c,v 1.91 2018/04/04 08:13:07 msaitoh Exp $*/ /****************************************************************************** @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ -/*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 320688 2017-07-05 17:27:03Z erj $*/ +/*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 328265 2018-01-22 20:56:21Z erj $*/ #ifdef _KERNEL_OPT @@ -734,7 +734,7 @@ ixv_init_locked(struct adapter *adapter) hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); /* Get the latest mac address, User can use a LAA */ - memcpy(hw->mac.addr, CLLADDR(adapter->ifp->if_sadl), + memcpy(hw->mac.addr, CLLADDR(ifp->if_sadl), IXGBE_ETH_LENGTH_OF_ADDRESS); hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, 1); @@ -879,7 +879,7 @@ ixv_rearm_queues(struct adapter *adapter /************************************************************************ - * ixv_msix_que - MSI Queue Interrupt Service routine + * ixv_msix_que - MSI-X Queue Interrupt Service routine ************************************************************************/ static int ixv_msix_que(void *arg) @@ -1570,38 +1570,39 @@ ixv_initialize_transmit_units(struct ada { struct tx_ring *txr = adapter->tx_rings; struct ixgbe_hw *hw = &adapter->hw; + int i; - - for (int i = 0; i < adapter->num_queues; i++, txr++) { + for (i = 0; i < adapter->num_queues; i++, txr++) { u64 tdba = txr->txdma.dma_paddr; u32 txctrl, txdctl; + int j = txr->me; /* Set WTHRESH to 8, burst writeback */ - txdctl = IXGBE_READ_REG(hw, IXGBE_VFTXDCTL(i)); + txdctl = IXGBE_READ_REG(hw, IXGBE_VFTXDCTL(j)); txdctl |= (8 << 16); - IXGBE_WRITE_REG(hw, IXGBE_VFTXDCTL(i), txdctl); + IXGBE_WRITE_REG(hw, IXGBE_VFTXDCTL(j), txdctl); /* Set the HW Tx Head and Tail indices */ - IXGBE_WRITE_REG(&adapter->hw, IXGBE_VFTDH(i), 0); - IXGBE_WRITE_REG(&adapter->hw, IXGBE_VFTDT(i), 0); + IXGBE_WRITE_REG(&adapter->hw, IXGBE_VFTDH(j), 0); + IXGBE_WRITE_REG(&adapter->hw, IXGBE_VFTDT(j), 0); /* Set Tx Tail register */ - txr->tail = IXGBE_VFTDT(i); + txr->tail = IXGBE_VFTDT(j); /* Set Ring parameters */ - IXGBE_WRITE_REG(hw, IXGBE_VFTDBAL(i), + IXGBE_WRITE_REG(hw, IXGBE_VFTDBAL(j), (tdba & 0x00000000ffffffffULL)); - IXGBE_WRITE_REG(hw, IXGBE_VFTDBAH(i), (tdba >> 32)); - IXGBE_WRITE_REG(hw, IXGBE_VFTDLEN(i), + IXGBE_WRITE_REG(hw, IXGBE_VFTDBAH(j), (tdba >> 32)); + IXGBE_WRITE_REG(hw, IXGBE_VFTDLEN(j), adapter->num_tx_desc * sizeof(struct ixgbe_legacy_tx_desc)); - txctrl = IXGBE_READ_REG(hw, IXGBE_VFDCA_TXCTRL(i)); + txctrl = IXGBE_READ_REG(hw, IXGBE_VFDCA_TXCTRL(j)); txctrl &= ~IXGBE_DCA_TXCTRL_DESC_WRO_EN; - IXGBE_WRITE_REG(hw, IXGBE_VFDCA_TXCTRL(i), txctrl); + IXGBE_WRITE_REG(hw, IXGBE_VFDCA_TXCTRL(j), txctrl); /* Now enable */ - txdctl = IXGBE_READ_REG(hw, IXGBE_VFTXDCTL(i)); + txdctl = IXGBE_READ_REG(hw, IXGBE_VFTXDCTL(j)); txdctl |= IXGBE_TXDCTL_ENABLE; - IXGBE_WRITE_REG(hw, IXGBE_VFTXDCTL(i), txdctl); + IXGBE_WRITE_REG(hw, IXGBE_VFTXDCTL(j), txdctl); } return; @@ -1741,13 +1742,14 @@ ixv_initialize_receive_units(struct adap for (int i = 0; i < adapter->num_queues; i++, rxr++) { u64 rdba = rxr->rxdma.dma_paddr; u32 reg, rxdctl; + int j = rxr->me; /* Disable the queue */ - rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i)); + rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(j)); rxdctl &= ~IXGBE_RXDCTL_ENABLE; - IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), rxdctl); - for (int j = 0; j < 10; j++) { - if (IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i)) & + IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(j), rxdctl); + for (int k = 0; k < 10; k++) { + if (IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(j)) & IXGBE_RXDCTL_ENABLE) msec_delay(1); else @@ -1755,10 +1757,10 @@ ixv_initialize_receive_units(struct adap } wmb(); /* Setup the Base and Length of the Rx Descriptor Ring */ - IXGBE_WRITE_REG(hw, IXGBE_VFRDBAL(i), + IXGBE_WRITE_REG(hw, IXGBE_VFRDBAL(j), (rdba & 0x00000000ffffffffULL)); - IXGBE_WRITE_REG(hw, IXGBE_VFRDBAH(i), (rdba >> 32)); - IXGBE_WRITE_REG(hw, IXGBE_VFRDLEN(i), + IXGBE_WRITE_REG(hw, IXGBE_VFRDBAH(j), (rdba >> 32)); + IXGBE_WRITE_REG(hw, IXGBE_VFRDLEN(j), adapter->num_rx_desc * sizeof(union ixgbe_adv_rx_desc)); /* Reset the ring indices */ @@ -1766,21 +1768,21 @@ ixv_initialize_receive_units(struct adap IXGBE_WRITE_REG(hw, IXGBE_VFRDT(rxr->me), 0); /* Set up the SRRCTL register */ - reg = IXGBE_READ_REG(hw, IXGBE_VFSRRCTL(i)); + reg = IXGBE_READ_REG(hw, IXGBE_VFSRRCTL(j)); reg &= ~IXGBE_SRRCTL_BSIZEHDR_MASK; reg &= ~IXGBE_SRRCTL_BSIZEPKT_MASK; reg |= bufsz; reg |= IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF; - IXGBE_WRITE_REG(hw, IXGBE_VFSRRCTL(i), reg); + IXGBE_WRITE_REG(hw, IXGBE_VFSRRCTL(j), reg); /* Capture Rx Tail index */ rxr->tail = IXGBE_VFRDT(rxr->me); /* Do the queue enabling last */ rxdctl |= IXGBE_RXDCTL_ENABLE | IXGBE_RXDCTL_VME; - IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), rxdctl); + IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(j), rxdctl); for (int k = 0; k < 10; k++) { - if (IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i)) & + if (IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(j)) & IXGBE_RXDCTL_ENABLE) break; msec_delay(1);