DPDK patches and discussions
 help / color / mirror / Atom feed
From: Neil Horman <nhorman@tuxdriver.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] librte_pmd_af_packet: add compile-time checks for kernel-specific options
Date: Thu, 4 Dec 2014 22:46:46 -0500	[thread overview]
Message-ID: <20141205034646.GA6671@localhost.localdomain> (raw)
In-Reply-To: <1417729325-9410-1-git-send-email-linville@tuxdriver.com>

On Thu, Dec 04, 2014 at 04:42:05PM -0500, John W. Linville wrote:
> This allows the PMD to compile with kernels that don't support the
> options in question.  The "#if defined(...)" lines are a bit ugly,
> but I don't know of any better way to accomplish the task.
> 
> Signed-off-by: John W. Linville <linville@tuxdriver.com>
> ---
>  lib/librte_pmd_af_packet/rte_eth_af_packet.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/librte_pmd_af_packet/rte_eth_af_packet.c b/lib/librte_pmd_af_packet/rte_eth_af_packet.c
> index 3b5bd5840f51..d0fb3eb32e44 100644
> --- a/lib/librte_pmd_af_packet/rte_eth_af_packet.c
> +++ b/lib/librte_pmd_af_packet/rte_eth_af_packet.c
> @@ -444,9 +444,9 @@ rte_pmd_init_internals(const char *name,
>  	struct tpacket_req *req;
>  	struct pkt_rx_queue *rx_queue;
>  	struct pkt_tx_queue *tx_queue;
> -	int rc, tpver, discard, bypass;
> +	int rc, qsockfd, tpver, discard;
>  	unsigned int i, q, rdsize;
> -	int qsockfd, fanout_arg;
> +	int fanout_arg __rte_unused, bypass __rte_unused;
>  
>  	for (k_idx = 0; k_idx < kvlist->count; k_idx++) {
>  		pair = &kvlist->pairs[k_idx];
> @@ -519,9 +519,13 @@ rte_pmd_init_internals(const char *name,
>  	sockaddr.sll_protocol = htons(ETH_P_ALL);
>  	sockaddr.sll_ifindex = (*internals)->if_index;
>  
> +#if defined(PACKET_FANOUT)
>  	fanout_arg = (getpid() ^ (*internals)->if_index) & 0xffff;
> -	fanout_arg |= (PACKET_FANOUT_HASH | PACKET_FANOUT_FLAG_DEFRAG |
> -	               PACKET_FANOUT_FLAG_ROLLOVER) << 16;
> +	fanout_arg |= (PACKET_FANOUT_HASH | PACKET_FANOUT_FLAG_DEFRAG) << 16;
> +#if defined(PACKET_FANOUT_FLAG_ROLLOVER)
> +	fanout_arg |= PACKET_FANOUT_FLAG_ROLLOVER << 16;
> +#endif
> +#endif
>  
>  	for (q = 0; q < nb_queues; q++) {
>  		/* Open an AF_PACKET socket for this queue... */
> @@ -553,6 +557,7 @@ rte_pmd_init_internals(const char *name,
>  			goto error;
>  		}
>  
> +#if defined(PACKET_QDISC_BYPASS)
>  		bypass = 1;
>  		rc = setsockopt(qsockfd, SOL_PACKET, PACKET_QDISC_BYPASS,
>  				&bypass, sizeof(bypass));
> @@ -563,6 +568,7 @@ rte_pmd_init_internals(const char *name,
>  			        pair->value);
>  			goto error;
>  		}
> +#endif
>  
>  		rc = setsockopt(qsockfd, SOL_PACKET, PACKET_RX_RING, req, sizeof(*req));
>  		if (rc == -1) {
> @@ -623,6 +629,7 @@ rte_pmd_init_internals(const char *name,
>  			goto error;
>  		}
>  
> +#if defined(PACKET_FANOUT)
>  		rc = setsockopt(qsockfd, SOL_PACKET, PACKET_FANOUT,
>  				&fanout_arg, sizeof(fanout_arg));
>  		if (rc == -1) {
> @@ -631,6 +638,7 @@ rte_pmd_init_internals(const char *name,
>  				"for %s\n", name, pair->value);
>  			goto error;
>  		}
> +#endif
>  	}
>  
>  	/* reserve an ethdev entry */
> -- 
> 1.9.3
> 
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>

  reply	other threads:[~2014-12-05  3:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-04 21:42 John W. Linville
2014-12-05  3:46 ` Neil Horman [this message]
2014-12-05  9:30 ` Thomas Monjalon
2014-12-05 16:24   ` John W. Linville
2014-12-05 16:37     ` Thomas Monjalon
2014-12-05 17:29       ` [dpdk-dev] Accessing Virtual Function Device on Guest Machine using VFIO Aashima Arora
2014-12-05 18:08         ` Thomas Monjalon
2014-12-05 18:42           ` Neil Horman
2014-12-05 21:14       ` [dpdk-dev] [PATCH] librte_pmd_af_packet: add compile-time checks for kernel-specific options Thomas Monjalon

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=20141205034646.GA6671@localhost.localdomain \
    --to=nhorman@tuxdriver.com \
    --cc=dev@dpdk.org \
    --cc=linville@tuxdriver.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).