All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Govindarajulu Varadarajan <_govind@gmx.com>,
	davem@davemloft.net, netdev@vger.kernel.org
Cc: ssujith@cisco.com, gvaradar@cisco.com, benve@cisco.com
Subject: Re: [PATCH net-next 4/8] enic: alloc/free rx_cpu_rmap
Date: Mon, 09 Jun 2014 22:44:56 +0400	[thread overview]
Message-ID: <539600A8.3010703@cogentembedded.com> (raw)
In-Reply-To: <1402338773-5996-5-git-send-email-_govind@gmx.com>

Hello.

On 06/09/2014 10:32 PM, Govindarajulu Varadarajan wrote:

> rx_cpu_rmap provides the reverse irq cpu affinity. This patch allocates and
> sets drivers netdev->rx_cpu_rmap accordingly.

> rx_cpu_rmap is set in enic_request_intr() which is called by enic_open and
> rx_cpu_rmap is freed in enic_free_intr() which is called by enic_stop.

> This is used by Accelerated RFS.

> Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
> ---
>   drivers/net/ethernet/cisco/enic/enic_main.c | 36 +++++++++++++++++++++++++++++
>   1 file changed, 36 insertions(+)

> diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
> index f32f828..f4508d9 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_main.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_main.c
[...]
> @@ -1192,6 +1195,33 @@ static void enic_calc_int_moderation(struct enic *enic, struct vnic_rq *rq)
>   	pkt_size_counter->small_pkt_bytes_cnt = 0;
>   }
>
> +#ifdef CONFIG_RFS_ACCEL
> +static void enic_free_rx_cpu_rmap(struct enic *enic)
> +{
> +	free_irq_cpu_rmap(enic->netdev->rx_cpu_rmap);
> +	enic->netdev->rx_cpu_rmap = NULL;
> +}
> +
> +static inline void enic_set_rx_cpu_rmap(struct enic *enic)

    No need to use *inline* in a .c file, the compiler should figure it out.

> +{
> +	int i, res;
> +
> +	if (vnic_dev_get_intr_mode(enic->vdev) == VNIC_DEV_INTR_MODE_MSIX) {
> +		enic->netdev->rx_cpu_rmap = alloc_irq_cpu_rmap(enic->rq_count);
> +		if (unlikely(!enic->netdev->rx_cpu_rmap))
> +			return;
> +		for (i = 0; i < enic->rq_count; i++) {
> +			res = irq_cpu_rmap_add(enic->netdev->rx_cpu_rmap,
> +					       enic->msix_entry[i].vector);
> +			if (unlikely(res)) {
> +				enic_free_rx_cpu_rmap(enic);
> +				return;
> +			}
> +		}
> +	}
> +}

    It's better to do the following here:

#else
static void enic_free_rx_cpu_rmap(struct enic *enic)
{
}
static void enic_set_rx_cpu_rmap(struct enic *enic)
{
}

> +#endif
> +
>   static int enic_poll_msix(struct napi_struct *napi, int budget)
>   {
>   	struct net_device *netdev = napi->dev;
> @@ -1267,6 +1297,9 @@ static void enic_free_intr(struct enic *enic)
>   	struct net_device *netdev = enic->netdev;
>   	unsigned int i;
>
> +#ifdef CONFIG_RFS_ACCEL
> +	enic_free_rx_cpu_rmap(enic);
> +#endif

    ... so that you can avoid #ifdef's at the call sites.

WBR, Sergei

  reply	other threads:[~2014-06-09 18:44 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-09 18:32 [PATCH net-next 0/8] enic updates Govindarajulu Varadarajan
2014-06-09 18:32 ` [PATCH net-next 1/8] flow_keys: Record IP layer protocol in skb_flow_dissect() Govindarajulu Varadarajan
2014-06-10 13:11   ` Daniel Borkmann
2014-06-10 14:08     ` Govindarajulu Varadarajan
2014-06-10 14:26       ` Eric Dumazet
2014-06-11 22:06         ` David Miller
2014-06-11 22:08           ` David Miller
2014-06-12  5:38             ` Govindarajulu Varadarajan
2014-06-19 18:06   ` Chema Gonzalez
2014-06-19 18:52     ` Govindarajulu Varadarajan
2014-06-24  5:29   ` Yinghai Lu
2014-06-26  6:34     ` Govindarajulu Varadarajan
2014-09-18 14:18       ` Or Gerlitz
2014-09-18 14:38         ` Eric Dumazet
2014-09-18 15:02         ` [PATCH net] net: sched: shrink struct qdisc_skb_cb to 28 bytes Eric Dumazet
2014-09-18 16:26           ` Stephen Hemminger
2014-09-18 16:32             ` Eric Dumazet
2014-09-18 18:00               ` Eric Dumazet
2014-09-18 18:07                 ` Joe Perches
2014-09-18 19:14                   ` Eric Dumazet
2014-09-18 19:31                     ` Joe Perches
2014-09-18 20:31                       ` Eric Dumazet
2014-09-18 21:28               ` Or Gerlitz
2014-09-18 22:29           ` [net] " Doug Ledford
2014-09-19 12:07             ` Or Gerlitz
2014-09-22 18:38             ` David Miller
2014-09-22 18:22           ` [PATCH net] " David Miller
2014-06-09 18:32 ` [PATCH net-next 2/8] enic: fix return value in _vnic_dev_cmd Govindarajulu Varadarajan
2014-06-09 18:32 ` [PATCH net-next 3/8] enic: devcmd for adding IP 5 tuple hardware filters Govindarajulu Varadarajan
2014-06-09 18:32 ` [PATCH net-next 4/8] enic: alloc/free rx_cpu_rmap Govindarajulu Varadarajan
2014-06-09 18:44   ` Sergei Shtylyov [this message]
2014-06-10 13:52     ` Govindarajulu Varadarajan
2014-06-10 15:00       ` Sergei Shtylyov
2014-06-09 18:32 ` [PATCH net-next 5/8] enic: Add Accelerated RFS support Govindarajulu Varadarajan
2014-06-09 18:32 ` [PATCH net-next 6/8] enic: fix lockdep around devcmd_lock Govindarajulu Varadarajan
2014-06-09 18:32 ` [PATCH net-next 7/8] enic: add low latency socket busy_poll support Govindarajulu Varadarajan

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=539600A8.3010703@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=_govind@gmx.com \
    --cc=benve@cisco.com \
    --cc=davem@davemloft.net \
    --cc=gvaradar@cisco.com \
    --cc=netdev@vger.kernel.org \
    --cc=ssujith@cisco.com \
    /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.