Re: [PATCH v3 rdma-next 08/10] RDMA/nldev: provide detailed MR information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 27, 2018 at 03:27:42PM -0700, Jason Gunthorpe wrote:
> On Tue, Feb 27, 2018 at 04:21:36PM -0600, Steve Wise wrote:
> > >
> > > On Mon, Feb 26, 2018 at 03:22:42PM -0800, Steve Wise wrote:
> > >
> > > > +static int fill_res_mr_entry(struct sk_buff *msg, struct
> > netlink_callback
> > > *cb,
> > > > +			     struct rdma_restrack_entry *res, uint32_t port)
> > > > +{
> > > > +	struct ib_mr *mr = container_of(res, struct ib_mr, res);
> > > > +	struct nlattr *entry_attr;
> > > > +
> > > > +	entry_attr = nla_nest_start(msg,
> > > RDMA_NLDEV_ATTR_RES_MR_ENTRY);
> > > > +	if (!entry_attr)
> > > > +		goto out;
> > > > +
> > > > +	if (netlink_capable(cb->skb, CAP_NET_ADMIN)) {
> > > > +		if (nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_RKEY, mr-
> > > >rkey))
> > > > +			goto err;
> > > > +		if (nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_LKEY, mr-
> > > >lkey))
> > > > +			goto err;
> > > > +		if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_RES_IOVA,
> > > > +				      mr->iova, 0))
> > >
> > > ?? is '0' right here? Expecting a defined attribute constant for padding.
> >
> >
> > What does the pad do exactly?  I replicated other code I saw that use 0 for
> > the pad.  But I can add a NLDEV_ATTR_RES_PAD if that is the correct way to
> > go.
>
> Sometimes netlink will try to align the u64s to 8 bytes in the skb. If
> it needs to make an alignment adjustment then it stuffs a dummy
> attribute with the given ID. The ID should never be used for any other
> attribute and must be ignored by userspace.
>
> Safest to put it in the general enum to ensure it isn't re-used.

It is already done but not really explicitly as you would like.
0 is equal to RDMA_NLDEV_ATTR_UNSPEC and user space is ignoring this
attribute.

Thanks

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux