svn commit: r258586 - stable/9/sys/dev/oce

Xin LI delphij at FreeBSD.org
Mon Nov 25 20:05:24 UTC 2013


Author: delphij
Date: Mon Nov 25 20:05:23 2013
New Revision: 258586
URL: http://svnweb.freebsd.org/changeset/base/258586

Log:
  MFC r257007,258140:
  
  Update driver to version 10.0.664.0.
  
  Many thanks to Emulex for their continued support of FreeBSD.
  
  Submitted by:	Venkata Duvvuru <VenkatKumar.Duvvuru Emulex Com>

Modified:
  stable/9/sys/dev/oce/oce_hw.c
  stable/9/sys/dev/oce/oce_hw.h
  stable/9/sys/dev/oce/oce_if.c
  stable/9/sys/dev/oce/oce_if.h
  stable/9/sys/dev/oce/oce_mbox.c
  stable/9/sys/dev/oce/oce_queue.c
  stable/9/sys/dev/oce/oce_sysctl.c
  stable/9/sys/dev/oce/oce_util.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/oce/oce_hw.c
==============================================================================
--- stable/9/sys/dev/oce/oce_hw.c	Mon Nov 25 20:03:57 2013	(r258585)
+++ stable/9/sys/dev/oce/oce_hw.c	Mon Nov 25 20:05:23 2013	(r258586)
@@ -38,6 +38,7 @@
 
 /* $FreeBSD$ */
 
+
 #include "oce_if.h"
 
 static int oce_POST(POCE_SOFTC sc);
@@ -203,12 +204,16 @@ void oce_get_pci_capabilities(POCE_SOFTC
 {
 	uint32_t val;
 
-	if (pci_find_cap(sc->dev, PCIY_PCIX, &val) == 0) {
+#if __FreeBSD_version >= 1000000
+	#define pci_find_extcap pci_find_cap
+#endif
+
+	if (pci_find_extcap(sc->dev, PCIY_PCIX, &val) == 0) {
 		if (val != 0) 
 			sc->flags |= OCE_FLAGS_PCIX;
 	}
 
-	if (pci_find_cap(sc->dev, PCIY_EXPRESS, &val) == 0) {
+	if (pci_find_extcap(sc->dev, PCIY_EXPRESS, &val) == 0) {
 		if (val != 0) {
 			uint16_t link_status =
 			    pci_read_config(sc->dev, val + 0x12, 2);
@@ -219,12 +224,12 @@ void oce_get_pci_capabilities(POCE_SOFTC
 		}
 	}
 
-	if (pci_find_cap(sc->dev, PCIY_MSI, &val) == 0) {
+	if (pci_find_extcap(sc->dev, PCIY_MSI, &val) == 0) {
 		if (val != 0)
 			sc->flags |= OCE_FLAGS_MSI_CAPABLE;
 	}
 
-	if (pci_find_cap(sc->dev, PCIY_MSIX, &val) == 0) {
+	if (pci_find_extcap(sc->dev, PCIY_MSIX, &val) == 0) {
 		if (val != 0) {
 			val = pci_msix_count(sc->dev);
 			sc->flags |= OCE_FLAGS_MSIX_CAPABLE;
@@ -386,6 +391,9 @@ oce_create_nw_interface(POCE_SOFTC sc)
 		capab_flags &= ~MBX_RX_IFACE_FLAGS_PASS_L3L4_ERR;
 	}
 
+	if (IS_SH(sc) || IS_XE201(sc))
+		capab_flags |= MBX_RX_IFACE_FLAGS_MULTICAST;
+
 	/* enable capabilities controlled via driver startup parameters */
 	if (is_rss_enabled(sc))
 		capab_en_flags |= MBX_RX_IFACE_FLAGS_RSS;

Modified: stable/9/sys/dev/oce/oce_hw.h
==============================================================================
--- stable/9/sys/dev/oce/oce_hw.h	Mon Nov 25 20:03:57 2013	(r258585)
+++ stable/9/sys/dev/oce/oce_hw.h	Mon Nov 25 20:05:23 2013	(r258586)
@@ -59,6 +59,30 @@
 #define	INTR_EN				0x20000000
 #define	IMAGE_TRANSFER_SIZE		(32 * 1024)	/* 32K at a time */
 
+
+/********* UE Status and Mask Registers ***/
+#define PCICFG_UE_STATUS_LOW                    0xA0
+#define PCICFG_UE_STATUS_HIGH                   0xA4
+#define PCICFG_UE_STATUS_LOW_MASK               0xA8
+
+/* Lancer SLIPORT registers */
+#define SLIPORT_STATUS_OFFSET           0x404
+#define SLIPORT_CONTROL_OFFSET          0x408
+#define SLIPORT_ERROR1_OFFSET           0x40C
+#define SLIPORT_ERROR2_OFFSET           0x410
+#define PHYSDEV_CONTROL_OFFSET          0x414
+
+#define SLIPORT_STATUS_ERR_MASK         0x80000000
+#define SLIPORT_STATUS_DIP_MASK         0x02000000
+#define SLIPORT_STATUS_RN_MASK          0x01000000
+#define SLIPORT_STATUS_RDY_MASK         0x00800000
+#define SLI_PORT_CONTROL_IP_MASK        0x08000000
+#define PHYSDEV_CONTROL_FW_RESET_MASK   0x00000002
+#define PHYSDEV_CONTROL_DD_MASK         0x00000004
+#define PHYSDEV_CONTROL_INP_MASK        0x40000000
+
+#define SLIPORT_ERROR_NO_RESOURCE1      0x2
+#define SLIPORT_ERROR_NO_RESOURCE2      0x9
 /* CSR register offsets */
 #define	MPU_EP_CONTROL			0
 #define	MPU_EP_SEMAPHORE_BE3		0xac
@@ -1553,7 +1577,8 @@ struct mbx_common_read_write_flashrom {
 	uint32_t flash_op_type;
 	uint32_t data_buffer_size;
 	uint32_t data_offset;
-	uint8_t  data_buffer[4];	/* + IMAGE_TRANSFER_SIZE */
+	uint8_t  data_buffer[32768];	/* + IMAGE_TRANSFER_SIZE */
+	uint8_t  rsvd[4];
 };
 
 struct oce_phy_info {
@@ -2079,7 +2104,8 @@ struct flash_file_hdr {
 	uint32_t antidote;
 	uint32_t num_imgs;
 	uint8_t  build[24];
-	uint8_t  rsvd[32];
+	uint8_t  asic_type_rev;
+	uint8_t  rsvd[31];
 };
 
 struct image_hdr {
@@ -3681,4 +3707,3 @@ enum OCE_QUEUE_RX_STATS {
 	QUEUE_RX_BUFFER_ERRORS = 8,
 	QUEUE_RX_N_WORDS = 10
 };
-

Modified: stable/9/sys/dev/oce/oce_if.c
==============================================================================
--- stable/9/sys/dev/oce/oce_if.c	Mon Nov 25 20:03:57 2013	(r258585)
+++ stable/9/sys/dev/oce/oce_if.c	Mon Nov 25 20:05:23 2013	(r258586)
@@ -36,7 +36,6 @@
  * Costa Mesa, CA 92626
  */
 
-
 /* $FreeBSD$ */
 
 #include "opt_inet6.h"
@@ -44,6 +43,78 @@
 
 #include "oce_if.h"
 
+/* UE Status Low CSR */
+static char *ue_status_low_desc[] = {
+	"CEV",
+	"CTX",
+	"DBUF",
+	"ERX",
+	"Host",
+	"MPU",
+	"NDMA",
+	"PTC ",
+	"RDMA ",
+	"RXF ",
+	"RXIPS ",
+	"RXULP0 ",
+	"RXULP1 ",
+	"RXULP2 ",
+	"TIM ",
+	"TPOST ",
+	"TPRE ",
+	"TXIPS ",
+	"TXULP0 ",
+	"TXULP1 ",
+	"UC ",
+	"WDMA ",
+	"TXULP2 ",
+	"HOST1 ",
+	"P0_OB_LINK ",
+	"P1_OB_LINK ",
+	"HOST_GPIO ",
+	"MBOX ",
+	"AXGMAC0",
+	"AXGMAC1",
+	"JTAG",
+	"MPU_INTPEND"
+};
+
+/* UE Status High CSR */
+static char *ue_status_hi_desc[] = {
+	"LPCMEMHOST",
+	"MGMT_MAC",
+	"PCS0ONLINE",
+	"MPU_IRAM",
+	"PCS1ONLINE",
+	"PCTL0",
+	"PCTL1",
+	"PMEM",
+	"RR",
+	"TXPB",
+	"RXPP",
+	"XAUI",
+	"TXP",
+	"ARM",
+	"IPC",
+	"HOST2",
+	"HOST3",
+	"HOST4",
+	"HOST5",
+	"HOST6",
+	"HOST7",
+	"HOST8",
+	"HOST9",
+	"NETC",
+	"Unknown",
+	"Unknown",
+	"Unknown",
+	"Unknown",
+	"Unknown",
+	"Unknown",
+	"Unknown",
+	"Unknown"
+};
+
 
 /* Driver entry points prototypes */
 static int  oce_probe(device_t dev);
@@ -387,11 +458,11 @@ oce_ioctl(struct ifnet *ifp, u_long comm
 		}
 
 		if ((ifp->if_flags & IFF_PROMISC) && !sc->promisc) {
-			sc->promisc = TRUE;
-			oce_rxf_set_promiscuous(sc, sc->promisc);
+			if (!oce_rxf_set_promiscuous(sc, (1 | (1 << 1))))
+				sc->promisc = TRUE;
 		} else if (!(ifp->if_flags & IFF_PROMISC) && sc->promisc) {
-			sc->promisc = FALSE;
-			oce_rxf_set_promiscuous(sc, sc->promisc);
+			if (!oce_rxf_set_promiscuous(sc, 0))
+				sc->promisc = FALSE;
 		}
 
 		break;
@@ -861,10 +932,12 @@ retry:
 			(m->m_pkthdr.csum_flags & CSUM_TCP) ? 1 : 0;
 		nichdr->u0.s.num_wqe = num_wqes;
 		nichdr->u0.s.total_length = m->m_pkthdr.len;
+
 		if (m->m_flags & M_VLANTAG) {
 			nichdr->u0.s.vlan = 1; /*Vlan present*/
 			nichdr->u0.s.vlan_tag = m->m_pkthdr.ether_vtag;
 		}
+
 		if (m->m_pkthdr.csum_flags & CSUM_TSO) {
 			if (m->m_pkthdr.tso_segsz) {
 				nichdr->u0.s.lso = 1;
@@ -1155,6 +1228,18 @@ oce_wq_handler(void *arg)
 }
 
 
+#if __FreeBSD_version >= 1000000
+static __inline void
+drbr_stats_update(struct ifnet *ifp, int len, int mflags)
+{
+#ifndef NO_SLOW_STATS
+	ifp->if_obytes += len;
+	if (mflags & M_MCAST)
+		ifp->if_omcasts++;
+#endif
+}
+#endif
+
 static int 
 oce_multiq_transmit(struct ifnet *ifp, struct mbuf *m, struct oce_wq *wq)
 {
@@ -1173,7 +1258,7 @@ oce_multiq_transmit(struct ifnet *ifp, s
 		return status;
 	}
 
-	 if (m != NULL) {
+	if (m != NULL) {
 		if ((status = drbr_enqueue(ifp, br, m)) != 0)
 			return status;
 	} 
@@ -1645,6 +1730,10 @@ oce_attach_ifp(POCE_SOFTC sc)
 	sc->ifp->if_capenable = sc->ifp->if_capabilities;
 	sc->ifp->if_baudrate = IF_Gbps(10UL);
 
+#if __FreeBSD_version >= 1000000
+	sc->ifp->if_hw_tsomax = OCE_MAX_TSO_SIZE;
+#endif
+
 	ether_ifattach(sc->ifp, sc->macaddr.mac_addr);
 	
 	return 0;
@@ -1663,7 +1752,8 @@ oce_add_vlan(void *arg, struct ifnet *if
 
 	sc->vlan_tag[vtag] = 1;
 	sc->vlans_added++;
-	oce_vid_config(sc);
+	if (sc->vlans_added <= (sc->max_vlans + 1))
+		oce_vid_config(sc);
 }
 
 
@@ -1865,12 +1955,76 @@ done:
 
 }
 
+static void oce_detect_hw_error(POCE_SOFTC sc)
+{
+
+	uint32_t ue_low = 0, ue_high = 0, ue_low_mask = 0, ue_high_mask = 0;
+	uint32_t sliport_status = 0, sliport_err1 = 0, sliport_err2 = 0;
+	uint32_t i;
+
+	if (sc->hw_error)
+		return;
+
+	if (IS_XE201(sc)) {
+		sliport_status = OCE_READ_REG32(sc, db, SLIPORT_STATUS_OFFSET);
+		if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
+			sliport_err1 = OCE_READ_REG32(sc, db, SLIPORT_ERROR1_OFFSET);
+			sliport_err2 = OCE_READ_REG32(sc, db, SLIPORT_ERROR2_OFFSET);
+		}
+	} else {
+		ue_low = OCE_READ_REG32(sc, devcfg, PCICFG_UE_STATUS_LOW);
+		ue_high = OCE_READ_REG32(sc, devcfg, PCICFG_UE_STATUS_HIGH);
+		ue_low_mask = OCE_READ_REG32(sc, devcfg, PCICFG_UE_STATUS_LOW_MASK);
+		ue_high_mask = OCE_READ_REG32(sc, devcfg, PCICFG_UE_STATUS_HI_MASK);
+
+		ue_low = (ue_low & ~ue_low_mask);
+		ue_high = (ue_high & ~ue_high_mask);
+	}
+
+	/* On certain platforms BE hardware can indicate spurious UEs.
+	 * Allow the h/w to stop working completely in case of a real UE.
+	 * Hence not setting the hw_error for UE detection.
+	 */
+	if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
+		sc->hw_error = TRUE;
+		device_printf(sc->dev, "Error detected in the card\n");
+	}
+
+	if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
+		device_printf(sc->dev,
+				"ERR: sliport status 0x%x\n", sliport_status);
+		device_printf(sc->dev,
+				"ERR: sliport error1 0x%x\n", sliport_err1);
+		device_printf(sc->dev,
+				"ERR: sliport error2 0x%x\n", sliport_err2);
+	}
+
+	if (ue_low) {
+		for (i = 0; ue_low; ue_low >>= 1, i++) {
+			if (ue_low & 1)
+				device_printf(sc->dev, "UE: %s bit set\n",
+							ue_status_low_desc[i]);
+		}
+	}
+
+	if (ue_high) {
+		for (i = 0; ue_high; ue_high >>= 1, i++) {
+			if (ue_high & 1)
+				device_printf(sc->dev, "UE: %s bit set\n",
+							ue_status_hi_desc[i]);
+		}
+	}
+
+}
+
+
 static void
 oce_local_timer(void *arg)
 {
 	POCE_SOFTC sc = arg;
 	int i = 0;
 	
+	oce_detect_hw_error(sc);
 	oce_refresh_nic_stats(sc);
 	oce_refresh_queue_stats(sc);
 	oce_mac_addr_set(sc);
@@ -1889,7 +2043,7 @@ oce_local_timer(void *arg)
 
 /* NOTE : This should only be called holding
  *        DEVICE_LOCK.
-*/
+ */
 static void
 oce_if_deactivate(POCE_SOFTC sc)
 {
@@ -2079,6 +2233,9 @@ setup_max_queues_want(POCE_SOFTC sc)
 	    (sc->flags & OCE_FLAGS_BE2)) {
 		sc->nrqs = 1;
 		sc->nwqs = 1;
+	} else {
+		sc->nrqs = MIN(OCE_NCPUS, sc->nrssqs) + 1;
+		sc->nwqs = MIN(OCE_NCPUS, sc->nrssqs);
 	}
 }
 

Modified: stable/9/sys/dev/oce/oce_if.h
==============================================================================
--- stable/9/sys/dev/oce/oce_if.h	Mon Nov 25 20:03:57 2013	(r258585)
+++ stable/9/sys/dev/oce/oce_if.h	Mon Nov 25 20:05:23 2013	(r258586)
@@ -36,7 +36,6 @@
  * Costa Mesa, CA 92626
  */
 
-
 /* $FreeBSD$ */
 
 #include <sys/param.h>
@@ -88,7 +87,8 @@
 
 #include "oce_hw.h"
 
-#define COMPONENT_REVISION "4.6.95.0"
+/* OCE device driver module component revision informaiton */
+#define COMPONENT_REVISION "10.0.664.0"
 
 /* OCE devices supported by this driver */
 #define PCI_VENDOR_EMULEX		0x10df	/* Emulex */
@@ -150,6 +150,7 @@ extern int mp_ncpus;			/* system's total
 #define OCE_MAX_TX_ELEMENTS		29
 #define OCE_MAX_TX_DESC			1024
 #define OCE_MAX_TX_SIZE			65535
+#define OCE_MAX_TSO_SIZE		(65535 - ETHER_HDR_LEN)
 #define OCE_MAX_RX_SIZE			4096
 #define OCE_MAX_RQ_POSTS		255
 #define OCE_DEFAULT_PROMISCUOUS		0
@@ -173,6 +174,7 @@ extern int mp_ncpus;			/* system's total
 #define  OCE_CAPAB_FLAGS 		(MBX_RX_IFACE_FLAGS_BROADCAST    | \
 					MBX_RX_IFACE_FLAGS_UNTAGGED      | \
 					MBX_RX_IFACE_FLAGS_PROMISCUOUS      | \
+					MBX_RX_IFACE_FLAGS_VLAN_PROMISCUOUS |	\
 					MBX_RX_IFACE_FLAGS_MCAST_PROMISCUOUS   | \
 					MBX_RX_IFACE_FLAGS_RSS | \
 					MBX_RX_IFACE_FLAGS_PASS_L3L4_ERR)
@@ -863,7 +865,7 @@ typedef struct oce_softc {
 	uint32_t if_cap_flags;
 
 	uint32_t flow_control;
-	uint32_t promisc;
+	uint8_t  promisc;
 
 	struct oce_aic_obj aic_obj[OCE_MAX_EQ];
 
@@ -877,9 +879,11 @@ typedef struct oce_softc {
 	struct oce_drv_stats oce_stats_info;
 	struct callout  timer;
 	int8_t be3_native;
+	uint8_t hw_error;
 	uint16_t qnq_debug_event;
 	uint16_t qnqid;
 	uint16_t pvid;
+	uint16_t max_vlans;
 
 } OCE_SOFTC, *POCE_SOFTC;
 
@@ -1010,7 +1014,7 @@ int oce_config_vlan(POCE_SOFTC sc, uint3
 		uint32_t untagged, uint32_t enable_promisc);
 int oce_set_flow_control(POCE_SOFTC sc, uint32_t flow_control);
 int oce_config_nic_rss(POCE_SOFTC sc, uint32_t if_id, uint16_t enable_rss);
-int oce_rxf_set_promiscuous(POCE_SOFTC sc, uint32_t enable);
+int oce_rxf_set_promiscuous(POCE_SOFTC sc, uint8_t enable);
 int oce_set_common_iface_rx_filter(POCE_SOFTC sc, POCE_DMA_MEM sgl);
 int oce_get_link_status(POCE_SOFTC sc, struct link_status *link);
 int oce_mbox_get_nic_stats_v0(POCE_SOFTC sc, POCE_DMA_MEM pstats_dma_mem);

Modified: stable/9/sys/dev/oce/oce_mbox.c
==============================================================================
--- stable/9/sys/dev/oce/oce_mbox.c	Mon Nov 25 20:03:57 2013	(r258585)
+++ stable/9/sys/dev/oce/oce_mbox.c	Mon Nov 25 20:05:23 2013	(r258586)
@@ -36,11 +36,8 @@
  * Costa Mesa, CA 92626
  */
 
-
-
 /* $FreeBSD$ */
 
-
 #include "oce_if.h"
 extern uint32_t sfp_vpd_dump_buffer[TRANSCEIVER_DATA_NUM_ELE];
 
@@ -281,8 +278,10 @@ oce_get_fw_version(POCE_SOFTC sc)
 	if (!ret)
                 ret = fwcmd->hdr.u0.rsp.status;
 	if (ret) {
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, ret);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, ret,
+			      fwcmd->hdr.u0.rsp.additional_status);
 		goto error;
 	}
 
@@ -438,8 +437,10 @@ oce_read_mac_addr(POCE_SOFTC sc, uint32_
 	if (!ret)
                 ret = fwcmd->hdr.u0.rsp.status;
 	if (ret) {
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, ret);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, ret,
+			      fwcmd->hdr.u0.rsp.additional_status);
 		goto error;
 	}
 
@@ -481,25 +482,27 @@ oce_get_fw_config(POCE_SOFTC sc)
 	if (!ret)
                 ret = fwcmd->hdr.u0.rsp.status;
 	if (ret) {
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, ret);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, ret,
+			      fwcmd->hdr.u0.rsp.additional_status);
 		goto error;
 	}
 
 	DW_SWAP(u32ptr(fwcmd), sizeof(struct mbx_common_query_fw_config));
 
-	sc->config_number = fwcmd->params.rsp.config_number;
-	sc->asic_revision = fwcmd->params.rsp.asic_revision;
-	sc->port_id	  = fwcmd->params.rsp.port_id;
-	sc->function_mode = fwcmd->params.rsp.function_mode;
-	sc->function_caps = fwcmd->params.rsp.function_caps;
+	sc->config_number = HOST_32(fwcmd->params.rsp.config_number);
+	sc->asic_revision = HOST_32(fwcmd->params.rsp.asic_revision);
+	sc->port_id	  = HOST_32(fwcmd->params.rsp.port_id);
+	sc->function_mode = HOST_32(fwcmd->params.rsp.function_mode);
+	sc->function_caps = HOST_32(fwcmd->params.rsp.function_caps);
 
 	if (fwcmd->params.rsp.ulp[0].ulp_mode & ULP_NIC_MODE) {
-		sc->max_tx_rings = fwcmd->params.rsp.ulp[0].nic_wq_tot;
-		sc->max_rx_rings = fwcmd->params.rsp.ulp[0].lro_rqid_tot;
+		sc->max_tx_rings = HOST_32(fwcmd->params.rsp.ulp[0].nic_wq_tot);
+		sc->max_rx_rings = HOST_32(fwcmd->params.rsp.ulp[0].lro_rqid_tot);
 	} else {
-		sc->max_tx_rings = fwcmd->params.rsp.ulp[1].nic_wq_tot;
-		sc->max_rx_rings = fwcmd->params.rsp.ulp[1].lro_rqid_tot;
+		sc->max_tx_rings = HOST_32(fwcmd->params.rsp.ulp[1].nic_wq_tot);
+		sc->max_rx_rings = HOST_32(fwcmd->params.rsp.ulp[1].lro_rqid_tot);
 	}
 	
 error:
@@ -561,15 +564,17 @@ oce_if_create(POCE_SOFTC sc,
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc) {
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 		goto error;
 	}
 
-	*if_id = LE_32(fwcmd->params.rsp.if_id);
+	*if_id = HOST_32(fwcmd->params.rsp.if_id);
 
 	if (mac_addr != NULL)
-		sc->pmac_id = LE_32(fwcmd->params.rsp.pmac_id);
+		sc->pmac_id = HOST_32(fwcmd->params.rsp.pmac_id);
 error:
 	return rc;
 }
@@ -607,8 +612,10 @@ oce_if_del(POCE_SOFTC sc, uint32_t if_id
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc)
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 	return rc;
 }
 
@@ -630,7 +637,10 @@ oce_config_vlan(POCE_SOFTC sc,
 {
 	struct oce_mbx mbx;
 	struct mbx_common_config_vlan *fwcmd;
-	int rc;
+	int rc = 0;
+
+	if (sc->vlans_added > sc->max_vlans)
+		goto vlan_promisc;
 
 	bzero(&mbx, sizeof(struct oce_mbx));
 	fwcmd = (struct mbx_common_config_vlan *)&mbx.payload;
@@ -659,9 +669,19 @@ oce_config_vlan(POCE_SOFTC sc,
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc)
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
-	return 0;
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
+
+	goto done;
+
+vlan_promisc:
+	/* Enable Vlan Promis */
+	oce_rxf_set_promiscuous(sc, (1 << 1));
+	device_printf(sc->dev,"Enabling Vlan Promisc Mode\n");
+done:
+	return rc;
 
 }
 
@@ -702,8 +722,10 @@ oce_set_flow_control(POCE_SOFTC sc, uint
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc)
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 	return rc;
 }
 
@@ -802,8 +824,10 @@ oce_config_nic_rss(POCE_SOFTC sc, uint32
 		if (!rc)
                 	rc = fwcmd->hdr.u0.rsp.status;
 		if (rc)
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 	}
 	return rc;
 }
@@ -818,7 +842,7 @@ oce_config_nic_rss(POCE_SOFTC sc, uint32
  *	This function uses the COMMON_SET_IFACE_RX_FILTER command instead.
  */
 int
-oce_rxf_set_promiscuous(POCE_SOFTC sc, uint32_t enable)
+oce_rxf_set_promiscuous(POCE_SOFTC sc, uint8_t enable)
 {
 	struct mbx_set_common_iface_rx_filter *fwcmd;
 	int sz = sizeof(struct mbx_set_common_iface_rx_filter);
@@ -836,10 +860,13 @@ oce_rxf_set_promiscuous(POCE_SOFTC sc, u
 	req =  &fwcmd->params.req;
 	req->iface_flags_mask = MBX_RX_IFACE_FLAGS_PROMISCUOUS |
 				MBX_RX_IFACE_FLAGS_VLAN_PROMISCUOUS;
-	if (enable) {
-		req->iface_flags = MBX_RX_IFACE_FLAGS_PROMISCUOUS |
-				   MBX_RX_IFACE_FLAGS_VLAN_PROMISCUOUS;
-	}
+	/* Bit 0 Mac promisc, Bit 1 Vlan promisc */
+	if (enable & 0x01)
+		req->iface_flags = MBX_RX_IFACE_FLAGS_PROMISCUOUS;
+
+	if (enable & 0x02)
+		req->iface_flags = MBX_RX_IFACE_FLAGS_VLAN_PROMISCUOUS;
+
 	req->if_id = sc->if_id;
 
 	rc = oce_set_common_iface_rx_filter(sc, &sgl);
@@ -886,9 +913,11 @@ oce_set_common_iface_rx_filter(POCE_SOFT
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc)
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
-	return 0;
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
+	return rc;
 }
 
 /**
@@ -925,14 +954,16 @@ oce_get_link_status(POCE_SOFTC sc, struc
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc) {
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 		goto error;
 	}
 	/* interpret response */
 	bcopy(&fwcmd->params.rsp, link, sizeof(struct link_status));
-	link->logical_link_status = LE_32(link->logical_link_status);
-	link->qos_link_speed = LE_16(link->qos_link_speed);
+	link->logical_link_status = HOST_32(link->logical_link_status);
+	link->qos_link_speed = HOST_16(link->qos_link_speed);
 error:
 	return rc;
 }
@@ -978,8 +1009,10 @@ oce_mbox_get_nic_stats_v0(POCE_SOFTC sc,
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc)
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 	return rc; 
 }
 
@@ -1028,8 +1061,10 @@ oce_mbox_get_nic_stats(POCE_SOFTC sc, PO
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc)
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 	return rc; 
 }
 
@@ -1080,8 +1115,10 @@ oce_mbox_get_pport_stats(POCE_SOFTC sc, 
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc)
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 	return rc;
 }
 
@@ -1133,8 +1170,10 @@ oce_mbox_get_vport_stats(POCE_SOFTC sc, 
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc)
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 	return rc;
 }
 
@@ -1178,8 +1217,10 @@ oce_update_multicast(POCE_SOFTC sc, POCE
 	if (!rc)
                 rc = req->hdr.u0.rsp.status;
 	if (rc)
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      req->hdr.u0.rsp.additional_status);
 	return rc;
 }
 
@@ -1243,8 +1284,10 @@ oce_mbox_macaddr_add(POCE_SOFTC sc, uint
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc) {
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 		goto error;
 	}
 	*pmac_id = fwcmd->params.rsp.pmac_id;
@@ -1281,8 +1324,10 @@ oce_mbox_macaddr_del(POCE_SOFTC sc, uint
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc)
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 	return rc;
 }
 
@@ -1318,11 +1363,13 @@ oce_mbox_check_native_mode(POCE_SOFTC sc
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc) {
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 		goto error;
 	}
-	sc->be3_native = fwcmd->params.rsp.capability_flags
+	sc->be3_native = HOST_32(fwcmd->params.rsp.capability_flags)
 			& CAP_BE3_NATIVE_ERX_API;
 
 error:
@@ -1363,8 +1410,10 @@ oce_mbox_cmd_set_loopback(POCE_SOFTC sc,
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc)
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 
 	return rc;
 
@@ -1406,8 +1455,10 @@ oce_mbox_cmd_test_loopback(POCE_SOFTC sc
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc)
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 	
 	return rc;
 }
@@ -1433,9 +1484,9 @@ oce_mbox_write_flashrom(POCE_SOFTC sc, u
 				payload_len,
 				OCE_MBX_VER_V0);
 
-	fwcmd->flash_op_type = optype;
-	fwcmd->flash_op_code = opcode;
-	fwcmd->data_buffer_size = num_bytes;
+	fwcmd->flash_op_type = LE_32(optype);
+	fwcmd->flash_op_code = LE_32(opcode);
+	fwcmd->data_buffer_size = LE_32(num_bytes);
 
 	mbx.u0.s.embedded  = 0; /*Non embeded*/
 	mbx.payload_length = payload_len;
@@ -1451,8 +1502,10 @@ oce_mbox_write_flashrom(POCE_SOFTC sc, u
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc)
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 	
 	return rc;
 
@@ -1497,8 +1550,10 @@ oce_mbox_get_flashrom_crc(POCE_SOFTC sc,
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc) {
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 		goto error;
 	}
 	bcopy(fwcmd->data_buffer, flash_crc, 4);
@@ -1532,18 +1587,20 @@ oce_mbox_get_phy_info(POCE_SOFTC sc, str
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc) {
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 		goto error;
 	}
-	phy_info->phy_type = fwcmd->params.rsp.phy_info.phy_type;
+	phy_info->phy_type = HOST_16(fwcmd->params.rsp.phy_info.phy_type);
 	phy_info->interface_type =
-			fwcmd->params.rsp.phy_info.interface_type;
+			HOST_16(fwcmd->params.rsp.phy_info.interface_type);
 	phy_info->auto_speeds_supported =
-		fwcmd->params.rsp.phy_info.auto_speeds_supported;
+		HOST_16(fwcmd->params.rsp.phy_info.auto_speeds_supported);
 	phy_info->fixed_speeds_supported =
-		fwcmd->params.rsp.phy_info.fixed_speeds_supported;
-	phy_info->misc_params =fwcmd->params.rsp.phy_info.misc_params;
+		HOST_16(fwcmd->params.rsp.phy_info.fixed_speeds_supported);
+	phy_info->misc_params = HOST_32(fwcmd->params.rsp.phy_info.misc_params);
 error:
 	return rc;
 
@@ -1593,11 +1650,13 @@ oce_mbox_lancer_write_flashrom(POCE_SOFT
 	if (!rc)
                 rc = fwcmd->params.rsp.status;
 	if (rc) {
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->params.rsp.additional_status);
 		goto error;
 	}
-	*written_data = fwcmd->params.rsp.actual_write_length;
+	*written_data = HOST_32(fwcmd->params.rsp.actual_write_length);
 	*additional_status = fwcmd->params.rsp.additional_status;
 error:
 	return rc;
@@ -1649,11 +1708,13 @@ oce_mbox_create_rq(struct oce_rq *rq)
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc) {
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 		goto error;
 	}
-	rq->rq_id = fwcmd->params.rsp.rq_id;
+	rq->rq_id = HOST_16(fwcmd->params.rsp.rq_id);
 	rq->rss_cpuid = fwcmd->params.rsp.rss_cpuid;
 error:
 	return rc;
@@ -1673,15 +1734,17 @@ oce_mbox_create_wq(struct oce_wq *wq)
 	bzero(&mbx, sizeof(struct oce_mbx));
 
 	fwcmd = (struct mbx_create_nic_wq *)&mbx.payload;
-	if (IS_XE201(sc)) {
+	if (IS_XE201(sc))
 		version = OCE_MBX_VER_V1;
-		fwcmd->params.req.if_id = sc->if_id;
-	} else if(IS_BE(sc))
+	else if(IS_BE(sc))
 		IS_PROFILE_SUPER_NIC(sc) ? (version = OCE_MBX_VER_V2) 
 					 : (version = OCE_MBX_VER_V0);
 	else
 		version = OCE_MBX_VER_V2;
 
+	if (version > OCE_MBX_VER_V0)
+		fwcmd->params.req.if_id = sc->if_id;
+
 	mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0,
 				MBX_SUBSYSTEM_NIC,
 				NIC_CREATE_WQ, MBX_TIMEOUT_SEC,
@@ -1703,13 +1766,15 @@ oce_mbox_create_wq(struct oce_wq *wq)
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc) {
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 		goto error;
 	}
-	wq->wq_id = LE_16(fwcmd->params.rsp.wq_id);
+	wq->wq_id = HOST_16(fwcmd->params.rsp.wq_id);
 	if (version == OCE_MBX_VER_V2)
-		wq->db_offset = LE_32(fwcmd->params.rsp.db_offset);
+		wq->db_offset = HOST_32(fwcmd->params.rsp.db_offset);
 	else
 		wq->db_offset = PD_TXULP_DB;
 error:
@@ -1754,11 +1819,13 @@ oce_mbox_create_eq(struct oce_eq *eq)
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc) {
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 		goto error;
 	}
-	eq->eq_id = LE_16(fwcmd->params.rsp.eq_id);
+	eq->eq_id = HOST_16(fwcmd->params.rsp.eq_id);
 error:
 	return rc;
 }
@@ -1832,11 +1899,13 @@ oce_mbox_cq_create(struct oce_cq *cq, ui
 	if (!rc)
                 rc = fwcmd->hdr.u0.rsp.status;
 	if (rc) {
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 		goto error;
 	}
-	cq->cq_id = LE_16(fwcmd->params.rsp.cq_id);
+	cq->cq_id = HOST_16(fwcmd->params.rsp.cq_id);
 error:
 	return rc;
 
@@ -1885,8 +1954,10 @@ oce_mbox_read_transrecv_data(POCE_SOFTC 
 	if (!rc)
 		rc = fwcmd->hdr.u0.rsp.status;
 	if (rc) {
-		device_printf(sc->dev,"%s failed - cmd status: %d\n",
-			      __FUNCTION__, rc);
+		device_printf(sc->dev,
+			      "%s failed - cmd status: %d addi status: %d\n",
+			      __FUNCTION__, rc,
+			      fwcmd->hdr.u0.rsp.additional_status);
 		goto error;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-stable-9 mailing list