Mon Jan 30 09:33:38 2017 UTC ()
fix endianness of "rsshash"(currently, used for debug message only) and tabify.


(knakahara)
diff -r1.470 -r1.471 src/sys/dev/pci/if_wm.c

cvs diff -r1.470 -r1.471 src/sys/dev/pci/if_wm.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_wm.c 2017/01/27 05:04:47 1.470
+++ src/sys/dev/pci/if_wm.c 2017/01/30 09:33:38 1.471
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_wm.c,v 1.470 2017/01/27 05:04:47 knakahara Exp $ */ 1/* $NetBSD: if_wm.c,v 1.471 2017/01/30 09:33:38 knakahara Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. 4 * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -74,27 +74,27 @@ @@ -74,27 +74,27 @@
74 * 74 *
75 * - Check XXX'ed comments 75 * - Check XXX'ed comments
76 * - Disable D0 LPLU on 8257[12356], 82580 and I350. 76 * - Disable D0 LPLU on 8257[12356], 82580 and I350.
77 * - TX Multi queue improvement (refine queue selection logic) 77 * - TX Multi queue improvement (refine queue selection logic)
78 * - Split header buffer for newer descriptors 78 * - Split header buffer for newer descriptors
79 * - EEE (Energy Efficiency Ethernet) 79 * - EEE (Energy Efficiency Ethernet)
80 * - Virtual Function 80 * - Virtual Function
81 * - Set LED correctly (based on contents in EEPROM) 81 * - Set LED correctly (based on contents in EEPROM)
82 * - Rework how parameters are loaded from the EEPROM. 82 * - Rework how parameters are loaded from the EEPROM.
83 * - Image Unique ID 83 * - Image Unique ID
84 */ 84 */
85 85
86#include <sys/cdefs.h> 86#include <sys/cdefs.h>
87__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.470 2017/01/27 05:04:47 knakahara Exp $"); 87__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.471 2017/01/30 09:33:38 knakahara Exp $");
88 88
89#ifdef _KERNEL_OPT 89#ifdef _KERNEL_OPT
90#include "opt_net_mpsafe.h" 90#include "opt_net_mpsafe.h"
91#endif 91#endif
92 92
93#include <sys/param.h> 93#include <sys/param.h>
94#include <sys/systm.h> 94#include <sys/systm.h>
95#include <sys/callout.h> 95#include <sys/callout.h>
96#include <sys/mbuf.h> 96#include <sys/mbuf.h>
97#include <sys/malloc.h> 97#include <sys/malloc.h>
98#include <sys/kmem.h> 98#include <sys/kmem.h>
99#include <sys/kernel.h> 99#include <sys/kernel.h>
100#include <sys/socket.h> 100#include <sys/socket.h>
@@ -7716,27 +7716,27 @@ wm_rxeof(struct wm_rxqueue *rxq) @@ -7716,27 +7716,27 @@ wm_rxeof(struct wm_rxqueue *rxq)
7716 for (i = rxq->rxq_ptr;; i = WM_NEXTRX(i)) { 7716 for (i = rxq->rxq_ptr;; i = WM_NEXTRX(i)) {
7717 rxs = &rxq->rxq_soft[i]; 7717 rxs = &rxq->rxq_soft[i];
7718 7718
7719 DPRINTF(WM_DEBUG_RX, 7719 DPRINTF(WM_DEBUG_RX,
7720 ("%s: RX: checking descriptor %d\n", 7720 ("%s: RX: checking descriptor %d\n",
7721 device_xname(sc->sc_dev), i)); 7721 device_xname(sc->sc_dev), i));
7722 wm_cdrxsync(rxq, i,BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); 7722 wm_cdrxsync(rxq, i,BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
7723 7723
7724 status = wm_rxdesc_get_status(rxq, i); 7724 status = wm_rxdesc_get_status(rxq, i);
7725 errors = wm_rxdesc_get_errors(rxq, i); 7725 errors = wm_rxdesc_get_errors(rxq, i);
7726 len = le16toh(wm_rxdesc_get_pktlen(rxq, i)); 7726 len = le16toh(wm_rxdesc_get_pktlen(rxq, i));
7727 vlantag = wm_rxdesc_get_vlantag(rxq, i); 7727 vlantag = wm_rxdesc_get_vlantag(rxq, i);
7728#ifdef WM_DEBUG 7728#ifdef WM_DEBUG
7729 uint32_t rsshash = wm_rxdesc_get_rsshash(rxq, i); 7729 uint32_t rsshash = le32toh(wm_rxdesc_get_rsshash(rxq, i));
7730 uint8_t rsstype = wm_rxdesc_get_rsstype(rxq, i); 7730 uint8_t rsstype = wm_rxdesc_get_rsstype(rxq, i);
7731#endif 7731#endif
7732 7732
7733 if (!wm_rxdesc_dd(rxq, i, status)) 7733 if (!wm_rxdesc_dd(rxq, i, status))
7734 break; 7734 break;
7735 7735
7736 count++; 7736 count++;
7737 if (__predict_false(rxq->rxq_discard)) { 7737 if (__predict_false(rxq->rxq_discard)) {
7738 DPRINTF(WM_DEBUG_RX, 7738 DPRINTF(WM_DEBUG_RX,
7739 ("%s: RX: discarding contents of descriptor %d\n", 7739 ("%s: RX: discarding contents of descriptor %d\n",
7740 device_xname(sc->sc_dev), i)); 7740 device_xname(sc->sc_dev), i));
7741 wm_init_rxdesc(rxq, i); 7741 wm_init_rxdesc(rxq, i);
7742 if (wm_rxdesc_is_eop(rxq, status)) { 7742 if (wm_rxdesc_is_eop(rxq, status)) {
@@ -7828,33 +7828,33 @@ wm_rxeof(struct wm_rxqueue *rxq) @@ -7828,33 +7828,33 @@ wm_rxeof(struct wm_rxqueue *rxq)
7828 DPRINTF(WM_DEBUG_RX, 7828 DPRINTF(WM_DEBUG_RX,
7829 ("%s: RX: have entire packet, len -> %d\n", 7829 ("%s: RX: have entire packet, len -> %d\n",
7830 device_xname(sc->sc_dev), len)); 7830 device_xname(sc->sc_dev), len));
7831 7831
7832 /* If an error occurred, update stats and drop the packet. */ 7832 /* If an error occurred, update stats and drop the packet. */
7833 if (wm_rxdesc_has_errors(rxq, errors)) { 7833 if (wm_rxdesc_has_errors(rxq, errors)) {
7834 m_freem(m); 7834 m_freem(m);
7835 continue; 7835 continue;
7836 } 7836 }
7837 7837
7838 /* No errors. Receive the packet. */ 7838 /* No errors. Receive the packet. */
7839 m_set_rcvif(m, ifp); 7839 m_set_rcvif(m, ifp);
7840 m->m_pkthdr.len = len; 7840 m->m_pkthdr.len = len;
7841 /* 7841 /*
7842 * TODO 7842 * TODO
7843 * should be save rsshash and rsstype to this mbuf. 7843 * should be save rsshash and rsstype to this mbuf.
7844 */ 7844 */
7845 DPRINTF(WM_DEBUG_RX, 7845 DPRINTF(WM_DEBUG_RX,
7846 ("%s: RX: RSS type=%" PRIu8 ", RSS hash=%" PRIu32 "\n", 7846 ("%s: RX: RSS type=%" PRIu8 ", RSS hash=%" PRIu32 "\n",
7847 device_xname(sc->sc_dev), rsstype, rsshash)); 7847 device_xname(sc->sc_dev), rsstype, rsshash));
7848 7848
7849 /* 7849 /*
7850 * If VLANs are enabled, VLAN packets have been unwrapped 7850 * If VLANs are enabled, VLAN packets have been unwrapped
7851 * for us. Associate the tag with the packet. 7851 * for us. Associate the tag with the packet.
7852 */ 7852 */
7853 /* XXXX should check for i350 and i354 */ 7853 /* XXXX should check for i350 and i354 */
7854 if (!wm_rxdesc_input_vlantag(rxq, status, vlantag, m)) 7854 if (!wm_rxdesc_input_vlantag(rxq, status, vlantag, m))
7855 continue; 7855 continue;
7856 7856
7857 /* Set up checksum info for this packet. */ 7857 /* Set up checksum info for this packet. */
7858 wm_rxdesc_ensure_checksum(rxq, status, errors, m); 7858 wm_rxdesc_ensure_checksum(rxq, status, errors, m);
7859 7859
7860 mutex_exit(rxq->rxq_lock); 7860 mutex_exit(rxq->rxq_lock);