All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Faisal Latif <faisal.latif@intel.com>
Cc: dledford@redhat.com, linux-rdma@vger.kernel.org,
	netdev@vger.kernel.org, jeffrey.t.kirsher@intel.com,
	e1000-rdma@lists.sourceforge.net
Subject: Re: [PATCH 08/15] i40iw: add files for iwarp interface
Date: Thu, 17 Dec 2015 08:27:38 -0800	[thread overview]
Message-ID: <20151217162738.GA12875@infradead.org> (raw)
In-Reply-To: <1450295919-17292-9-git-send-email-faisal.latif@intel.com>

> +		i40iw_next_iw_state(iwqp, I40IW_QP_STATE_ERROR, 0, 0, 0);
> +
> +	if (!iwqp->user_mode) {
> +		if (iwqp->iwscq)
> +			i40iw_clean_cqes(iwqp, iwqp->iwscq);
> +		if ((iwqp->iwrcq) && (iwqp->iwrcq != iwqp->iwscq))

Please try to do a pass over your code and remove all these pointless
braces.

> +static int i40iw_setup_virt_qp(struct i40iw_device *iwdev,
> +			       struct i40iw_qp *iwqp,
> +			       struct i40iw_qp_init_info *init_info)
> +{
> +	struct i40iw_pbl *iwpbl = iwqp->iwpbl;
> +	struct i40iw_qp_mr *qpmr = &iwpbl->qp_mr;
> +	u64 *sq_base;
> +
> +	sq_base = kmap(qpmr->sq_page);
> +	iwqp->sq_kmapped = 1;


You must never use kmap for any long lived resource.  Just allocate
it it out of lowmem so that you don't need the kmap.

> +	ukinfo->rq = (u64 *)((u8 *)mem->va + (sqdepth * I40IW_QP_WQE_MIN_SIZE));
> +	info->rq_pa = (uintptr_t)((u8 *)mem->pa + (sqdepth * I40IW_QP_WQE_MIN_SIZE));
> +
> +	ukinfo->shadow_area = (u64 *)((u8 *)ukinfo->rq +
> +				      (rqdepth * I40IW_QP_WQE_MIN_SIZE));
> +	info->shadow_area_pa = info->rq_pa + (rqdepth * I40IW_QP_WQE_MIN_SIZE);

Can you please try to get away with less casts here?  Note that Linux does
use GCC extensions for void pointer arithmetics.  Even without that you
never need to use casts to or from void pointers.  All this happes in
lots of places in the code, so a little audit would be useful.

> +/**
> + * i40iw_alloc_mw - Allocate memory window
> + * @ibpd: protection domain
> + * @type: memory window type
> + */
> +static struct ib_mw *i40iw_alloc_mw(struct ib_pd *ibpd,
> +				    enum ib_mw_type type)
> +{
> +	return ERR_PTR(-ENOSYS);
> +}
> +
> +/**
> + * i40iw_dealloc_mw - Free a memory window
> + * @ibmw: memory window to free
> + */
> +static int i40iw_dealloc_mw(struct ib_mw *ibmw)
> +{
> +	return -EIO;
> +}
> +
> +/**
> + * i40iw_bind_mw - Bind a memory window to a qp
> + * @ibqp: queue pair
> + * @ibmw: memory window
> + * @ibmw_bind: pointer to bind structure
> + */
> +static int i40iw_bind_mw(struct ib_qp *ibqp,
> +			 struct ib_mw *ibmw,
> +			 struct ib_mw_bind *ibmw_bind)
> +{
> +	return -ENOSYS;
> +}

There shouldn't be any need to stub all these out.

> +/**
> + * i40iw_init_ofa_device - initialization of iwarp device
> + * @iwdev: iwarp device
> + */
> +static struct i40iw_ib_device *i40iw_init_ofa_device(struct i40iw_device *iwdev)

Where is that weird ofa prefix coming from?

> +	iwibdev->ibdev.reg_phys_mr = i40iw_reg_phys_mr;

Please don't add phys MR support in new drivers, it's about to
disappear.

> +	iwibdev->ibdev.detach_mcast = NULL;
> +	iwibdev->ibdev.attach_mcast = NULL;
> +	iwibdev->ibdev.get_protocol_stats = i40iw_get_protocol_stats;
> +	iwibdev->ibdev.process_mad = NULL;

All the unused fields should already be zeroed.

  parent reply	other threads:[~2015-12-17 16:27 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-16 19:58 [PATCH 00/15] add Intel(R) X722 iWARP driver Faisal Latif
2015-12-16 19:58 ` [PATCH 01/15] i40e: Add support for client interface for IWARP driver Faisal Latif
2015-12-16 19:58   ` [PATCH 02/15] i40iw: add main, hdr, status Faisal Latif
2015-12-16 19:58     ` [PATCH 03/15] i40iw: add connection management code Faisal Latif
     [not found]       ` <1450295919-17292-4-git-send-email-faisal.latif-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-12-16 19:58         ` [PATCH 04/15] i40iw: add puda code Faisal Latif
2015-12-16 19:58           ` [PATCH 05/15] i40iw: add pble resource files Faisal Latif
     [not found]             ` <1450295919-17292-6-git-send-email-faisal.latif-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-12-16 19:58               ` [PATCH 06/15] i40iw: add hmc " Faisal Latif
     [not found]                 ` <1450295919-17292-7-git-send-email-faisal.latif-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-12-16 19:58                   ` [PATCH 07/15] i40iw: add hw and utils files Faisal Latif
     [not found]                     ` <1450295919-17292-8-git-send-email-faisal.latif-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-12-16 19:58                       ` [PATCH 08/15] i40iw: add files for iwarp interface Faisal Latif
2015-12-16 19:58                         ` [PATCH 09/15] i40iw: add file to handle cqp calls Faisal Latif
2015-12-16 19:58                           ` [PATCH 10/15] i40iw: add hardware related header files Faisal Latif
2015-12-16 19:58                             ` [PATCH 11/15] i40iw: add X722 register file Faisal Latif
2015-12-16 19:58                               ` [PATCH 12/15] i40iw: user kernel shared files Faisal Latif
2015-12-16 19:58                                 ` [PATCH 13/15] i40iw: virtual channel handling files Faisal Latif
2015-12-16 19:58                                   ` [PATCH 14/15] i40iw: Kconfig and Kbuild for iwarp module Faisal Latif
2015-12-16 19:58                                     ` [PATCH 15/15] i40iw: changes for build of i40iw module Faisal Latif
     [not found]                                       ` <1450295919-17292-16-git-send-email-faisal.latif-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-12-16 20:34                                         ` kbuild test robot
2015-12-16 20:34                                           ` kbuild test robot
2015-12-16 20:53                                         ` Christoph Hellwig
2015-12-17  5:14                                         ` kbuild test robot
2015-12-17  5:14                                           ` kbuild test robot
2015-12-17 16:27                         ` Christoph Hellwig [this message]
2015-12-17 16:07                       ` [PATCH 07/15] i40iw: add hw and utils files Christoph Hellwig
     [not found]     ` <1450295919-17292-3-git-send-email-faisal.latif-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-12-16 20:31       ` [PATCH 02/15] i40iw: add main, hdr, status Joe Perches
2015-12-16 20:26   ` [PATCH 01/15] i40e: Add support for client interface for IWARP driver Joe Perches
     [not found] ` <1450295919-17292-1-git-send-email-faisal.latif-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-12-16 21:27   ` [PATCH 00/15] add Intel(R) X722 iWARP driver Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151217162738.GA12875@infradead.org \
    --to=hch@infradead.org \
    --cc=dledford@redhat.com \
    --cc=e1000-rdma@lists.sourceforge.net \
    --cc=faisal.latif@intel.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.