From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: [PATCH ethtool v2 3/3] ethtool: Add support for action value -2 (wake-up filter) Date: Thu, 9 Aug 2018 11:04:02 -0700 Message-ID: <20180809180402.19430-4-f.fainelli@gmail.com> References: <20180809180402.19430-1-f.fainelli@gmail.com> Cc: davem@davemloft.net, andrew@lunn.ch, Florian Fainelli To: netdev@vger.kernel.org, linville@tuxdriver.com Return-path: Received: from mail-pg1-f193.google.com ([209.85.215.193]:39094 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727025AbeHIUaY (ORCPT ); Thu, 9 Aug 2018 16:30:24 -0400 Received: by mail-pg1-f193.google.com with SMTP id a11-v6so3106805pgw.6 for ; Thu, 09 Aug 2018 11:04:26 -0700 (PDT) In-Reply-To: <20180809180402.19430-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: Add the ability to program special filters using ethtool::rxnfc which are meant to be used for wake-up purposes (in conjuction with WAKE_FILTER) using the special action value: -2 (RX_CLS_FLOW_WAKE). Signed-off-by: Florian Fainelli --- ethtool.8.in | 1 + rxclass.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ethtool.8.in b/ethtool.8.in index 3eb9005ada48..97c7330fd373 100644 --- a/ethtool.8.in +++ b/ethtool.8.in @@ -871,6 +871,7 @@ Specifies the Rx queue to send packets to, or some other action. nokeep; lB l. -1 Drop the matched flow +-2 Use the matched flow as a Wake-on-LAN filter 0 or higher Rx queue to route the flow .TE .TP diff --git a/rxclass.c b/rxclass.c index 42d122d1ed86..79972651e706 100644 --- a/rxclass.c +++ b/rxclass.c @@ -251,7 +251,11 @@ static void rxclass_print_nfc_rule(struct ethtool_rx_flow_spec *fsp, if (fsp->flow_type & FLOW_RSS) fprintf(stdout, "\tRSS Context ID: %u\n", rss_context); - if (fsp->ring_cookie != RX_CLS_FLOW_DISC) { + if (fsp->ring_cookie == RX_CLS_FLOW_DISC) { + fprintf(stdout, "\tAction: Drop\n"); + } else if (fsp->ring_cookie == RX_CLS_FLOW_WAKE) { + fprintf(stdout, "\tAction: Wake-on-LAN\n"); + } else { u64 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie); u64 queue = ethtool_get_flow_spec_ring(fsp->ring_cookie); @@ -266,8 +270,6 @@ static void rxclass_print_nfc_rule(struct ethtool_rx_flow_spec *fsp, else fprintf(stdout, "\tAction: Direct to queue %llu\n", queue); - } else { - fprintf(stdout, "\tAction: Drop\n"); } fprintf(stdout, "\n"); -- 2.17.1