[openib-general] SA multicast patches

Roland Dreier rdreier at cisco.com
Thu Feb 15 13:10:39 PST 2007


So I'm reading this over, and the following code looks kind of odd to me:

 > +int ib_sa_get_mcmember_rec(struct ib_device *device, u8 port_num,
 > +			   union ib_gid *mgid, struct ib_sa_mcmember_rec *rec)
 > 
 > ...
 > 
 > +	} else {
 > +		memset(rec, 0, sizeof *rec);
 > +		ib_get_cached_gid(device, port_num, 0, &rec->port_gid);
 > +		rec->pkey = 0xFFFF;
 > +		get_random_bytes(&rec->qkey, sizeof rec->qkey);
 > +		rec->join_state = 1;
 > +	}

Where is this particular hard-coded P_Key value coming from?  And how
about the Q_Key -- why is a random one being chosen?  Does it matter
that this is setting the privileged bit of the Q_Key at random?

The only place this code seems to be used is in
cma_join_ib_multicast(), which overwrites all the values that get set
here anyway.  (Except it leaves the Q_Key if the portspace is not UDP??)
Would it be more sensible to leave the P_Key and Q_Key initialized to
0 here, and let the caller handle it?  I don't see how the multicast
tracking module can pick a sensible default here.

Also, should we check the return value of ib_get_cached_gid()?

 - R.




More information about the general mailing list