aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid C Somayajulu <davidcs@FreeBSD.org>2016-04-06 21:45:31 +0000
committerDavid C Somayajulu <davidcs@FreeBSD.org>2016-04-06 21:45:31 +0000
commit44493b0813c61d05da59558bfb33d33a7f0b7936 (patch)
tree691e29f7e7b9f03410d961549611bea9d732ca27
parent2ea2edffe11e4bfcfb5023bc3f298736c3376c37 (diff)
downloadsrc-44493b0813c61d05da59558bfb33d33a7f0b7936.tar.gz
src-44493b0813c61d05da59558bfb33d33a7f0b7936.zip
MFC r297155
Modifications to achieve a common source base from FreeBSD7.x thru 10.x
Notes
Notes: svn path=/stable/8/; revision=297624
-rw-r--r--sys/dev/bxe/bxe.c79
-rw-r--r--sys/dev/bxe/bxe.h11
2 files changed, 68 insertions, 22 deletions
diff --git a/sys/dev/bxe/bxe.c b/sys/dev/bxe/bxe.c
index d0f734367f9d..fb425cdaecb6 100644
--- a/sys/dev/bxe/bxe.c
+++ b/sys/dev/bxe/bxe.c
@@ -3074,7 +3074,7 @@ bxe_tpa_stop(struct bxe_softc *sc,
#if __FreeBSD_version >= 800000
/* specify what RSS queue was used for this flow */
m->m_pkthdr.flowid = fp->index;
- m->m_flags |= M_FLOWID;
+ BXE_SET_FLOWID(m);
#endif
ifp->if_ipackets++;
@@ -3363,7 +3363,7 @@ bxe_rxeof(struct bxe_softc *sc,
#if __FreeBSD_version >= 800000
/* specify what RSS queue was used for this flow */
m->m_pkthdr.flowid = fp->index;
- m->m_flags |= M_FLOWID;
+ BXE_SET_FLOWID(m);
#endif
next_rx:
@@ -4835,6 +4835,19 @@ bxe_dump_mbuf(struct bxe_softc *sc,
}
while (m) {
+
+#if __FreeBSD_version >= 1000000
+ BLOGD(sc, DBG_MBUF,
+ "%02d: mbuf=%p m_len=%d m_flags=0x%b m_data=%p\n",
+ i, m, m->m_len, m->m_flags, M_FLAG_BITS, m->m_data);
+
+ if (m->m_flags & M_PKTHDR) {
+ BLOGD(sc, DBG_MBUF,
+ "%02d: - m_pkthdr: tot_len=%d flags=0x%b csum_flags=%b\n",
+ i, m->m_pkthdr.len, m->m_flags, M_FLAG_BITS,
+ (int)m->m_pkthdr.csum_flags, CSUM_BITS);
+ }
+#else
BLOGD(sc, DBG_MBUF,
"%02d: mbuf=%p m_len=%d m_flags=0x%b m_data=%p\n",
i, m, m->m_len, m->m_flags,
@@ -4853,6 +4866,7 @@ bxe_dump_mbuf(struct bxe_softc *sc,
"\12CSUM_IP_VALID\13CSUM_DATA_VALID"
"\14CSUM_PSEUDO_HDR");
}
+#endif /* #if __FreeBSD_version >= 1000000 */
if (m->m_flags & M_EXT) {
switch (m->m_ext.ext_type) {
@@ -5236,7 +5250,9 @@ bxe_tx_encap(struct bxe_fastpath *fp, struct mbuf **m_head)
sc = fp->sc;
+#if __FreeBSD_version >= 800000
M_ASSERTPKTHDR(*m_head);
+#endif /* #if __FreeBSD_version >= 800000 */
m0 = *m_head;
rc = defragged = nbds = ovlan = vlan_off = total_pkt_size = 0;
@@ -5850,10 +5866,10 @@ bxe_tx_mq_start(struct ifnet *ifp,
fp_index = 0; /* default is the first queue */
- /* change the queue if using flow ID */
- if ((m->m_flags & M_FLOWID) != 0) {
+ /* check if flowid is set */
+
+ if (BXE_VALID_FLOWID(m))
fp_index = (m->m_pkthdr.flowid % sc->num_queues);
- }
fp = &sc->fp[fp_index];
@@ -15718,18 +15734,11 @@ bxe_add_sysctls(struct bxe_softc *sc)
CTLFLAG_RD, BXE_DRIVER_VERSION, 0,
"version");
- SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version",
- CTLFLAG_RD, &sc->devinfo.bc_ver_str, 0,
- "bootcode version");
-
snprintf(sc->fw_ver_str, sizeof(sc->fw_ver_str), "%d.%d.%d.%d",
BCM_5710_FW_MAJOR_VERSION,
BCM_5710_FW_MINOR_VERSION,
BCM_5710_FW_REVISION_VERSION,
BCM_5710_FW_ENGINEERING_VERSION);
- SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version",
- CTLFLAG_RD, &sc->fw_ver_str, 0,
- "firmware version");
snprintf(sc->mf_mode_str, sizeof(sc->mf_mode_str), "%s",
((sc->devinfo.mf_info.mf_mode == SINGLE_FUNCTION) ? "Single" :
@@ -15737,32 +15746,58 @@ bxe_add_sysctls(struct bxe_softc *sc)
(sc->devinfo.mf_info.mf_mode == MULTI_FUNCTION_SI) ? "MF-SI" :
(sc->devinfo.mf_info.mf_mode == MULTI_FUNCTION_AFEX) ? "MF-AFEX" :
"Unknown"));
- SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode",
- CTLFLAG_RD, &sc->mf_mode_str, 0,
- "multifunction mode");
-
SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "mf_vnics",
CTLFLAG_RD, &sc->devinfo.mf_info.vnics_per_port, 0,
"multifunction vnics per port");
- SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr",
- CTLFLAG_RD, &sc->mac_addr_str, 0,
- "mac address");
-
snprintf(sc->pci_link_str, sizeof(sc->pci_link_str), "%s x%d",
((sc->devinfo.pcie_link_speed == 1) ? "2.5GT/s" :
(sc->devinfo.pcie_link_speed == 2) ? "5.0GT/s" :
(sc->devinfo.pcie_link_speed == 4) ? "8.0GT/s" :
"???GT/s"),
sc->devinfo.pcie_link_width);
+
+ sc->debug = bxe_debug;
+
+#if __FreeBSD_version >= 900000
+ SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version",
+ CTLFLAG_RD, sc->devinfo.bc_ver_str, 0,
+ "bootcode version");
+ SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version",
+ CTLFLAG_RD, sc->fw_ver_str, 0,
+ "firmware version");
+ SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode",
+ CTLFLAG_RD, sc->mf_mode_str, 0,
+ "multifunction mode");
+ SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr",
+ CTLFLAG_RD, sc->mac_addr_str, 0,
+ "mac address");
+ SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pci_link",
+ CTLFLAG_RD, &sc->pci_link_str, 0,
+ "pci link status");
+ SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "debug",
+ CTLFLAG_RW, &sc->debug, 0,
+ "debug logging mode");
+#else
+ SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version",
+ CTLFLAG_RD, &sc->devinfo.bc_ver_str, 0,
+ "bootcode version");
+ SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version",
+ CTLFLAG_RD, &sc->fw_ver_str, 0,
+ "firmware version");
+ SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode",
+ CTLFLAG_RD, &sc->mf_mode_str, 0,
+ "multifunction mode");
+ SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr",
+ CTLFLAG_RD, &sc->mac_addr_str, 0,
+ "mac address");
SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pci_link",
CTLFLAG_RD, &sc->pci_link_str, 0,
"pci link status");
-
- sc->debug = bxe_debug;
SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "debug",
CTLFLAG_RW, &sc->debug, 0,
"debug logging mode");
+#endif /* #if __FreeBSD_version >= 900000 */
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "trigger_grcdump",
CTLTYPE_UINT | CTLFLAG_RW, sc, 0,
diff --git a/sys/dev/bxe/bxe.h b/sys/dev/bxe/bxe.h
index 65ed21ce41fd..73b27b3b3b6f 100644
--- a/sys/dev/bxe/bxe.h
+++ b/sys/dev/bxe/bxe.h
@@ -2271,6 +2271,17 @@ void bxe_dump_mem(struct bxe_softc *sc, char *tag,
void bxe_dump_mbuf_data(struct bxe_softc *sc, char *pTag,
struct mbuf *m, uint8_t contents);
+
+#if __FreeBSD_version >= 800000
+#if __FreeBSD_version >= 1000000
+#define BXE_SET_FLOWID(m) M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE)
+#define BXE_VALID_FLOWID(m) (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE)
+#else
+#define BXE_VALID_FLOWID(m) ((m->m_flags & M_FLOWID) != 0)
+#define BXE_SET_FLOWID(m) m->m_flags |= M_FLOWID
+#endif
+#endif /* #if __FreeBSD_version >= 800000 */
+
/***********/
/* INLINES */
/***********/