Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci/ixgbe Update ixg(4) and ixv(4) up to FreeBSD r29...
details: https://anonhg.NetBSD.org/src/rev/745cde273eed
branches: trunk
changeset: 349258:745cde273eed
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Fri Dec 02 12:14:37 2016 +0000
description:
Update ixg(4) and ixv(4) up to FreeBSD r294578:
- Fixup SFP module insertion on the 82599 when insertion happens after
the system is booted and running. Add PHY detection logic to
ixgbe_handle_mod() and add locking to ixgbe_handle_msf() as well.
FreeBSD r293334.
- Fix ix advertise value after media change. When ifconfig sets media then the
values displayed by the advertise_speed value are invalidated.
Fix this by setting the bits correctly including setting advertise to 0 for
media = auto. FreeBSD r294578.
- Some others (e.g. LRO(not used by NetBSD)).
diffstat:
sys/dev/pci/ixgbe/ix_txrx.c | 8 +++-
sys/dev/pci/ixgbe/ixgbe.c | 81 +++++++++++++++++++++++++++++++++-----------
sys/dev/pci/ixgbe/ixv.c | 15 +++----
3 files changed, 74 insertions(+), 30 deletions(-)
diffs (225 lines):
diff -r 3e915360923d -r 745cde273eed sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c Fri Dec 02 11:56:55 2016 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c Fri Dec 02 12:14:37 2016 +0000
@@ -58,8 +58,8 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-/*$FreeBSD: head/sys/dev/ixgbe/ix_txrx.c 292674 2015-12-23 22:45:17Z sbruno $*/
-/*$NetBSD: ix_txrx.c,v 1.8 2016/12/02 10:42:04 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/ix_txrx.c 292751 2015-12-26 17:27:48Z bz $*/
+/*$NetBSD: ix_txrx.c,v 1.9 2016/12/02 12:14:37 msaitoh Exp $*/
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -821,6 +821,7 @@
l3d = mtod(mp, char *) + ehdrlen;
switch (etype) {
+#ifdef INET
case ETHERTYPE_IP:
ip = (struct ip *)(l3d);
ip_hlen = ip->ip_hl << 2;
@@ -829,12 +830,15 @@
KASSERT((mp->m_pkthdr.csum_flags & M_CSUM_IPv4) == 0 ||
ip->ip_sum == 0);
break;
+#endif
+#ifdef INET6
case ETHERTYPE_IPV6:
ip6 = (struct ip6_hdr *)(l3d);
ip_hlen = sizeof(struct ip6_hdr);
ipproto = ip6->ip6_nxt;
type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV6;
break;
+#endif
default:
break;
}
diff -r 3e915360923d -r 745cde273eed sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Fri Dec 02 11:56:55 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Fri Dec 02 12:14:37 2016 +0000
@@ -58,8 +58,8 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-/*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 292674 2015-12-23 22:45:17Z sbruno $*/
-/*$NetBSD: ixgbe.c,v 1.50 2016/12/02 11:56:55 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 294578 2016-01-22 17:03:32Z smh $*/
+/*$NetBSD: ixgbe.c,v 1.51 2016/12/02 12:14:37 msaitoh Exp $*/
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -2033,10 +2033,16 @@
hw->mac.autotry_restart = TRUE;
hw->mac.ops.setup_link(hw, speed, TRUE);
- adapter->advertise =
- ((speed & IXGBE_LINK_SPEED_10GB_FULL) << 2) |
- ((speed & IXGBE_LINK_SPEED_1GB_FULL) << 1) |
- ((speed & IXGBE_LINK_SPEED_100_FULL) << 0);
+ if (IFM_SUBTYPE(ifm->ifm_media) == IFM_AUTO) {
+ adapter->advertise = 0;
+ } else {
+ if ((speed & IXGBE_LINK_SPEED_10GB_FULL) != 0)
+ adapter->advertise |= 1 << 2;
+ if ((speed & IXGBE_LINK_SPEED_1GB_FULL) != 0)
+ adapter->advertise |= 1 << 1;
+ if ((speed & IXGBE_LINK_SPEED_100_FULL) != 0)
+ adapter->advertise |= 1 << 0;
+ }
return (0);
@@ -3066,18 +3072,8 @@
sfp = ixgbe_is_sfp(hw);
if (sfp) {
- void *ip;
-
- if (hw->phy.multispeed_fiber) {
- hw->mac.ops.setup_sfp(hw);
- ixgbe_enable_tx_laser(hw);
- ip = adapter->msf_si;
- } else {
- ip = adapter->mod_si;
- }
-
kpreempt_disable();
- softint_schedule(ip);
+ softint_schedule(adapter->mod_si);
kpreempt_enable();
} else {
if (hw->mac.ops.check_link)
@@ -3885,23 +3881,66 @@
{
struct adapter *adapter = context;
struct ixgbe_hw *hw = &adapter->hw;
+ enum ixgbe_phy_type orig_type = hw->phy.type;
device_t dev = adapter->dev;
u32 err;
+ IXGBE_CORE_LOCK(adapter);
+
+ /* Check to see if the PHY type changed */
+ if (hw->phy.ops.identify) {
+ hw->phy.type = ixgbe_phy_unknown;
+ hw->phy.ops.identify(hw);
+ }
+
+ if (hw->phy.type != orig_type) {
+ device_printf(dev, "Detected phy_type %d\n", hw->phy.type);
+
+ if (hw->phy.type == ixgbe_phy_none) {
+ hw->phy.sfp_type = ixgbe_sfp_type_unknown;
+ goto out;
+ }
+
+ /* Try to do the initialization that was skipped before */
+ if (hw->phy.ops.init)
+ hw->phy.ops.init(hw);
+ if (hw->phy.ops.reset)
+ hw->phy.ops.reset(hw);
+ }
+
err = hw->phy.ops.identify_sfp(hw);
if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
device_printf(dev,
"Unsupported SFP+ module type was detected.\n");
- return;
+ goto out;
}
err = hw->mac.ops.setup_sfp(hw);
if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
device_printf(dev,
"Setup failure - unsupported SFP+ module type.\n");
- return;
+ goto out;
}
- softint_schedule(adapter->msf_si);
+ if (hw->phy.multispeed_fiber)
+ softint_schedule(adapter->msf_si);
+out:
+ /* Update media type */
+ switch (hw->mac.ops.get_media_type(hw)) {
+ case ixgbe_media_type_fiber:
+ adapter->optics = IFM_10G_SR;
+ break;
+ case ixgbe_media_type_copper:
+ adapter->optics = IFM_10G_TWINAX;
+ break;
+ case ixgbe_media_type_cx4:
+ adapter->optics = IFM_10G_CX4;
+ break;
+ default:
+ adapter->optics = 0;
+ break;
+ }
+
+ IXGBE_CORE_UNLOCK(adapter);
return;
}
@@ -3917,6 +3956,7 @@
u32 autoneg;
bool negotiate;
+ IXGBE_CORE_LOCK(adapter);
/* get_supported_phy_layer will call hw->phy.ops.identify_sfp() */
adapter->phy_layer = ixgbe_get_supported_physical_layer(hw);
@@ -3931,6 +3971,7 @@
/* Adjust media types shown in ifconfig */
ifmedia_removeall(&adapter->media);
ixgbe_add_media_types(adapter);
+ IXGBE_CORE_UNLOCK(adapter);
return;
}
diff -r 3e915360923d -r 745cde273eed sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c Fri Dec 02 11:56:55 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c Fri Dec 02 12:14:37 2016 +0000
@@ -31,7 +31,7 @@
******************************************************************************/
/*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 292674 2015-12-23 22:45:17Z sbruno $*/
-/*$NetBSD: ixv.c,v 1.27 2016/12/02 11:56:55 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.28 2016/12/02 12:14:37 msaitoh Exp $*/
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -1744,7 +1744,7 @@
/* Disable the queue */
rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i));
- rxdctl &= ~(IXGBE_RXDCTL_ENABLE | IXGBE_RXDCTL_VME);
+ 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)) &
@@ -1778,8 +1778,7 @@
rxr->tail = IXGBE_VFRDT(rxr->me);
/* Do the queue enabling last */
- rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i));
- rxdctl |= IXGBE_RXDCTL_ENABLE;
+ rxdctl |= IXGBE_RXDCTL_ENABLE | IXGBE_RXDCTL_VME;
IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), rxdctl);
for (int k = 0; k < 10; k++) {
if (IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i)) &
@@ -2236,10 +2235,10 @@
device_printf(dev,"RX(%d) Bytes Received: %lu\n",
rxr->me, (long)rxr->rx_bytes.ev_count);
#ifdef LRO
- device_printf(dev,"RX(%d) LRO Queued= %d\n",
- rxr->me, lro->lro_queued);
- device_printf(dev,"RX(%d) LRO Flushed= %d\n",
- rxr->me, lro->lro_flushed);
+ device_printf(dev,"RX(%d) LRO Queued= %lld\n",
+ rxr->me, (long long)lro->lro_queued);
+ device_printf(dev,"RX(%d) LRO Flushed= %lld\n",
+ rxr->me, (long long)lro->lro_flushed);
#endif /* LRO */
device_printf(dev,"TX(%d) Packets Sent: %lu\n",
txr->me, (long)txr->total_packets.ev_count);
Home |
Main Index |
Thread Index |
Old Index