[ofa-general] [PATCH 2/6] nes: Cosmetic changes; support virtual WQs and PPC

Glenn Grundstrom NetEffect glenn at lists.openfabrics.org
Wed Nov 14 14:21:35 PST 2007


Updated code for the NetEffect NE020 adapter.

Updates include:
- Support for userspace/virtual WQs.
- PowerPC
- Support for multiple debugging levels
- Many, many cosmetic changes inline with kernel.org standards

Diffs for nes_cm.c and nes_cm.h

Signed-off-by: Glenn Grundstrom <ggrundstrom at neteffect.com>

---
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 561dcf3..4023a2c 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -120,7 +120,7 @@ static struct nes_cm_event *create_event(struct nes_cm_node *cm_node,
 		return NULL;
 
 	/* allocate an empty event */
-	event = (struct nes_cm_event *)kzalloc(sizeof(*event), GFP_ATOMIC);
+	event = kzalloc(sizeof(*event), GFP_ATOMIC);
 
 	if (!event)
 		return NULL;
@@ -211,11 +211,7 @@ static int parse_mpa(struct nes_cm_node *cm_node, u8 *buffer, u32 len)
 static int handle_exception_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb)
 {
 	int ret = 0;
-#ifdef OFED_1_2
-	struct tcphdr *tcph = skb->h.th;
-#else
 	struct tcphdr *tcph = tcp_hdr(skb);
-#endif
 
 	/* first check to see if this a FIN pkt */
 	if (tcph->fin) {
@@ -265,19 +261,12 @@ struct sk_buff *form_cm_frame(struct sk_buff *skb, struct nes_cm_node *cm_node,
 	ethh = (struct ethhdr *) buf;
 	buf += ETH_HLEN;
 
-#ifdef OFED_1_2
-	iph = skb->nh.iph = (struct iphdr *)buf;
-	buf += sizeof(*iph);
-	tcph  = skb->h.th = (struct tcphdr *)buf;
-	skb->mac.raw = skb->data;
-#else
 	iph = (struct iphdr *)buf;
 	buf += sizeof(*iph);
 	tcph = (struct tcphdr *)buf;
 	skb_reset_mac_header(skb);
 	skb_set_network_header(skb, ETH_HLEN);
 	skb_set_transport_header(skb, ETH_HLEN+sizeof(*iph));
-#endif
 	buf += sizeof(*tcph);
 
 	skb->ip_summed = CHECKSUM_PARTIAL;
@@ -404,11 +393,7 @@ int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb,
 	}
 
 	if (type == NES_TIMER_TYPE_SEND) {
-#ifdef OFED_1_2
-		new_send->seq_num = htonl(skb->h.th->seq);
-#else
 		new_send->seq_num = htonl(tcp_hdr(skb)->seq);
-#endif
 		atomic_inc(&new_send->skb->users);
 
 		ret = nes_nic_cm_xmit(new_send->skb, cm_node->netdev);
@@ -433,11 +418,7 @@ int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb,
 		spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags);
 	}
 	if (type == NES_TIMER_TYPE_RECV) {
-#ifdef OFED_1_2
-		new_send->seq_num = htonl(skb->h.th->seq);
-#else
 		new_send->seq_num = htonl(tcp_hdr(skb)->seq);
-#endif
 		new_send->timetosend = jiffies;
 		spin_lock_irqsave(&cm_node->recv_list_lock, flags);
 		list_add_tail(&new_send->list, &cm_node->recv_list);
@@ -687,7 +668,7 @@ int send_syn(struct nes_cm_node *cm_node, u32 sendack)
 	options = (union all_known_options *)&optionsbuffer[optionssize];
 	options->as_windowscale.optionnum = OPTION_NUMBER_WINDOW_SCALE;
 	options->as_windowscale.length = sizeof(struct option_windowscale);
-	options->as_windowscale.shiftcount = NES_CM_DEFAULT_RCV_WND_SCALE;
+	options->as_windowscale.shiftcount = cm_node->tcp_cntxt.snd_wscale;
 	optionssize += sizeof(struct option_windowscale);
 
 	if (sendack && !(NES_DRV_OPT_SUPRESS_OPTION_BC & nes_drv_opt)
@@ -1054,11 +1035,10 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core,
 	struct nes_adapter *nesadapter;
 
 	/* create an hte and cm_node for this instance */
-	cm_node = (struct nes_cm_node *)kzalloc(sizeof(*cm_node), GFP_ATOMIC);
+	cm_node = kzalloc(sizeof(*cm_node), GFP_ATOMIC);
 	if (!cm_node)
 		return NULL;
 
-	memset(cm_node, 0, sizeof(struct nes_cm_node));
 	/* set our node specific transport info */
 	cm_node->loc_addr = cm_info->loc_addr;
 	cm_node->rem_addr = cm_info->rem_addr;
@@ -1072,6 +1052,9 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core,
 	cm_node->cm_id = cm_info->cm_id;
 	memcpy(cm_node->loc_mac, nesvnic->netdev->dev_addr, ETH_ALEN);
 
+	nes_debug(NES_DBG_CM, "listener=%p, cm_id=%p\n",
+			cm_node->listener, cm_node->cm_id);
+
 	INIT_LIST_HEAD(&cm_node->retrans_list);
 	spin_lock_init(&cm_node->retrans_list_lock);
 	INIT_LIST_HEAD(&cm_node->recv_list);
@@ -1281,14 +1264,10 @@ int process_packet(struct nes_cm_node *cm_node, struct sk_buff *skb,
 	int optionsize;
 	int datasize;
 	int ret = 0;
-#ifdef OFED_1_2
-	struct tcphdr *tcph = skb->h.th;
-#else
 	struct tcphdr *tcph = tcp_hdr(skb);
-#endif
 	u32 inc_sequence;
 
-	if ((!tcph) || (NES_CM_STATE_TSA == cm_node->state)) {
+	if ((!tcph) || (cm_node->state == NES_CM_STATE_TSA)) {
 		BUG_ON(!tcph);
 		atomic_inc(&cm_accel_dropped_pkts);
 		return -1;
@@ -1301,6 +1280,7 @@ int process_packet(struct nes_cm_node *cm_node, struct sk_buff *skb,
 		switch (cm_node->state) {
 			case NES_CM_STATE_LISTENING:
 				rem_ref_cm_node(cm_core, cm_node);
+				break;
 			case NES_CM_STATE_TSA:
 			case NES_CM_STATE_CLOSED:
 				break;
@@ -1333,11 +1313,7 @@ int process_packet(struct nes_cm_node *cm_node, struct sk_buff *skb,
 
 	optionsize = (tcph->doff << 2) - sizeof(struct tcphdr);
 
-#ifdef OFED_1_2
-	skb_pull(skb, skb->nh.iph->ihl << 2);
-#else
 	skb_pull(skb, ip_hdr(skb)->ihl << 2);
-#endif
 	skb_pull(skb, tcph->doff << 2);
 
 	datasize = skb->len;
@@ -1361,6 +1337,12 @@ int process_packet(struct nes_cm_node *cm_node, struct sk_buff *skb,
 
 		cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize;
 
+
+	if (optionsize) {
+		u8 *optionsloc = (u8 *)&tcph[1];
+		process_options(cm_node, optionsloc, optionsize);
+	}
+
 	cm_node->tcp_cntxt.snd_wnd = htons(tcph->window) <<
 			cm_node->tcp_cntxt.snd_wscale;
 
@@ -1368,11 +1350,6 @@ int process_packet(struct nes_cm_node *cm_node, struct sk_buff *skb,
 		cm_node->tcp_cntxt.max_snd_wnd = cm_node->tcp_cntxt.snd_wnd;
 	}
 
-	if (optionsize) {
-		u8 *optionsloc = (u8 *)&tcph[1];
-		process_options(cm_node, optionsloc, optionsize);
-	}
-
 	if (tcph->ack) {
 		cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq);
 		switch (cm_node->state) {
@@ -1566,8 +1543,11 @@ static struct nes_cm_listener *mini_cm_listen(struct nes_cm_core *cm_core,
 	struct nes_cm_listener *listener;
 	unsigned long flags;
 
+	nes_debug(NES_DBG_CM, "Search for 0x%08x : 0x%04x\n",
+			htonl(cm_info->loc_addr), htons(cm_info->loc_port));
+
 	/* cannot have multiple matching listeners */
-	listener = find_listener( cm_core, htonl(cm_info->loc_addr),
+	listener = find_listener(cm_core, htonl(cm_info->loc_addr),
 			htons(cm_info->loc_port), NES_CM_LISTENER_EITHER_STATE);
 	if (listener && listener->listener_state == NES_CM_LISTENER_ACTIVE_STATE) {
 		/* find automatically incs ref count ??? */
@@ -1578,7 +1558,7 @@ static struct nes_cm_listener *mini_cm_listen(struct nes_cm_core *cm_core,
 
 	if (!listener) {
 		/* create a CM listen node (1/2 node to compare incoming traffic to) */
-		listener = (struct nes_cm_listener *)kzalloc(sizeof(*listener), GFP_ATOMIC);
+		listener = kzalloc(sizeof(*listener), GFP_ATOMIC);
 		if (!listener) {
 			nes_debug(NES_DBG_CM, "Not creating listener memory allocation failed\n");
 			return NULL;
@@ -1656,7 +1636,7 @@ struct nes_cm_node * mini_cm_connect(struct nes_cm_core *cm_core,
 	if (cm_info->loc_addr == cm_info->rem_addr) {
 		loopbackremotelistener = find_listener(cm_core, cm_node->rem_addr,
 				cm_node->rem_port, NES_CM_LISTENER_ACTIVE_STATE);
-		if (NULL == loopbackremotelistener) {
+		if (loopbackremotelistener == NULL) {
 			create_event(cm_node, NES_CM_EVENT_ABORTED);
 		} else {
 			u16 temp;
@@ -1672,9 +1652,10 @@ struct nes_cm_node * mini_cm_connect(struct nes_cm_core *cm_core,
 			loopbackremotenode->mpa_frame_size = mpa_frame_size -
 					sizeof(struct ietf_mpa_frame);
 
-			create_event(loopbackremotenode, NES_CM_EVENT_MPA_REQ);
 			// we are done handling this state, set node to a TSA state
 			cm_node->state = NES_CM_STATE_TSA;
+
+			create_event(loopbackremotenode, NES_CM_EVENT_MPA_REQ);
 		}
 		return cm_node;
 	}
@@ -1684,6 +1665,7 @@ struct nes_cm_node * mini_cm_connect(struct nes_cm_core *cm_core,
 	/* init our MPA frame ptr */
 	memcpy(&cm_node->mpa_frame, mpa_frame, mpa_frame_size);
 	cm_node->mpa_frame_size = mpa_frame_size;
+	cm_node->tcp_cntxt.snd_wscale = NES_CM_DEFAULT_RCV_WND_SCALE;
 
 	/* send a syn and goto syn sent state */
 	cm_node->state = NES_CM_STATE_SYN_SENT;
@@ -1809,13 +1791,8 @@ int mini_cm_recv_pkt(struct nes_cm_core *cm_core, struct nes_vnic *nesvnic,
 
 	iph = (struct iphdr *)skb->data;
 	tcph = (struct tcphdr *)(skb->data + sizeof(struct iphdr));
-#ifdef OFED_1_2
-	skb->nh.iph = iph;
-	skb->h.th = tcph;
-#else
 	skb_reset_network_header(skb);
 	skb_set_transport_header(skb, sizeof(*tcph));
-#endif
 	skb->len = htons(iph->tot_len);
 
 	nfo.loc_addr = ntohl(iph->daddr);
@@ -1823,6 +1800,9 @@ int mini_cm_recv_pkt(struct nes_cm_core *cm_core, struct nes_vnic *nesvnic,
 	nfo.rem_addr = ntohl(iph->saddr);
 	nfo.rem_port = ntohs(tcph->source);
 
+	nes_debug(NES_DBG_CM, "Received packet: dest=0x%08X:0x%04X src=0x%08X:0x%04X\n",
+			iph->daddr, tcph->dest, iph->saddr, tcph->source);
+
 	/* note: this call is going to increment cm_node ref count */
 	cm_node = find_node(cm_core,
 			nfo.rem_port, nfo.rem_addr,
@@ -2071,12 +2051,11 @@ int nes_cm_disconn(struct nes_qp *nesqp)
 	unsigned long flags;
 
 	spin_lock_irqsave(&nesqp->lock, flags);
-	if (0==nesqp->disconn_pending) {
+	if (nesqp->disconn_pending == 0) {
 		nesqp->disconn_pending++;
 		spin_unlock_irqrestore(&nesqp->lock, flags);
 		/* nes_add_ref(&nesqp->ibqp); */
 		/* init our disconnect work element, to */
-		/* NES_INIT_WORK(&nesqp->disconn_work, nes_disconnect_worker, (void *)nesqp); */
 		INIT_WORK(&nesqp->disconn_work, nes_disconnect_worker);
 
 		queue_work(g_cm_core->disconn_wq, &nesqp->disconn_work);
@@ -2092,9 +2071,8 @@ int nes_cm_disconn(struct nes_qp *nesqp)
 /**
  * nes_disconnect_worker
  */
-void nes_disconnect_worker(void *parm)
+void nes_disconnect_worker(struct work_struct *work)
 {
-	struct work_struct *work = parm;
 	struct nes_qp *nesqp = container_of(work, struct nes_qp, disconn_work);
 
 	nes_debug(NES_DBG_CM, "processing AEQE id 0x%04X for QP%u.\n",
@@ -2113,6 +2091,7 @@ int nes_cm_disconn_true(struct nes_qp *nesqp)
 	struct iw_cm_id *cm_id;
 	struct iw_cm_event cm_event;
 	struct nes_vnic *nesvnic;
+	struct nes_cm_node *cm_node = NULL;
 	u16 last_ae;
 	u8 original_hw_tcp_state;
 	u8 original_ibqp_state;
@@ -2184,7 +2163,7 @@ int nes_cm_disconn_true(struct nes_qp *nesqp)
 		original_ibqp_state   = nesqp->ibqp_state;
 		last_ae = nesqp->last_aeq;
 
-		if ((0 == issued_disconnect_reset) && (nesqp->cm_id) &&
+		if ((issued_disconnect_reset == 0) && (nesqp->cm_id) &&
 				((original_hw_tcp_state == NES_AEQE_TCP_STATE_CLOSED) ||
 				 (original_hw_tcp_state == NES_AEQE_TCP_STATE_TIME_WAIT) ||
 				 (last_ae == NES_AEQE_AEID_RDMAP_ROE_BAD_LLP_CLOSE) ||
@@ -2213,7 +2192,7 @@ int nes_cm_disconn_true(struct nes_qp *nesqp)
 			cm_id->rem_ref(cm_id);
 
 			spin_lock_irqsave(&nesqp->lock, flags);
-			if (0 == nesqp->flush_issued) {
+			if (nesqp->flush_issued == 0) {
 				nesqp->flush_issued = 1;
 				spin_unlock_irqrestore(&nesqp->lock, flags);
 				flush_wqes(nesvnic->nesdev, nesqp, NES_CQP_FLUSH_RQ, 1);
@@ -2305,6 +2284,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 	struct iw_cm_event cm_event;
 	struct nes_hw_qp_wqe *wqe;
 	struct nes_v4_quad nes_quad;
+	struct iw_cm_id *lb_cm_id;
 	int ret;
 
 	ibqp = nes_get_qp(cm_id->device, conn_param->qpn);
@@ -2317,6 +2297,9 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 	nesdev = nesvnic->nesdev;
 	adapter = nesdev->nesadapter;
 
+	nes_debug(NES_DBG_CM, "nesvnic=%p, netdev=%p, %s\n",
+			nesvnic, nesvnic->netdev, nesvnic->netdev->name);
+
 	/* since this is from a listen, we were able to put node handle into cm_id */
 	cm_node = (struct nes_cm_node *)cm_id->provider_data;
 
@@ -2407,17 +2390,14 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 	nesqp->nesqp_context->ird_ord_sizes |= cpu_to_le32((u32)conn_param->ord);
 
 	memset(&nes_quad, 0, sizeof(nes_quad));
-
-	nes_quad.DstIpAdrIndex = (u32)PCI_FUNC(nesdev->pcidev->devfn) << 27;
+	nes_quad.DstIpAdrIndex = cpu_to_le32((u32)PCI_FUNC(nesdev->pcidev->devfn) << 24);
 	nes_quad.SrcIpadr      = cm_id->remote_addr.sin_addr.s_addr;
 	nes_quad.TcpPorts[0]   = cm_id->remote_addr.sin_port;
 	nes_quad.TcpPorts[1]   = cm_id->local_addr.sin_port;
 
 	/* Produce hash key */
-	nesqp->hte_index = nes_crc32(1, NES_HASH_CRC_INITAL_VALUE,
-			NES_HASH_CRC_FINAL_XOR, sizeof(nes_quad),
-			(u8 *)&nes_quad, ORDER, REFIN, REFOUT);
-
+	nesqp->hte_index = cpu_to_be32(
+			crc32c(~0, (void *)&nes_quad, sizeof(nes_quad)) ^ 0xffffffff);
 	nes_debug(NES_DBG_CM, "HTE Index = 0x%08X, CRC = 0x%08X\n",
 			nesqp->hte_index, nesqp->hte_index & adapter->hte_index_mask);
 
@@ -2602,9 +2582,14 @@ int nes_create_listen(struct iw_cm_id *cm_id, int backlog)
 	if (!nesvnic)
 		return -EINVAL;
 	adapter = nesvnic->nesdev->nesadapter;
+	nes_debug(NES_DBG_CM, "nesvnic=%p, netdev=%p, %s\n",
+			nesvnic, nesvnic->netdev, nesvnic->netdev->name);
+
+	nes_debug(NES_DBG_CM, "nesvnic->local_ipaddr=0x%08x, sin_addr.s_addr=0x%08x\n",
+			nesvnic->local_ipaddr, cm_id->local_addr.sin_addr.s_addr);
 
 	/* setup listen params in our api call struct */
-	cm_info.loc_addr = cm_id->local_addr.sin_addr.s_addr;
+	cm_info.loc_addr = nesvnic->local_ipaddr;
 	cm_info.loc_port = cm_id->local_addr.sin_port;
 	cm_info.backlog = backlog;
 	cm_info.cm_id = cm_id;
@@ -2789,18 +2774,16 @@ void cm_event_connected(struct nes_cm_event *event)
 
 	memset(&nes_quad, 0, sizeof(nes_quad));
 
-	nes_quad.DstIpAdrIndex = (u32)PCI_FUNC(nesdev->pcidev->devfn) << 27;
+	nes_quad.DstIpAdrIndex = cpu_to_le32((u32)PCI_FUNC(nesdev->pcidev->devfn) << 24);
 	nes_quad.SrcIpadr = cm_id->remote_addr.sin_addr.s_addr;
 	nes_quad.TcpPorts[0] = cm_id->remote_addr.sin_port;
 	nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port;
 
-	nesqp->hte_index = nes_crc32( 1, NES_HASH_CRC_INITAL_VALUE,
-			NES_HASH_CRC_FINAL_XOR, sizeof(nes_quad), (u8 *)&nes_quad,
-			ORDER, REFIN, REFOUT);
-
-	nes_debug(NES_DBG_CM, "HTE Index = 0x%08X, After CRC = 0x%08X, TcpPorts = 0x%08X\n",
-			nesqp->hte_index, nesqp->hte_index & nesadapter->hte_index_mask,
-			le32_to_cpu(nes_quad.TcpPorts));
+	/* Produce hash key */
+	nesqp->hte_index = cpu_to_be32(
+			crc32c(~0, (void *)&nes_quad, sizeof(nes_quad)) ^ 0xffffffff);
+	nes_debug(NES_DBG_CM, "HTE Index = 0x%08X, After CRC = 0x%08X\n",
+			nesqp->hte_index, nesqp->hte_index & nesadapter->hte_index_mask);
 
 	nesqp->hte_index &= nesadapter->hte_index_mask;
 	nesqp->nesqp_context->hte_index = cpu_to_le32(nesqp->hte_index);
@@ -2907,6 +2890,9 @@ void cm_event_reset(struct nes_cm_event *event)
 	if (!event->cm_node)
 		return;
 
+	if (!event->cm_node->cm_id)
+		return;
+
 	cm_id = event->cm_node->cm_id;
 
 	nes_debug(NES_DBG_CM, "%p - cm_id = %p\n", event->cm_node, cm_id);
@@ -2925,6 +2911,7 @@ void cm_event_reset(struct nes_cm_event *event)
 	ret = cm_id->event_handler(cm_id, &cm_event);
 	nes_debug(NES_DBG_CM, "OFA CM event_handler returned, ret=%d\n", ret);
 
+
 	/* notify OF layer about this connection error event */
 	cm_id->rem_ref(cm_id);
 
@@ -2975,7 +2962,7 @@ void cm_event_mpa_req(struct nes_cm_event *event)
 }
 
 
-static void nes_cm_event_handler(void *parm);
+static void nes_cm_event_handler(struct work_struct *);
 
 /**
  * nes_cm_post_event
@@ -2986,7 +2973,6 @@ int nes_cm_post_event(struct nes_cm_event *event)
 	atomic_inc(&event->cm_node->cm_core->events_posted);
 	add_ref_cm_node(event->cm_node);
 	event->cm_info.cm_id->add_ref(event->cm_info.cm_id);
-	/* NES_INIT_WORK(&event->event_work, nes_cm_event_handler, (void *)event); */
 	INIT_WORK(&event->event_work, nes_cm_event_handler);
 	nes_debug(NES_DBG_CM, "queue_work, event=%p\n", event);
 
@@ -3002,9 +2988,8 @@ int nes_cm_post_event(struct nes_cm_event *event)
  * worker function to handle cm events
  * will free instance of nes_cm_event
  */
-static void nes_cm_event_handler(void *parm)
+static void nes_cm_event_handler(struct work_struct *work)
 {
-	struct work_struct *work = parm;
 	struct nes_cm_event *event = container_of(work, struct nes_cm_event, event_work);
 	struct nes_cm_core *cm_core;
 
@@ -3025,7 +3010,8 @@ static void nes_cm_event_handler(void *parm)
 			cm_event_reset(event);
 			break;
 		case NES_CM_EVENT_CONNECTED:
-			if ((!event->cm_node->cm_id) || (event->cm_node->state != NES_CM_STATE_TSA)) {
+			if ((!event->cm_node->cm_id) ||
+				(event->cm_node->state != NES_CM_STATE_TSA)) {
 				break;
 			}
 			cm_event_connected(event);
diff --git a/drivers/infiniband/hw/nes/nes_cm.h b/drivers/infiniband/hw/nes/nes_cm.h
index 8956b32..00eaeb1 100644
--- a/drivers/infiniband/hw/nes/nes_cm.h
+++ b/drivers/infiniband/hw/nes/nes_cm.h
@@ -43,7 +43,7 @@
 #define IEFT_MPA_KEY_REQ  "MPA ID Req Frame"
 #define IEFT_MPA_KEY_REP  "MPA ID Rep Frame"
 #define IETF_MPA_KEY_SIZE 16
-#define IETF_MPA_VERSION   1
+#define IETF_MPA_VERSION  1
 
 enum ietf_mpa_flags {
 	IETF_MPA_FLAGS_MARKERS = 0x80,	/* receive Markers */
@@ -131,32 +131,32 @@ struct nes_timer_entry {
 	struct net_device *netdev;
 };
 
-#define NES_DEFAULT_RETRYS	64
+#define NES_DEFAULT_RETRYS  64
 #define NES_DEFAULT_RETRANS 8
 #ifdef CONFIG_INFINIBAND_NES_DEBUG
-#define NES_RETRY_TIMEOUT	(1000*HZ/1000)
+#define NES_RETRY_TIMEOUT   (1000*HZ/1000)
 #else
-#define NES_RETRY_TIMEOUT	(1000*HZ/10000)
+#define NES_RETRY_TIMEOUT   (1000*HZ/10000)
 #endif
-#define NES_SHORT_TIME		(10)
-#define NES_LONG_TIME		(2000*HZ/1000)
+#define NES_SHORT_TIME      (10)
+#define NES_LONG_TIME       (2000*HZ/1000)
 
-#define NES_CM_HASHTABLE_SIZE       1024
-#define NES_CM_TCP_TIMER_INTERVAL   3000	
-#define NES_CM_DEFAULT_MTU          1540
+#define NES_CM_HASHTABLE_SIZE         1024
+#define NES_CM_TCP_TIMER_INTERVAL     3000	
+#define NES_CM_DEFAULT_MTU            1540
 #define NES_CM_DEFAULT_FRAME_CNT      10
-#define NES_CM_THREAD_STACK_SIZE     256	
-#define NES_CM_DEFAULT_RCV_WND			64240	// before we know that window scaling is allowed
-#define NES_CM_DEFAULT_RCV_WND_SCALED	256960  // after we know that window scaling is allowed
-#define NES_CM_DEFAULT_RCV_WND_SCALE	2
-#define NES_CM_DEFAULT_FREE_PKTS  0x000A	
-#define NES_CM_FREE_PKT_LO_WATERMARK   2	
+#define NES_CM_THREAD_STACK_SIZE      256	
+#define NES_CM_DEFAULT_RCV_WND        64240	// before we know that window scaling is allowed
+#define NES_CM_DEFAULT_RCV_WND_SCALED 256960  // after we know that window scaling is allowed
+#define NES_CM_DEFAULT_RCV_WND_SCALE  2
+#define NES_CM_DEFAULT_FREE_PKTS      0x000A	
+#define NES_CM_FREE_PKT_LO_WATERMARK  2	
 
-#define NES_CM_DEF_SEQ        0x159bf75f
-#define NES_CM_DEF_LOCAL_ID       0x3b47
+#define NES_CM_DEF_SEQ       0x159bf75f
+#define NES_CM_DEF_LOCAL_ID  0x3b47
 
-#define NES_CM_DEF_SEQ2       0x18ed5740
-#define NES_CM_DEF_LOCAL_ID2      0xb807
+#define NES_CM_DEF_SEQ2      0x18ed5740
+#define NES_CM_DEF_LOCAL_ID2 0xb807
 
 typedef u32 nes_addr_t;
 
@@ -192,15 +192,15 @@ enum nes_cm_conn_type {
 
 /* CM context params */
 struct nes_cm_tcp_context {
-	u8   client;		
+	u8  client;			
 
-	u32  loc_seq_num;	
-	u32  loc_ack_num;	
-	u32  rem_ack_num;	
-	u32  rcv_nxt;		
+	u32 loc_seq_num;	
+	u32 loc_ack_num;	
+	u32 rem_ack_num;	
+	u32 rcv_nxt;		
 
-	u32  loc_id;
-	u32  rem_id;
+	u32 loc_id;
+	u32 rem_id;
 
 	u32 snd_wnd;
 	u32 max_snd_wnd;
@@ -211,7 +211,7 @@ struct nes_cm_tcp_context {
 	u8  rcv_wscale;
 
 	struct nes_cm_tsa_context tsa_cntxt;	
-	struct timeval sent_ts;		
+	struct timeval            sent_ts;		
 };
 
 
@@ -222,68 +222,67 @@ enum nes_cm_listener_state {
 };
 
 struct nes_cm_listener {
-	struct list_head list;
-	u64 session_id;	
-	struct nes_cm_core *cm_core;
-	u8 loc_mac[ETH_ALEN];
-	nes_addr_t loc_addr;
-	u16 loc_port;
-	struct iw_cm_id *cm_id;
-	enum nes_cm_conn_type conn_type;
-	atomic_t ref_count;
-	struct nes_vnic *nesvnic;
-	atomic_t pend_accepts_cnt;
-	int backlog;
+	struct list_head           list;
+	u64                        session_id;	
+	struct nes_cm_core         *cm_core;
+	u8                         loc_mac[ETH_ALEN];
+	nes_addr_t                 loc_addr;
+	u16                        loc_port;
+	struct iw_cm_id            *cm_id;
+	enum nes_cm_conn_type      conn_type;
+	atomic_t                   ref_count;
+	struct nes_vnic            *nesvnic;
+	atomic_t                   pend_accepts_cnt;
+	int                        backlog;
 	enum nes_cm_listener_state listener_state;
-	u32  reused_node;
+	u32                        reused_node;
 };
 
 /* per connection node and node state information */
 struct nes_cm_node {
-	u64 session_id;	
-	u32 hashkey;	
-
-	nes_addr_t loc_addr, rem_addr;
-	u16 loc_port, rem_port;
+	u64                       session_id;	
+	u32                       hashkey;	
 
+	nes_addr_t                loc_addr, rem_addr;
+	u16                       loc_port, rem_port;
 
-	u8 loc_mac[ETH_ALEN];	
-	u8 rem_mac[ETH_ALEN];	
+	u8                        loc_mac[ETH_ALEN];	
+	u8                        rem_mac[ETH_ALEN];	
 
-	enum nes_cm_node_state state;	
+	enum nes_cm_node_state    state;	
 	struct nes_cm_tcp_context tcp_cntxt;	
-	struct nes_cm_core *cm_core;
-	struct sk_buff_head resend_list;
-	atomic_t ref_count;
-	struct net_device *netdev;
-
-	struct nes_cm_node *loopbackpartner ;
-	struct list_head retrans_list;
-	spinlock_t retrans_list_lock;
-	struct list_head recv_list;
-	spinlock_t recv_list_lock;
+	struct nes_cm_core        *cm_core;
+	struct sk_buff_head       resend_list;
+	atomic_t                  ref_count;
+	struct net_device         *netdev;
+
+	struct nes_cm_node        *loopbackpartner;
+	struct list_head          retrans_list;
+	spinlock_t                retrans_list_lock;
+	struct list_head          recv_list;
+	spinlock_t                recv_list_lock;
 	
-	int send_write0;
+	int                       send_write0;
 	union {
 		struct ietf_mpa_frame mpa_frame;	
-		u8 mpa_frame_buf[NES_CM_DEFAULT_MTU];
+		u8                    mpa_frame_buf[NES_CM_DEFAULT_MTU];
 	};
-	u16 mpa_frame_size;
-	struct iw_cm_id *cm_id;
-	struct list_head list;
-	int accelerated;
-	struct nes_cm_listener *listener;
-	enum nes_cm_conn_type conn_type;
-	struct nes_vnic *nesvnic;
-	int apbvt_set;
-	int accept_pend;
+	u16                       mpa_frame_size;
+	struct iw_cm_id           *cm_id;
+	struct list_head          list;
+	int                       accelerated;
+	struct nes_cm_listener    *listener;
+	enum nes_cm_conn_type     conn_type;
+	struct nes_vnic           *nesvnic;
+	int                       apbvt_set;
+	int                       accept_pend;
 };
 
 /* structure for client or CM to fill when making CM api calls. */
 /*	- only need to set relevant data, based on op. */
 struct nes_cm_info {
 	union {
-		struct iw_cm_id *cm_id;
+		struct iw_cm_id   *cm_id;
 		struct net_device *netdev;
 	};
 
@@ -325,36 +324,36 @@ struct nes_cm_event {
 };
 
 struct nes_cm_core {
-	enum nes_cm_node_state state;	
-	atomic_t session_id;			
-
-	atomic_t listen_node_cnt;			
-	struct nes_cm_node listen_list;	
-	spinlock_t listen_list_lock;	
-
-	u32 mtu;						
-	u32 free_tx_pkt_max;
-	u32 rx_pkt_posted;				
-	struct sk_buff_head tx_free_list;	
-	atomic_t ht_node_cnt;			
-	struct list_head connected_nodes;
+	enum nes_cm_node_state  state;	
+	atomic_t                session_id;			
+
+	atomic_t                listen_node_cnt;			
+	struct nes_cm_node      listen_list;	
+	spinlock_t              listen_list_lock;	
+
+	u32                     mtu;						
+	u32                     free_tx_pkt_max;
+	u32                     rx_pkt_posted;				
+	struct sk_buff_head     tx_free_list;	
+	atomic_t                ht_node_cnt;			
+	struct list_head        connected_nodes;
 	/* struct list_head hashtable[NES_CM_HASHTABLE_SIZE]; */
-	spinlock_t ht_lock;				
+	spinlock_t              ht_lock;				
 
-	struct timer_list tcp_timer;	
+	struct timer_list       tcp_timer;	
 
-	struct nes_cm_ops *api;			
+	struct nes_cm_ops       *api;			
 
 	int (*post_event)(struct nes_cm_event *event);
-	atomic_t events_posted;
+	atomic_t                events_posted;
 	struct workqueue_struct *event_wq;
 	struct workqueue_struct *disconn_wq;
 
-	atomic_t node_cnt;
-	u64 aborted_connects;
-	u32 options;
+	atomic_t                node_cnt;
+	u64                     aborted_connects;
+	u32                     options;
 
-	struct nes_cm_node *current_listen_node;
+	struct nes_cm_node      *current_listen_node;
 };
 
 
@@ -408,7 +407,7 @@ int mini_cm_get(struct nes_cm_core *);
 int mini_cm_set(struct nes_cm_core *, u32, u32);
 
 int nes_cm_disconn(struct nes_qp *);
-void nes_disconnect_worker(void *);
+void nes_disconnect_worker(struct work_struct *);
 int nes_cm_disconn_true(struct nes_qp *);
 int nes_disconnect(struct nes_qp *, int);
 
@@ -430,4 +429,3 @@ void cm_event_mpa_req(struct nes_cm_event *);
 int nes_cm_post_event(struct nes_cm_event *);
 
 #endif			/* NES_CM_H */
-
diff --git a/drivers/infiniband/hw/nes/nes_context.h b/drivers/infiniband/hw/nes/nes_context.h



More information about the general mailing list