diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2012-01-03 20:21:45 +0000 |
---|---|---|
committer | Ben Hutchings <bhutchings@solarflare.com> | 2012-01-12 16:33:35 +0000 |
commit | 578e6a51ad8b778794409974cfd4b3d12fe6f297 (patch) | |
tree | 6c04f6de3013158e61a11ea1a957741cb3ac4a45 /rxclass.c | |
parent | 674bdece3d95cc20f25e9bd38c1692fa342109fb (diff) | |
download | ethtool-578e6a51ad8b778794409974cfd4b3d12fe6f297.tar.gz |
rxclass: Use RX_CLS_LOC_{ANY,SPECIAL} in place of RX_CLS_LOC_UNSPEC
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>
Diffstat (limited to 'rxclass.c')
-rw-r--r-- | rxclass.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -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; |