aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/sa_query.c35
-rw-r--r--drivers/infiniband/core/user_mad.c4
-rw-r--r--drivers/infiniband/include/ib_sa.h4
3 files changed, 24 insertions, 19 deletions
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index d4233ee61c35..276e1a53010d 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -587,7 +587,7 @@ int ib_sa_path_rec_get(struct ib_device *device, u8 port_num,
587 587
588 init_mad(query->sa_query.mad, agent); 588 init_mad(query->sa_query.mad, agent);
589 589
590 query->sa_query.callback = ib_sa_path_rec_callback; 590 query->sa_query.callback = callback ? ib_sa_path_rec_callback : NULL;
591 query->sa_query.release = ib_sa_path_rec_release; 591 query->sa_query.release = ib_sa_path_rec_release;
592 query->sa_query.port = port; 592 query->sa_query.port = port;
593 query->sa_query.mad->mad_hdr.method = IB_MGMT_METHOD_GET; 593 query->sa_query.mad->mad_hdr.method = IB_MGMT_METHOD_GET;
@@ -663,7 +663,7 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num,
663 663
664 init_mad(query->sa_query.mad, agent); 664 init_mad(query->sa_query.mad, agent);
665 665
666 query->sa_query.callback = ib_sa_mcmember_rec_callback; 666 query->sa_query.callback = callback ? ib_sa_mcmember_rec_callback : NULL;
667 query->sa_query.release = ib_sa_mcmember_rec_release; 667 query->sa_query.release = ib_sa_mcmember_rec_release;
668 query->sa_query.port = port; 668 query->sa_query.port = port;
669 query->sa_query.mad->mad_hdr.method = method; 669 query->sa_query.mad->mad_hdr.method = method;
@@ -698,20 +698,21 @@ static void send_handler(struct ib_mad_agent *agent,
698 if (!query) 698 if (!query)
699 return; 699 return;
700 700
701 switch (mad_send_wc->status) { 701 if (query->callback)
702 case IB_WC_SUCCESS: 702 switch (mad_send_wc->status) {
703 /* No callback -- already got recv */ 703 case IB_WC_SUCCESS:
704 break; 704 /* No callback -- already got recv */
705 case IB_WC_RESP_TIMEOUT_ERR: 705 break;
706 query->callback(query, -ETIMEDOUT, NULL); 706 case IB_WC_RESP_TIMEOUT_ERR:
707 break; 707 query->callback(query, -ETIMEDOUT, NULL);
708 case IB_WC_WR_FLUSH_ERR: 708 break;
709 query->callback(query, -EINTR, NULL); 709 case IB_WC_WR_FLUSH_ERR:
710 break; 710 query->callback(query, -EINTR, NULL);
711 default: 711 break;
712 query->callback(query, -EIO, NULL); 712 default:
713 break; 713 query->callback(query, -EIO, NULL);
714 } 714 break;
715 }
715 716
716 dma_unmap_single(agent->device->dma_device, 717 dma_unmap_single(agent->device->dma_device,
717 pci_unmap_addr(query, mapping), 718 pci_unmap_addr(query, mapping),
@@ -736,7 +737,7 @@ static void recv_handler(struct ib_mad_agent *mad_agent,
736 query = idr_find(&query_idr, mad_recv_wc->wc->wr_id); 737 query = idr_find(&query_idr, mad_recv_wc->wc->wr_id);
737 spin_unlock_irqrestore(&idr_lock, flags); 738 spin_unlock_irqrestore(&idr_lock, flags);
738 739
739 if (query) { 740 if (query && query->callback) {
740 if (mad_recv_wc->wc->status == IB_WC_SUCCESS) 741 if (mad_recv_wc->wc->status == IB_WC_SUCCESS)
741 query->callback(query, 742 query->callback(query,
742 mad_recv_wc->recv_buf.mad->mad_hdr.status ? 743 mad_recv_wc->recv_buf.mad->mad_hdr.status ?
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 56b9c2fa2ecc..9d912d6877ff 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -499,6 +499,7 @@ static int ib_umad_open(struct inode *inode, struct file *filp)
499static int ib_umad_close(struct inode *inode, struct file *filp) 499static int ib_umad_close(struct inode *inode, struct file *filp)
500{ 500{
501 struct ib_umad_file *file = filp->private_data; 501 struct ib_umad_file *file = filp->private_data;
502 struct ib_umad_packet *packet, *tmp;
502 int i; 503 int i;
503 504
504 for (i = 0; i < IB_UMAD_MAX_AGENTS; ++i) 505 for (i = 0; i < IB_UMAD_MAX_AGENTS; ++i)
@@ -507,6 +508,9 @@ static int ib_umad_close(struct inode *inode, struct file *filp)
507 ib_unregister_mad_agent(file->agent[i]); 508 ib_unregister_mad_agent(file->agent[i]);
508 } 509 }
509 510
511 list_for_each_entry_safe(packet, tmp, &file->recv_list, list)
512 kfree(packet);
513
510 kfree(file); 514 kfree(file);
511 515
512 return 0; 516 return 0;
diff --git a/drivers/infiniband/include/ib_sa.h b/drivers/infiniband/include/ib_sa.h
index f4f747707b30..00222285eb9a 100644
--- a/drivers/infiniband/include/ib_sa.h
+++ b/drivers/infiniband/include/ib_sa.h
@@ -147,7 +147,7 @@ struct ib_sa_path_rec {
147 /* reserved */ 147 /* reserved */
148 u8 sl; 148 u8 sl;
149 u8 mtu_selector; 149 u8 mtu_selector;
150 enum ib_mtu mtu; 150 u8 mtu;
151 u8 rate_selector; 151 u8 rate_selector;
152 u8 rate; 152 u8 rate;
153 u8 packet_life_time_selector; 153 u8 packet_life_time_selector;
@@ -180,7 +180,7 @@ struct ib_sa_mcmember_rec {
180 u32 qkey; 180 u32 qkey;
181 u16 mlid; 181 u16 mlid;
182 u8 mtu_selector; 182 u8 mtu_selector;
183 enum ib_mtu mtu; 183 u8 mtu;
184 u8 traffic_class; 184 u8 traffic_class;
185 u16 pkey; 185 u16 pkey;
186 u8 rate_selector; 186 u8 rate_selector;