netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edward Cree <ecree@solarflare.com>
To: <linux-net-drivers@solarflare.com>, <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>
Subject: [PATCH v2 net-next 02/15] sfc: determine flag word automatically in efx_has_cap()
Date: Mon, 29 Jun 2020 14:32:46 +0100	[thread overview]
Message-ID: <07a65e3d-41de-f9ad-ae16-7650505e8b1e@solarflare.com> (raw)
In-Reply-To: <3750523f-1c2f-628d-1f71-39b355cf6661@solarflare.com>

Now that we have an _OFST definition for each individual flag bit,
 callers of efx_has_cap() don't need to specify which flag word it's
 in; we can just use the flag name directly in MCDI_CAPABILITY_OFST.

Signed-off-by: Edward Cree <ecree@solarflare.com>
---
 drivers/net/ethernet/sfc/mcdi.h         | 5 ++---
 drivers/net/ethernet/sfc/mcdi_filters.c | 8 ++++----
 drivers/net/ethernet/sfc/ptp.c          | 2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h
index b107e4c00285..db9746a751d4 100644
--- a/drivers/net/ethernet/sfc/mcdi.h
+++ b/drivers/net/ethernet/sfc/mcdi.h
@@ -332,10 +332,9 @@ void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev);
 #define MCDI_CAPABILITY_OFST(field) \
 	MC_CMD_GET_CAPABILITIES_V4_OUT_ ## field ## _OFST
 
-/* field is FLAGS1 or FLAGS2 */
-#define efx_has_cap(efx, flag, field) \
+#define efx_has_cap(efx, field) \
 	efx->type->check_caps(efx, \
-			      MCDI_CAPABILITY(flag), \
+			      MCDI_CAPABILITY(field), \
 			      MCDI_CAPABILITY_OFST(field))
 
 void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len);
diff --git a/drivers/net/ethernet/sfc/mcdi_filters.c b/drivers/net/ethernet/sfc/mcdi_filters.c
index 455a62814fb9..7b39a3aa3a1a 100644
--- a/drivers/net/ethernet/sfc/mcdi_filters.c
+++ b/drivers/net/ethernet/sfc/mcdi_filters.c
@@ -828,7 +828,7 @@ static int efx_mcdi_filter_insert_def(struct efx_nic *efx,
 		efx_filter_set_uc_def(&spec);
 
 	if (encap_type) {
-		if (efx_has_cap(efx, VXLAN_NVGRE, FLAGS1))
+		if (efx_has_cap(efx, VXLAN_NVGRE))
 			efx_filter_set_encap_type(&spec, encap_type);
 		else
 			/*
@@ -1304,7 +1304,7 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining)
 	rc = efx_mcdi_filter_table_probe_matches(efx, table, false);
 	if (rc)
 		goto fail;
-	if (efx_has_cap(efx, VXLAN_NVGRE, FLAGS1))
+	if (efx_has_cap(efx, VXLAN_NVGRE))
 		rc = efx_mcdi_filter_table_probe_matches(efx, table, true);
 	if (rc)
 		goto fail;
@@ -1927,7 +1927,7 @@ static int efx_mcdi_filter_alloc_rss_context(struct efx_nic *efx, bool exclusive
 		return 0;
 	}
 
-	if (efx_has_cap(efx, RX_RSS_LIMITED, FLAGS1))
+	if (efx_has_cap(efx, RX_RSS_LIMITED))
 		return -EOPNOTSUPP;
 
 	MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_UPSTREAM_PORT_ID,
@@ -1948,7 +1948,7 @@ static int efx_mcdi_filter_alloc_rss_context(struct efx_nic *efx, bool exclusive
 	if (context_size)
 		*context_size = rss_spread;
 
-	if (efx_has_cap(efx, ADDITIONAL_RSS_MODES, FLAGS1))
+	if (efx_has_cap(efx, ADDITIONAL_RSS_MODES))
 		efx_mcdi_set_rss_context_flags(efx, ctx);
 
 	return 0;
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
index 04c7283d205e..15c08cae6ae6 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
@@ -352,7 +352,7 @@ static int efx_phc_enable(struct ptp_clock_info *ptp,
 
 bool efx_ptp_use_mac_tx_timestamps(struct efx_nic *efx)
 {
-	return efx_has_cap(efx, TX_MAC_TIMESTAMPING, FLAGS2);
+	return efx_has_cap(efx, TX_MAC_TIMESTAMPING);
 }
 
 /* PTP 'extra' channel is still a traffic channel, but we only create TX queues


  parent reply	other threads:[~2020-06-29 19:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 13:30 [PATCH v2 net-next 00/15] sfc: prerequisites for EF100 driver, part 1 Edward Cree
2020-06-29 13:32 ` [PATCH v2 net-next 01/15] sfc: update MCDI protocol headers Edward Cree
2020-06-29 13:32 ` Edward Cree [this message]
2020-06-29 13:33 ` [PATCH v2 net-next 03/15] sfc: extend bitfield macros up to POPULATE_DWORD_13 Edward Cree
2020-06-29 13:33 ` [PATCH v2 net-next 04/15] sfc: don't try to create more channels than we can have VIs Edward Cree
2020-06-29 13:34 ` [PATCH v2 net-next 05/15] sfc: refactor EF10 stats handling Edward Cree
2020-06-29 13:34 ` [PATCH v2 net-next 06/15] sfc: split up nic.h Edward Cree
2020-06-29 13:34 ` [PATCH v2 net-next 07/15] sfc: commonise ethtool link handling functions Edward Cree
2020-06-29 13:35 ` [PATCH v2 net-next 08/15] sfc: commonise ethtool NFC and RXFH/RSS functions Edward Cree
2020-06-29 13:35 ` [PATCH v2 net-next 09/15] sfc: commonise other ethtool bits Edward Cree
2020-06-29 13:35 ` [PATCH v2 net-next 10/15] sfc: commonise FC advertising Edward Cree
2020-06-29 13:35 ` [PATCH v2 net-next 11/15] sfc: track which BAR is mapped Edward Cree
2020-06-29 13:35 ` [PATCH v2 net-next 12/15] sfc: commonise PCI error handlers Edward Cree
2020-06-29 13:36 ` [PATCH v2 net-next 14/15] sfc: commonise ARFS handling Edward Cree
2020-06-29 13:36 ` [PATCH v2 net-next 15/15] sfc: extend common GRO interface to support CHECKSUM_COMPLETE Edward Cree
2020-06-29 13:39 ` [PATCH v2 net-next 13/15] sfc: commonise drain event handling Edward Cree
2020-06-30  0:30 ` [PATCH v2 net-next 00/15] sfc: prerequisites for EF100 driver, part 1 Jakub Kicinski
2020-06-30  0:38   ` David Miller

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=07a65e3d-41de-f9ad-ae16-7650505e8b1e@solarflare.com \
    --to=ecree@solarflare.com \
    --cc=davem@davemloft.net \
    --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).