Re: [PATCH 2/9] RDMA/uverbs: Split UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE

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

 



On Tue, Jun 26, 2018 at 04:07:13PM +0000, Ruhl, Michael J wrote:
> >From: Jason Gunthorpe [mailto:jgg@xxxxxxxx]
> >Sent: Monday, June 25, 2018 6:13 PM
> >To: linux-rdma@xxxxxxxxxxxxxxx
> >Cc: Ruhl, Michael J <michael.j.ruhl@xxxxxxxxx>; Leon Romanovsky
> ><leonro@xxxxxxxxxxxx>; Guy Levi <guyle@xxxxxxxxxxxx>; Jason
> >Gunthorpe <jgg@xxxxxxxxxxxx>
> >Subject: [PATCH 2/9] RDMA/uverbs: Split
> >UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE
> >
> >From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> >
> >Two methods are sharing the same attribute constant, but the attribute
> >definitions are not the same. This should not have been done, instead
> >split them into two attributes with the same number.
> >
> >Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> > .../infiniband/core/uverbs_std_types_flow_action.c   | 12 ++++++++----
> > include/uapi/rdma/ib_user_ioctl_cmds.h               |  7 ++++++-
> > 2 files changed, 14 insertions(+), 5 deletions(-)
> >
> >diff --git a/drivers/infiniband/core/uverbs_std_types_flow_action.c
> >b/drivers/infiniband/core/uverbs_std_types_flow_action.c
> >index a7be51cf2e42ca..e3d282cb7bf2ba 100644
> >+++ b/drivers/infiniband/core/uverbs_std_types_flow_action.c
> >@@ -320,7 +320,8 @@ static int
> >UVERBS_HANDLER(UVERBS_METHOD_FLOW_ACTION_ESP_CREATE)(struct
> >ib_device
> > 		return ret;
> >
> > 	/* No need to check as this attribute is marked as MANDATORY */
> >-	uobj = uverbs_attr_get_uobject(attrs,
> >UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE);
> >+	uobj = uverbs_attr_get_uobject(
> >+		attrs, UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_HANDLE);
> > 	action = ib_dev->create_flow_action_esp(ib_dev, &esp_attr.hdr,
> >attrs);
> > 	if (IS_ERR(action))
> > 		return PTR_ERR(action);
> >@@ -350,7 +351,8 @@ static int
> >UVERBS_HANDLER(UVERBS_METHOD_FLOW_ACTION_ESP_MODIFY)(struct
> >ib_device
> > 	if (ret)
> > 		return ret;
> >
> >-	uobj = uverbs_attr_get_uobject(attrs,
> >UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE);
> >+	uobj = uverbs_attr_get_uobject(
> >+		attrs, UVERBS_ATTR_MODIFY_FLOW_ACTION_ESP_HANDLE);
> > 	action = uobj->object;
> >
> > 	if (action->type != IB_FLOW_ACTION_ESP)
> >@@ -389,7 +391,8 @@ static const struct uverbs_attr_spec
> >uverbs_flow_action_esp_replay[] = {
> > };
> >
> > static
> >DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_FLOW_ACTION_ES
> >P_CREATE,
> >-	&UVERBS_ATTR_IDR(UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE,
> >UVERBS_OBJECT_FLOW_ACTION,
> >+
> >	&UVERBS_ATTR_IDR(UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_H
> >ANDLE,
> >+			 UVERBS_OBJECT_FLOW_ACTION,
> > 			 UVERBS_ACCESS_NEW,
> > 			 UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
> > 	&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_FLOW_ACTION_ESP_ATTRS,
> >@@ -406,7 +409,8 @@ static
> >DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_FLOW_ACTION_ES
> >P_CREATE,
> > 			    UVERBS_ATTR_STRUCT(struct
> >ib_uverbs_flow_action_esp_encap, type)));
> >
> > static
> >DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_FLOW_ACTION_ES
> >P_MODIFY,
> >-	&UVERBS_ATTR_IDR(UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE,
> >UVERBS_OBJECT_FLOW_ACTION,
> >+
> >	&UVERBS_ATTR_IDR(UVERBS_ATTR_MODIFY_FLOW_ACTION_ESP_H
> >ANDLE,
> >+			 UVERBS_OBJECT_FLOW_ACTION,
> > 			 UVERBS_ACCESS_WRITE,
> > 			 UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
> > 	&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_FLOW_ACTION_ESP_ATTRS,
> >diff --git a/include/uapi/rdma/ib_user_ioctl_cmds.h
> >b/include/uapi/rdma/ib_user_ioctl_cmds.h
> >index 888ac5975a6c24..2c881aaf05c2a6 100644
> >+++ b/include/uapi/rdma/ib_user_ioctl_cmds.h
> >@@ -79,7 +79,7 @@ enum uverbs_attrs_destroy_cq_cmd_attr_ids {
> > };
> >
> > enum uverbs_attrs_create_flow_action_esp {
> >-	UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE,
> >+	UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_HANDLE,
> > 	UVERBS_ATTR_FLOW_ACTION_ESP_ATTRS,
> > 	UVERBS_ATTR_FLOW_ACTION_ESP_ESN,
> > 	UVERBS_ATTR_FLOW_ACTION_ESP_KEYMAT,
> >@@ -87,6 +87,11 @@ enum uverbs_attrs_create_flow_action_esp {
> > 	UVERBS_ATTR_FLOW_ACTION_ESP_ENCAP,
> > };
> >
> >+enum uverbs_attrs_modify_flow_action_esp {
> >+	UVERBS_ATTR_MODIFY_FLOW_ACTION_ESP_HANDLE =
> >+		UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_HANDLE,
> >+};
> >+
> > enum uverbs_attrs_destroy_flow_action_esp {
> > 	UVERBS_ATTR_DESTROY_FLOW_ACTION_HANDLE,
> 
> So should this be added to this patch:
> 
> 	UVERBS_ATTR_DESTROY_FLOW_ACTION_HANDLE = UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_HANDLE,
> 
> As well?

No, this is only splitting UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE into
CREATE and MODIFY names without changing the constant.

This is because only CREATE and MODIFY used the
UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE name.

As above destroy already had its own name so isn't really problematic.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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