From a4f734b4fc5c6eedf8fdcb5b76d19aecb81bd656 Mon Sep 17 00:00:00 2001 From: Xin LI Date: Tue, 24 Jun 2014 20:11:22 +0000 Subject: [PATCH] Apply vendor fixes for big endian support and 20GBps/25GBps link speeds. Many thanks to Emulex for their continued support of FreeBSD! Submitted by: Venkata Duvvuru MFC after: 3 days --- sys/dev/oce/oce_hw.c | 6 +----- sys/dev/oce/oce_hw.h | 41 +++++++++++++++++++++++++++++++---------- sys/dev/oce/oce_if.c | 19 ++++++++++++++++++- sys/dev/oce/oce_if.h | 9 ++------- sys/dev/oce/oce_mbox.c | 6 +++--- 5 files changed, 55 insertions(+), 26 deletions(-) diff --git a/sys/dev/oce/oce_hw.c b/sys/dev/oce/oce_hw.c index 7fc16b8383ff..8d292880e3cb 100644 --- a/sys/dev/oce/oce_hw.c +++ b/sys/dev/oce/oce_hw.c @@ -487,11 +487,7 @@ oce_hw_start(POCE_SOFTC sc) if_link_state_change(sc->ifp, LINK_STATE_DOWN); } - if (link.mac_speed > 0 && link.mac_speed < 5) - sc->link_speed = link.mac_speed; - else - sc->link_speed = 0; - + sc->link_speed = link.phys_port_speed; sc->qos_link_speed = (uint32_t )link.qos_link_speed * 10; rc = oce_start_mq(sc->mq); diff --git a/sys/dev/oce/oce_hw.h b/sys/dev/oce/oce_hw.h index 9f1a92a37e94..1ad3f7889e0b 100644 --- a/sys/dev/oce/oce_hw.h +++ b/sys/dev/oce/oce_hw.h @@ -1023,7 +1023,7 @@ struct mbx_hdr { #define OCE_MBX_ADDL_STATUS(_MHDR) ((_MHDR)->u0.rsp.additional_status) #define OCE_MBX_STATUS(_MHDR) ((_MHDR)->u0.rsp.status) -/* [05] OPCODE_COMMON_QUERY_LINK_CONFIG */ +/* [05] OPCODE_COMMON_QUERY_LINK_CONFIG_V1 */ struct mbx_query_common_link_config { struct mbx_hdr hdr; union { @@ -1032,16 +1032,37 @@ struct mbx_query_common_link_config { } req; struct { - /* dw 0 */ - uint8_t physical_port; - uint8_t mac_duplex; - uint8_t mac_speed; - uint8_t mac_fault; - /* dw 1 */ - uint8_t mgmt_mac_duplex; - uint8_t mgmt_mac_speed; + #ifdef _BIG_ENDIAN + uint32_t physical_port_fault:8; + uint32_t physical_port_speed:8; + uint32_t link_duplex:8; + uint32_t pt:2; + uint32_t port_number:6; + uint16_t qos_link_speed; - uint32_t logical_link_status; + uint16_t rsvd0; + + uint32_t rsvd1:21; + uint32_t phys_fcv:1; + uint32_t phys_rxf:1; + uint32_t phys_txf:1; + uint32_t logical_link_status:8; + #else + uint32_t port_number:6; + uint32_t pt:2; + uint32_t link_duplex:8; + uint32_t physical_port_speed:8; + uint32_t physical_port_fault:8; + + uint16_t rsvd0; + uint16_t qos_link_speed; + + uint32_t logical_link_status:8; + uint32_t phys_txf:1; + uint32_t phys_rxf:1; + uint32_t phys_fcv:1; + uint32_t rsvd1:21; + #endif } rsp; } params; }; diff --git a/sys/dev/oce/oce_if.c b/sys/dev/oce/oce_if.c index 42ef2c96be81..70d6393ab608 100644 --- a/sys/dev/oce/oce_if.c +++ b/sys/dev/oce/oce_if.c @@ -829,10 +829,21 @@ oce_media_status(struct ifnet *ifp, struct ifmediareq *req) req->ifm_active |= IFM_10G_SR | IFM_FDX; sc->speed = 10000; break; + case 5: /* 20 Gbps */ + req->ifm_active |= IFM_10G_SR | IFM_FDX; + sc->speed = 20000; + break; + case 6: /* 25 Gbps */ + req->ifm_active |= IFM_10G_SR | IFM_FDX; + sc->speed = 25000; + break; case 7: /* 40 Gbps */ req->ifm_active |= IFM_40G_SR4 | IFM_FDX; sc->speed = 40000; break; + default: + sc->speed = 0; + break; } return; @@ -2217,13 +2228,16 @@ setup_max_queues_want(POCE_SOFTC sc) (sc->function_mode & FNM_UMC_MODE) || (sc->function_mode & FNM_VNIC_MODE) || (!is_rss_enabled(sc)) || - (sc->flags & OCE_FLAGS_BE2)) { + IS_BE2(sc)) { sc->nrqs = 1; sc->nwqs = 1; } else { sc->nrqs = MIN(OCE_NCPUS, sc->nrssqs) + 1; sc->nwqs = MIN(OCE_NCPUS, sc->nrssqs); } + + if (IS_BE2(sc) && is_rss_enabled(sc)) + sc->nrqs = MIN(OCE_NCPUS, sc->nrssqs) + 1; } @@ -2237,6 +2251,9 @@ update_queues_got(POCE_SOFTC sc) sc->nrqs = 1; sc->nwqs = 1; } + + if (IS_BE2(sc)) + sc->nwqs = 1; } static int diff --git a/sys/dev/oce/oce_if.h b/sys/dev/oce/oce_if.h index 1af4c4ccdc8e..b6db402e7766 100644 --- a/sys/dev/oce/oce_if.h +++ b/sys/dev/oce/oce_if.h @@ -761,14 +761,9 @@ struct oce_rq { }; struct link_status { - uint8_t physical_port; - uint8_t mac_duplex; - uint8_t mac_speed; - uint8_t mac_fault; - uint8_t mgmt_mac_duplex; - uint8_t mgmt_mac_speed; + uint8_t phys_port_speed; + uint8_t logical_link_status; uint16_t qos_link_speed; - uint32_t logical_link_status; }; diff --git a/sys/dev/oce/oce_mbox.c b/sys/dev/oce/oce_mbox.c index 77fd33bfb05e..f3f7723942bc 100644 --- a/sys/dev/oce/oce_mbox.c +++ b/sys/dev/oce/oce_mbox.c @@ -961,9 +961,9 @@ oce_get_link_status(POCE_SOFTC sc, struct link_status *link) goto error; } /* interpret response */ - bcopy(&fwcmd->params.rsp, link, sizeof(struct link_status)); - link->logical_link_status = HOST_32(link->logical_link_status); - link->qos_link_speed = HOST_16(link->qos_link_speed); + link->qos_link_speed = HOST_16(fwcmd->params.rsp.qos_link_speed); + link->phys_port_speed = fwcmd->params.rsp.physical_port_speed; + link->logical_link_status = fwcmd->params.rsp.logical_link_status; error: return rc; }