Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Nov 2010 00:26:08 +0000 (UTC)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r215959 - head/sys/mips/cavium/octe
Message-ID:  <201011280026.oAS0Q8ic024174@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmallett
Date: Sun Nov 28 00:26:08 2010
New Revision: 215959
URL: http://svn.freebsd.org/changeset/base/215959

Log:
  Remove unused and broken code to implement POW send and POW-only devices; a
  separate POW driver makes more sense, generally.

Modified:
  head/sys/mips/cavium/octe/ethernet-common.c
  head/sys/mips/cavium/octe/ethernet-tx.c
  head/sys/mips/cavium/octe/ethernet-tx.h
  head/sys/mips/cavium/octe/ethernet.c
  head/sys/mips/cavium/octe/octe.c

Modified: head/sys/mips/cavium/octe/ethernet-common.c
==============================================================================
--- head/sys/mips/cavium/octe/ethernet-common.c	Sat Nov 27 23:48:53 2010	(r215958)
+++ head/sys/mips/cavium/octe/ethernet-common.c	Sun Nov 28 00:26:08 2010	(r215959)
@@ -46,9 +46,6 @@ __FBSDID("$FreeBSD$");
 
 extern int octeon_is_simulation(void);
 extern cvmx_bootinfo_t *octeon_bootinfo;
-extern int pow_send_group;
-extern int always_use_pow;
-extern char pow_send_list[];
 
 
 /**
@@ -239,11 +236,6 @@ int cvm_oct_common_init(struct ifnet *if
 		octeon_bootinfo->mac_addr_base[5] + count};
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 
-	/* Force the interface to use the POW send if always_use_pow was
-	   specified or it is in the pow send list */
-	if ((pow_send_group != -1) && (always_use_pow || strstr(pow_send_list, if_name(ifp))))
-		priv->queue = -1;
-
 	ifp->if_mtu = ETHERMTU;
 
 	count++;

Modified: head/sys/mips/cavium/octe/ethernet-tx.c
==============================================================================
--- head/sys/mips/cavium/octe/ethernet-tx.c	Sat Nov 27 23:48:53 2010	(r215958)
+++ head/sys/mips/cavium/octe/ethernet-tx.c	Sun Nov 28 00:26:08 2010	(r215959)
@@ -54,8 +54,6 @@ __FBSDID("$FreeBSD$");
     #define GET_MBUF_QOS(m) 0
 #endif
 
-extern int pow_send_group;
-
 
 /**
  * Packet transmit
@@ -261,132 +259,6 @@ int cvm_oct_xmit(struct mbuf *m, struct 
 
 
 /**
- * Packet transmit to the POW
- *
- * @param m    Packet to send
- * @param dev    Device info structure
- * @return Always returns zero
- */
-int cvm_oct_xmit_pow(struct mbuf *m, struct ifnet *ifp)
-{
-	cvm_oct_private_t  *priv = (cvm_oct_private_t *)ifp->if_softc;
-	char               *packet_buffer;
-	char               *copy_location;
-
-	/* Get a work queue entry */
-	cvmx_wqe_t *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
-	if (__predict_false(work == NULL)) {
-		DEBUGPRINT("%s: Failed to allocate a work queue entry\n", if_name(ifp));
-		ifp->if_oerrors++;
-		m_freem(m);
-		return 0;
-	}
-
-	/* Get a packet buffer */
-	packet_buffer = cvmx_fpa_alloc(CVMX_FPA_PACKET_POOL);
-	if (__predict_false(packet_buffer == NULL)) {
-		DEBUGPRINT("%s: Failed to allocate a packet buffer\n",
-			   if_name(ifp));
-		cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1));
-		ifp->if_oerrors++;
-		m_freem(m);
-		return 0;
-	}
-
-	/* Calculate where we need to copy the data to. We need to leave 8 bytes
-	   for a next pointer (unused). We also need to include any configure
-	   skip. Then we need to align the IP packet src and dest into the same
-	   64bit word. The below calculation may add a little extra, but that
-	   doesn't hurt */
-	copy_location = packet_buffer + sizeof(uint64_t);
-	copy_location += ((CVMX_HELPER_FIRST_MBUFF_SKIP+7)&0xfff8) + 6;
-
-	/* We have to copy the packet since whoever processes this packet
-	   will free it to a hardware pool. We can't use the trick of
-	   counting outstanding packets like in cvm_oct_xmit */
-	m_copydata(m, 0, m->m_pkthdr.len, copy_location);
-
-	/* Fill in some of the work queue fields. We may need to add more
-	   if the software at the other end needs them */
-#if 0
-	work->hw_chksum     = m->csum;
-#endif
-	work->len           = m->m_pkthdr.len;
-	work->ipprt         = priv->port;
-	work->qos           = priv->port & 0x7;
-	work->grp           = pow_send_group;
-	work->tag_type      = CVMX_HELPER_INPUT_TAG_TYPE;
-	work->tag           = pow_send_group; /* FIXME */
-	work->word2.u64     = 0;    /* Default to zero. Sets of zero later are commented out */
-	work->word2.s.bufs  = 1;
-	work->packet_ptr.u64 = 0;
-	work->packet_ptr.s.addr = cvmx_ptr_to_phys(copy_location);
-	work->packet_ptr.s.pool = CVMX_FPA_PACKET_POOL;
-	work->packet_ptr.s.size = CVMX_FPA_PACKET_POOL_SIZE;
-	work->packet_ptr.s.back = (copy_location - packet_buffer)>>7;
-
-	panic("%s: POW transmit not quite implemented yet.", __func__);
-#if 0
-	if (m->protocol == htons(ETH_P_IP)) {
-		work->word2.s.ip_offset     = 14;
-		#if 0
-		work->word2.s.vlan_valid  = 0; /* FIXME */
-		work->word2.s.vlan_cfi    = 0; /* FIXME */
-		work->word2.s.vlan_id     = 0; /* FIXME */
-		work->word2.s.dec_ipcomp  = 0; /* FIXME */
-		#endif
-		work->word2.s.tcp_or_udp    = (ip_hdr(m)->protocol == IP_PROTOCOL_TCP) || (ip_hdr(m)->protocol == IP_PROTOCOL_UDP);
-		#if 0
-		work->word2.s.dec_ipsec   = 0; /* FIXME */
-		work->word2.s.is_v6       = 0; /* We only support IPv4 right now */
-		work->word2.s.software    = 0; /* Hardware would set to zero */
-		work->word2.s.L4_error    = 0; /* No error, packet is internal */
-		#endif
-		work->word2.s.is_frag       = !((ip_hdr(m)->frag_off == 0) || (ip_hdr(m)->frag_off == 1<<14));
-		#if 0
-		work->word2.s.IP_exc      = 0;  /* Assume Linux is sending a good packet */
-		#endif
-		work->word2.s.is_bcast      = (m->pkt_type == PACKET_BROADCAST);
-		work->word2.s.is_mcast      = (m->pkt_type == PACKET_MULTICAST);
-		#if 0
-		work->word2.s.not_IP      = 0; /* This is an IP packet */
-		work->word2.s.rcv_error   = 0; /* No error, packet is internal */
-		work->word2.s.err_code    = 0; /* No error, packet is internal */
-		#endif
-
-		/* When copying the data, include 4 bytes of the ethernet header to
-		   align the same way hardware does */
-		memcpy(work->packet_data, m->data + 10, sizeof(work->packet_data));
-	} else {
-		#if 0
-		work->word2.snoip.vlan_valid  = 0; /* FIXME */
-		work->word2.snoip.vlan_cfi    = 0; /* FIXME */
-		work->word2.snoip.vlan_id     = 0; /* FIXME */
-		work->word2.snoip.software    = 0; /* Hardware would set to zero */
-		#endif
-		work->word2.snoip.is_rarp       = m->protocol == htons(ETH_P_RARP);
-		work->word2.snoip.is_arp        = m->protocol == htons(ETH_P_ARP);
-		work->word2.snoip.is_bcast      = (m->pkt_type == PACKET_BROADCAST);
-		work->word2.snoip.is_mcast      = (m->pkt_type == PACKET_MULTICAST);
-		work->word2.snoip.not_IP        = 1; /* IP was done up above */
-		#if 0
-		work->word2.snoip.rcv_error   = 0; /* No error, packet is internal */
-		work->word2.snoip.err_code    = 0; /* No error, packet is internal */
-		#endif
-		memcpy(work->packet_data, m->data, sizeof(work->packet_data));
-	}
-#endif
-
-	/* Submit the packet to the POW */
-	cvmx_pow_work_submit(work, work->tag, work->tag_type, work->qos, work->grp);
-	ifp->if_opackets++;
-	ifp->if_obytes += m->m_pkthdr.len;
-	m_freem(m);
-	return 0;
-}
-
-
-/**
  * This function frees all mbufs that are currenty queued for TX.
  *
  * @param dev    Device being shutdown

Modified: head/sys/mips/cavium/octe/ethernet-tx.h
==============================================================================
--- head/sys/mips/cavium/octe/ethernet-tx.h	Sat Nov 27 23:48:53 2010	(r215958)
+++ head/sys/mips/cavium/octe/ethernet-tx.h	Sun Nov 28 00:26:08 2010	(r215959)
@@ -29,6 +29,5 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 /* $FreeBSD$ */
 
 int cvm_oct_xmit(struct mbuf *m, struct ifnet *ifp);
-int cvm_oct_xmit_pow(struct mbuf *m, struct ifnet *ifp);
 void cvm_oct_tx_shutdown(struct ifnet *ifp);
 

Modified: head/sys/mips/cavium/octe/ethernet.c
==============================================================================
--- head/sys/mips/cavium/octe/ethernet.c	Sat Nov 27 23:48:53 2010	(r215958)
+++ head/sys/mips/cavium/octe/ethernet.c	Sun Nov 28 00:26:08 2010	(r215959)
@@ -74,36 +74,6 @@ TUNABLE_INT("hw.octe.pow_receive_group",
 		 "\t\tgroup. Also any other software can submit packets to this\n"
 		 "\t\tgroup for the kernel to process." */
 
-int pow_send_group = -1; /* XXX Should be a sysctl.  */
-TUNABLE_INT("hw.octe.pow_send_group", &pow_send_group);
-/*
-		 "\t\tPOW group to send packets to other software on. This\n"
-		 "\t\tcontrols the creation of the virtual device pow0.\n"
-		 "\t\talways_use_pow also depends on this value." */
-
-int always_use_pow;
-TUNABLE_INT("hw.octe.always_use_pow", &always_use_pow);
-/*
-		 "\t\tWhen set, always send to the pow group. This will cause\n"
-		 "\t\tpackets sent to real ethernet devices to be sent to the\n"
-		 "\t\tPOW group instead of the hardware. Unless some other\n"
-		 "\t\tapplication changes the config, packets will still be\n"
-		 "\t\treceived from the low level hardware. Use this option\n"
-		 "\t\tto allow a CVMX app to intercept all packets from the\n"
-		 "\t\tlinux kernel. You must specify pow_send_group along with\n"
-		 "\t\tthis option." */
-
-char pow_send_list[128] = "";
-TUNABLE_STR("hw.octe.pow_send_list", pow_send_list, sizeof pow_send_list);
-/*
-		 "\t\tComma separated list of ethernet devices that should use the\n"
-		 "\t\tPOW for transmit instead of the actual ethernet hardware. This\n"
-		 "\t\tis a per port version of always_use_pow. always_use_pow takes\n"
-		 "\t\tprecedence over this list. For example, setting this to\n"
-		 "\t\t\"eth2,spi3,spi7\" would cause these three devices to transmit\n"
-		 "\t\tusing the pow_send_group." */
-
-
 static int disable_core_queueing = 1;
 TUNABLE_INT("hw.octe.disable_core_queueing", &disable_core_queueing);
 /*
@@ -148,16 +118,10 @@ static void cvm_oct_update_link(void *co
 
 	if (link_info.s.link_up) {
 		if_link_state_change(ifp, LINK_STATE_UP);
-		if (priv->queue != -1)
-			DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, queue %2d\n",
-				   if_name(ifp), link_info.s.speed,
-				   (link_info.s.full_duplex) ? "Full" : "Half",
-				   priv->port, priv->queue);
-		else
-			DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, POW\n",
-				   if_name(ifp), link_info.s.speed,
-				   (link_info.s.full_duplex) ? "Full" : "Half",
-				   priv->port);
+		DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, queue %2d\n",
+			   if_name(ifp), link_info.s.speed,
+			   (link_info.s.full_duplex) ? "Full" : "Half",
+			   priv->port, priv->queue);
 	} else {
 		if_link_state_change(ifp, LINK_STATE_DOWN);
 		DEBUGPRINT("%s: Link down\n", if_name(ifp));
@@ -382,44 +346,6 @@ int cvm_oct_init_module(device_t bus)
 	/* Initialize the FAU used for counting packet buffers that need to be freed */
 	cvmx_fau_atomic_write32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
 
-	if ((pow_send_group != -1)) {
-		struct ifnet *ifp;
-
-		printf("\tConfiguring device for POW only access\n");
-		dev = BUS_ADD_CHILD(bus, 0, "pow", 0);
-		if (dev != NULL)
-			ifp = if_alloc(IFT_ETHER);
-		if (dev != NULL && ifp != NULL) {
-			/* Initialize the device private structure. */
-			cvm_oct_private_t *priv;
-
-			device_probe(dev);
-			priv = device_get_softc(dev);
-			priv->dev = dev;
-			priv->ifp = ifp;
-			priv->init = cvm_oct_common_init;
-			priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
-			priv->port = CVMX_PIP_NUM_INPUT_PORTS;
-			priv->queue = -1;
-			TASK_INIT(&priv->link_task, 0, cvm_oct_update_link, priv);
-
-			device_set_desc(dev, "Cavium Octeon POW Ethernet\n");
-
-			ifp->if_softc = priv;
-
-			if (priv->init(ifp) < 0) {
-				printf("\t\tFailed to register ethernet device for POW\n");
-				panic("%s: need to free ifp.", __func__);
-			} else {
-				cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = ifp;
-				printf("\t\t%s: POW send group %d, receive group %d\n",
-				if_name(ifp), pow_send_group, pow_receive_group);
-			}
-		} else {
-			printf("\t\tFailed to allocate ethernet device for POW\n");
-		}
-	}
-
 	ifnum = 0;
 	num_interfaces = cvmx_helper_get_number_of_interfaces();
 	for (interface = 0; interface < num_interfaces; interface++) {

Modified: head/sys/mips/cavium/octe/octe.c
==============================================================================
--- head/sys/mips/cavium/octe/octe.c	Sat Nov 27 23:48:53 2010	(r215958)
+++ head/sys/mips/cavium/octe/octe.c	Sun Nov 28 00:26:08 2010	(r215959)
@@ -125,16 +125,6 @@ static devclass_t octe_devclass;
 DRIVER_MODULE(octe, octebus, octe_driver, octe_devclass, 0, 0);
 DRIVER_MODULE(miibus, octe, miibus_driver, miibus_devclass, 0, 0);
 
-static driver_t pow_driver = {
-	"pow",
-	octe_methods,
-	sizeof (cvm_oct_private_t),
-};
-
-static devclass_t pow_devclass;
-
-DRIVER_MODULE(pow, octebus, pow_driver, pow_devclass, 0, 0);
-
 static int
 octe_probe(device_t dev)
 {
@@ -322,7 +312,6 @@ static int
 octe_transmit(struct ifnet *ifp, struct mbuf *m)
 {
 	cvm_oct_private_t *priv;
-	int error;
 
 	priv = ifp->if_softc;
 
@@ -332,12 +321,7 @@ octe_transmit(struct ifnet *ifp, struct 
 		return (0);
 	}
 
-	if (priv->queue != -1) {
-		error = cvm_oct_xmit(m, ifp);
-	} else {
-		error = cvm_oct_xmit_pow(m, ifp);
-	}
-	return (error);
+	return (cvm_oct_xmit(m, ifp));
 }
 
 static int



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011280026.oAS0Q8ic024174>