[openib-general] [PATCH] mad.c/agent.c: use ib_get_dma_mr

Hal Rosenstock halr at voltaire.com
Mon Nov 8 11:28:39 PST 2004


On Mon, 2004-11-08 at 13:55, Roland Dreier wrote:
> Convert mad.c and agent.c to use ib_get_dma_mr() instead of
> ib_reg_phys_mr().  This is simpler and is actually required on
> platforms such as sparc64 where DMA addresses may not match up with
> physical RAM addresses.
> 
> OK to commit?

OK by me with same comment in two places below:

> 
>  - Roland
> 
> Index: core/agent.c
> ===================================================================
> --- core/agent.c	(revision 1172)
> +++ core/agent.c	(working copy)
> @@ -281,15 +281,9 @@
>  	kfree(agent_send_wr);
>  }
>  
> -int ib_agent_port_open(struct ib_device *device, int port_num,
> -			      int phys_port_cnt)
> +int ib_agent_port_open(struct ib_device *device, int port_num)
>  {
>  	int ret;
> -	u64 iova = 0;
> -	struct ib_phys_buf buf_list = {
> -		.addr = 0,
> -		.size = (unsigned long) high_memory - PAGE_OFFSET
> -	};
>  	struct ib_agent_port_private *port_priv;
>  	struct ib_mad_reg_req reg_req;
>  	unsigned long flags;
> @@ -312,7 +306,6 @@
>  
>  	memset(port_priv, 0, sizeof *port_priv);
>  	port_priv->port_num = port_num;
> -	port_priv->phys_port_cnt = phys_port_cnt;
>  	port_priv->wr_id = 0;
>  	spin_lock_init(&port_priv->send_list_lock);
>  	INIT_LIST_HEAD(&port_priv->send_posted_list);
> @@ -356,9 +349,8 @@
>  		goto error4;
>  	}
>  
> -	port_priv->mr = ib_reg_phys_mr(port_priv->dr_smp_agent->qp->pd,
> -				      &buf_list, 1,
> -				       IB_ACCESS_LOCAL_WRITE, &iova);
> +	port_priv->mr = ib_get_dma_mr(port_priv->dr_smp_agent->qp->pd,
> +				      IB_ACCESS_LOCAL_WRITE);
>  	if (IS_ERR(port_priv->mr)) {
>  		printk(KERN_ERR SPFX "Couldn't register MR\n");

Should this message be changed ?

>  		ret = PTR_ERR(port_priv->mr);
> Index: core/mad.c
> ===================================================================
> --- core/mad.c	(revision 1172)
> +++ core/mad.c	(working copy)
> @@ -1844,11 +1844,6 @@
>  			    int port_num)
>  {
>  	int ret, cq_size;
> -	u64 iova = 0;
> -	struct ib_phys_buf buf_list = {
> -		.addr = 0,
> -		.size = (unsigned long) high_memory - PAGE_OFFSET
> -	};
>  	struct ib_mad_port_private *port_priv;
>  	unsigned long flags;
>  
> @@ -1890,8 +1885,7 @@
>  		goto error4;
>  	}
>  
> -	port_priv->mr = ib_reg_phys_mr(port_priv->pd, &buf_list, 1,
> -				       IB_ACCESS_LOCAL_WRITE, &iova);
> +	port_priv->mr = ib_get_dma_mr(port_priv->pd, IB_ACCESS_LOCAL_WRITE);
>  	if (IS_ERR(port_priv->mr)) {
>  		printk(KERN_ERR PFX "Couldn't register ib_mad MR\n");


Should this message be changed ?

>  		ret = PTR_ERR(port_priv->mr);





More information about the general mailing list