netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: <netdev@vger.kernel.org>
Cc: <linux-net-drivers@solarflare.com>
Subject: [PATCHv2 ethtool 2/3] rxclass: Use RX_CLS_LOC_{ANY,SPECIAL} in place of RX_CLS_LOC_UNSPEC
Date: Tue, 3 Jan 2012 22:24:42 +0000	[thread overview]
Message-ID: <1325629482.2832.47.camel@bwh-desktop> (raw)
In-Reply-To: <1325627819.2832.31.camel@bwh-desktop>

The macro RX_CLS_LOC_ANY is now defined in ethtool(-copy).h with the
same intended semantics and same value as RX_CLS_LOC_UNSPEC.

Change some equality tests to check for the flag RX_CLS_LOC_SPECIAL,
to allow for future support of other special location value.

Remove the special case for RX_CLS_LOC_UNSPEC in
rxclass_print_nfc_rule(), since it is dead code.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 ethtool.c  |    2 +-
 internal.h |    2 --
 rxclass.c  |   11 ++++-------
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/ethtool.c b/ethtool.c
index d21eaea..d0cc7d4 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -2719,7 +2719,7 @@ static int flow_spec_to_ntuple(struct ethtool_rx_flow_spec *fsp,
 	size_t i;
 
 	/* verify location is not specified */
-	if (fsp->location != RX_CLS_LOC_UNSPEC)
+	if (fsp->location != RX_CLS_LOC_ANY)
 		return -1;
 
 	/* verify ring cookie can transfer to action */
diff --git a/internal.h b/internal.h
index cb126b3..867c0ea 100644
--- a/internal.h
+++ b/internal.h
@@ -86,8 +86,6 @@ static inline int test_bit(unsigned int nr, const unsigned long *addr)
 #define SIOCETHTOOL     0x8946
 #endif
 
-#define	RX_CLS_LOC_UNSPEC	0xffffffffUL
-
 /* Context for sub-commands */
 struct cmd_context {
 	const char *devname;	/* net device name */
diff --git a/rxclass.c b/rxclass.c
index 1980d0e..9c7456f 100644
--- a/rxclass.c
+++ b/rxclass.c
@@ -68,10 +68,7 @@ static void rxclass_print_nfc_rule(struct ethtool_rx_flow_spec *fsp)
 	unsigned char	*smac, *smacm, *dmac, *dmacm;
 	__u32		flow_type;
 
-	if (fsp->location != RX_CLS_LOC_UNSPEC)
-		fprintf(stdout,	"Filter: %d\n", fsp->location);
-	else
-		fprintf(stdout,	"Filter: Unspecified\n");
+	fprintf(stdout,	"Filter: %d\n", fsp->location);
 
 	flow_type = fsp->flow_type & ~FLOW_EXT;
 
@@ -465,7 +462,7 @@ int rxclass_rule_ins(struct cmd_context *ctx,
 	 * if location is unspecified pull rules from device
 	 * and allocate a free rule for our use
 	 */
-	if (loc == RX_CLS_LOC_UNSPEC) {
+	if (loc & RX_CLS_LOC_SPECIAL) {
 		err = rmgr_set_location(ctx, fsp);
 		if (err < 0)
 			return err;
@@ -477,7 +474,7 @@ int rxclass_rule_ins(struct cmd_context *ctx,
 	err = send_ioctl(ctx, &nfccmd);
 	if (err < 0)
 		perror("rmgr: Cannot insert RX class rule");
-	else if (loc == RX_CLS_LOC_UNSPEC)
+	else if (loc & RX_CLS_LOC_SPECIAL)
 		printf("Added rule with ID %d\n", fsp->location);
 
 	return 0;
@@ -998,7 +995,7 @@ int rxclass_parse_ruleopts(struct cmd_context *ctx,
 
 	memset(p, 0, sizeof(*fsp));
 	fsp->flow_type = flow_type;
-	fsp->location = RX_CLS_LOC_UNSPEC;
+	fsp->location = RX_CLS_LOC_ANY;
 
 	for (i = 1; i < argc;) {
 		const struct rule_opts *opt;
-- 
1.7.4.4



-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

  parent reply	other threads:[~2012-01-03 22:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-03 21:56 [PATCHv2 net-next 0/8] RX NFC support for hash-based filters Ben Hutchings
2012-01-03 21:59 ` [PATCHv2 net-next 1/8] gianfar: Reject out-of-range RX NFC locations Ben Hutchings
2012-01-03 22:04 ` [PATCHv2 net-next 2/8] ethtool: Allow drivers to select RX NFC rule locations Ben Hutchings
2012-01-03 22:05 ` [PATCHv2 net-next 3/8] sfc: Change filter ID generation to satisfy priority semantics of RX NFC Ben Hutchings
2012-01-03 22:05 ` [PATCHv2 net-next 4/8] sfc: Use consistent types for filter IDs, indices and search depths Ben Hutchings
2012-01-03 22:05 ` [PATCHv2 net-next 5/8] sfc: Add support for retrieving and removing filters by ID Ben Hutchings
2012-01-03 22:05 ` [PATCHv2 net-next 6/8] sfc: Implement ethtool RX NFC rules API instead of n-tuple API Ben Hutchings
2012-01-03 22:05 ` [PATCHv2 net-next 7/8] sfc: Remove now-unused filter function Ben Hutchings
2012-01-03 22:07 ` [PATCHv2 net-next 8/8] ethtool: Remove ethtool_ops::set_rx_ntuple operation Ben Hutchings
2012-01-03 22:24 ` [PATCHv2 ethtool 1/3] ethtool-copy.h: sync with net-next Ben Hutchings
2012-01-03 22:24 ` Ben Hutchings [this message]
2012-01-03 22:25 ` [PATCHv2 ethtool 3/3] rxclass: Allow driver to select RX NFC rule location Ben Hutchings
2012-01-04 19:11 ` [PATCHv2 net-next 0/8] RX NFC support for hash-based filters David Miller
2012-01-04 21:39   ` Ben Hutchings

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=1325629482.2832.47.camel@bwh-desktop \
    --to=bhutchings@solarflare.com \
    --cc=linux-net-drivers@solarflare.com \
    --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 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).