[ofw] [Patch 41/62] Reference implementation of NDv2

Fab Tillier ftillier at microsoft.com
Wed Feb 20 18:29:35 PST 2013


The node_desc copy used to use sizeof, but was changed to use a constant of 64.  Move back to using sizeof, as it is far more maintainable.  Also add a C_ASSERT that the node_desc buffer is the same as the SMP data field.

Signed-off-by: Fab Tillier <ftillier at microsoft.com>

diff -dwup3 -X excl.txt -r \dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\mad.c .\hw\mlx4\kernel\bus\ib\mad.c
--- \dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\mad.c	Thu Mar 29 00:15:28 2012
+++ .\hw\mlx4\kernel\bus\ib\mad.c	Fri Aug 10 00:31:30 2012
@@ -877,7 +877,8 @@ static void node_desc_override(struct ib
 	    mad->mad_hdr.method == IB_MGMT_METHOD_GET_RESP &&
 	    mad->mad_hdr.attr_id == IB_SMP_ATTR_NODE_DESC) {
 		spin_lock(&to_mdev(dev)->sm_lock);
-		memcpy(((struct ib_smp *) mad)->data, dev->node_desc, 64);
+        C_ASSERT(sizeof(((struct ib_smp*)mad)->data) == sizeof(dev->node_desc));
+		memcpy(((struct ib_smp *) mad)->data, dev->node_desc, sizeof(dev->node_desc));
 		spin_unlock(&to_mdev(dev)->sm_lock);
 	}
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ndv2.41.patch
Type: application/octet-stream
Size: 785 bytes
Desc: ndv2.41.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20130221/4aa7e92f/attachment.obj>


More information about the ofw mailing list