Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f29b46d authored by Ira Weiny's avatar Ira Weiny Committed by Roland Dreier
Browse files

IB/mad: add new ioctl to ABI to support new registration options



Registrations options are specified through flags.  Definitions of flags will
be in subsequent patches.

Signed-off-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent 9ad13a42
Loading
Loading
Loading
Loading
+9 −4
Original line number Original line Diff line number Diff line
@@ -26,6 +26,11 @@ Creating MAD agents
  ioctl.  Also, all agents registered through a file descriptor will
  ioctl.  Also, all agents registered through a file descriptor will
  be unregistered when the descriptor is closed.
  be unregistered when the descriptor is closed.


  2014 -- a new registration ioctl is now provided which allows additional
       fields to be provided during registration.
       Users of this registration call are implicitly setting the use of
       pkey_index (see below).

Receiving MADs
Receiving MADs


  MADs are received using read().  The receive side now supports
  MADs are received using read().  The receive side now supports
@@ -104,10 +109,10 @@ P_Key Index Handling
  The old ib_umad interface did not allow setting the P_Key index for
  The old ib_umad interface did not allow setting the P_Key index for
  MADs that are sent and did not provide a way for obtaining the P_Key
  MADs that are sent and did not provide a way for obtaining the P_Key
  index of received MADs.  A new layout for struct ib_user_mad_hdr
  index of received MADs.  A new layout for struct ib_user_mad_hdr
  with a pkey_index member has been defined; however, to preserve
  with a pkey_index member has been defined; however, to preserve binary
  binary compatibility with older applications, this new layout will
  compatibility with older applications, this new layout will not be used
  not be used unless the IB_USER_MAD_ENABLE_PKEY ioctl is called
  unless one of IB_USER_MAD_ENABLE_PKEY or IB_USER_MAD_REGISTER_AGENT2 ioctl's
  before a file descriptor is used for anything else.
  are called before a file descriptor is used for anything else.


  In September 2008, the IB_USER_MAD_ABI_VERSION will be incremented
  In September 2008, the IB_USER_MAD_ABI_VERSION will be incremented
  to 6, the new layout of struct ib_user_mad_hdr will be used by
  to 6, the new layout of struct ib_user_mad_hdr will be used by
+2 −2
Original line number Original line Diff line number Diff line
@@ -161,7 +161,7 @@ int ib_agent_port_open(struct ib_device *device, int port_num)
		port_priv->agent[0] = ib_register_mad_agent(device, port_num,
		port_priv->agent[0] = ib_register_mad_agent(device, port_num,
							    IB_QPT_SMI, NULL, 0,
							    IB_QPT_SMI, NULL, 0,
							    &agent_send_handler,
							    &agent_send_handler,
							    NULL, NULL);
							    NULL, NULL, 0);
		if (IS_ERR(port_priv->agent[0])) {
		if (IS_ERR(port_priv->agent[0])) {
			ret = PTR_ERR(port_priv->agent[0]);
			ret = PTR_ERR(port_priv->agent[0]);
			goto error2;
			goto error2;
@@ -172,7 +172,7 @@ int ib_agent_port_open(struct ib_device *device, int port_num)
	port_priv->agent[1] = ib_register_mad_agent(device, port_num,
	port_priv->agent[1] = ib_register_mad_agent(device, port_num,
						    IB_QPT_GSI, NULL, 0,
						    IB_QPT_GSI, NULL, 0,
						    &agent_send_handler,
						    &agent_send_handler,
						    NULL, NULL);
						    NULL, NULL, 0);
	if (IS_ERR(port_priv->agent[1])) {
	if (IS_ERR(port_priv->agent[1])) {
		ret = PTR_ERR(port_priv->agent[1]);
		ret = PTR_ERR(port_priv->agent[1]);
		goto error3;
		goto error3;
+3 −2
Original line number Original line Diff line number Diff line
@@ -3753,7 +3753,7 @@ static void cm_add_one(struct ib_device *ib_device)
	struct cm_port *port;
	struct cm_port *port;
	struct ib_mad_reg_req reg_req = {
	struct ib_mad_reg_req reg_req = {
		.mgmt_class = IB_MGMT_CLASS_CM,
		.mgmt_class = IB_MGMT_CLASS_CM,
		.mgmt_class_version = IB_CM_CLASS_VERSION
		.mgmt_class_version = IB_CM_CLASS_VERSION,
	};
	};
	struct ib_port_modify port_modify = {
	struct ib_port_modify port_modify = {
		.set_port_cap_mask = IB_PORT_CM_SUP
		.set_port_cap_mask = IB_PORT_CM_SUP
@@ -3801,7 +3801,8 @@ static void cm_add_one(struct ib_device *ib_device)
							0,
							0,
							cm_send_handler,
							cm_send_handler,
							cm_recv_handler,
							cm_recv_handler,
							port);
							port,
							0);
		if (IS_ERR(port->mad_agent))
		if (IS_ERR(port->mad_agent))
			goto error2;
			goto error2;


+3 −1
Original line number Original line Diff line number Diff line
@@ -198,7 +198,8 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
					   u8 rmpp_version,
					   u8 rmpp_version,
					   ib_mad_send_handler send_handler,
					   ib_mad_send_handler send_handler,
					   ib_mad_recv_handler recv_handler,
					   ib_mad_recv_handler recv_handler,
					   void *context)
					   void *context,
					   u32 registration_flags)
{
{
	struct ib_mad_port_private *port_priv;
	struct ib_mad_port_private *port_priv;
	struct ib_mad_agent *ret = ERR_PTR(-EINVAL);
	struct ib_mad_agent *ret = ERR_PTR(-EINVAL);
@@ -359,6 +360,7 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
	mad_agent_priv->agent.context = context;
	mad_agent_priv->agent.context = context;
	mad_agent_priv->agent.qp = port_priv->qp_info[qpn].qp;
	mad_agent_priv->agent.qp = port_priv->qp_info[qpn].qp;
	mad_agent_priv->agent.port_num = port_num;
	mad_agent_priv->agent.port_num = port_num;
	mad_agent_priv->agent.flags = registration_flags;
	spin_lock_init(&mad_agent_priv->lock);
	spin_lock_init(&mad_agent_priv->lock);
	INIT_LIST_HEAD(&mad_agent_priv->send_list);
	INIT_LIST_HEAD(&mad_agent_priv->send_list);
	INIT_LIST_HEAD(&mad_agent_priv->wait_list);
	INIT_LIST_HEAD(&mad_agent_priv->wait_list);
+1 −1
Original line number Original line Diff line number Diff line
@@ -1184,7 +1184,7 @@ static void ib_sa_add_one(struct ib_device *device)
		sa_dev->port[i].agent =
		sa_dev->port[i].agent =
			ib_register_mad_agent(device, i + s, IB_QPT_GSI,
			ib_register_mad_agent(device, i + s, IB_QPT_GSI,
					      NULL, 0, send_handler,
					      NULL, 0, send_handler,
					      recv_handler, sa_dev);
					      recv_handler, sa_dev, 0);
		if (IS_ERR(sa_dev->port[i].agent))
		if (IS_ERR(sa_dev->port[i].agent))
			goto err;
			goto err;


Loading