Commit 82192cb4 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'ena-capabilities-field-and-cosmetic-changes'

Arthur Kiyanovski says:

====================
ENA: capabilities field and cosmetic changes

Add a new capabilities bitmask field to get indication of
capabilities supported by the device. Use the capabilities
field to query the device for ENI stats support.

Other patches are cosmetic changes like fixing readme
mistakes, removing unused variables etc...
====================

Link: https://lore.kernel.org/r/20220107202346.3522-1-akiyano@amazon.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents bf44077c 9fe890cc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ The ENA driver supports two Queue Operation modes for Tx SQs:

- **Low Latency Queue (LLQ) mode or "push-mode":**
  In this mode the driver pushes the transmit descriptors and the
  first 128 bytes of the packet directly to the ENA device memory
  first 96 bytes of the packet directly to the ENA device memory
  space. The rest of the packet payload is fetched by the
  device. For this operation mode, the driver uses a dedicated PCI
  device memory BAR, which is mapped with write-combine capability.
+9 −1
Original line number Diff line number Diff line
@@ -48,6 +48,11 @@ enum ena_admin_aq_feature_id {
	ENA_ADMIN_FEATURES_OPCODE_NUM               = 32,
};

/* device capabilities */
enum ena_admin_aq_caps_id {
	ENA_ADMIN_ENI_STATS                         = 0,
};

enum ena_admin_placement_policy_type {
	/* descriptors and headers are in host memory */
	ENA_ADMIN_PLACEMENT_POLICY_HOST             = 1,
@@ -455,7 +460,10 @@ struct ena_admin_device_attr_feature_desc {
	 */
	u32 supported_features;

	u32 reserved3;
	/* bitmap of ena_admin_aq_caps_id, which represents device
	 * capabilities.
	 */
	u32 capabilities;

	/* Indicates how many bits are used physical address access. */
	u32 phys_addr_width;
+8 −0
Original line number Diff line number Diff line
@@ -1971,6 +1971,7 @@ int ena_com_get_dev_attr_feat(struct ena_com_dev *ena_dev,
	       sizeof(get_resp.u.dev_attr));

	ena_dev->supported_features = get_resp.u.dev_attr.supported_features;
	ena_dev->capabilities = get_resp.u.dev_attr.capabilities;

	if (ena_dev->supported_features & BIT(ENA_ADMIN_MAX_QUEUES_EXT)) {
		rc = ena_com_get_feature(ena_dev, &get_resp,
@@ -2223,6 +2224,13 @@ int ena_com_get_eni_stats(struct ena_com_dev *ena_dev,
	struct ena_com_stats_ctx ctx;
	int ret;

	if (!ena_com_get_cap(ena_dev, ENA_ADMIN_ENI_STATS)) {
		netdev_err(ena_dev->net_device,
			   "Capability %d isn't supported\n",
			   ENA_ADMIN_ENI_STATS);
		return -EOPNOTSUPP;
	}

	memset(&ctx, 0x0, sizeof(ctx));
	ret = ena_get_dev_stats(ena_dev, &ctx, ENA_ADMIN_GET_STATS_TYPE_ENI);
	if (likely(ret == 0))
+13 −0
Original line number Diff line number Diff line
@@ -314,6 +314,7 @@ struct ena_com_dev {

	struct ena_rss rss;
	u32 supported_features;
	u32 capabilities;
	u32 dma_addr_bits;

	struct ena_host_attribute host_attr;
@@ -967,6 +968,18 @@ static inline void ena_com_disable_adaptive_moderation(struct ena_com_dev *ena_d
	ena_dev->adaptive_coalescing = false;
}

/* ena_com_get_cap - query whether device supports a capability.
 * @ena_dev: ENA communication layer struct
 * @cap_id: enum value representing the capability
 *
 * @return - true if capability is supported or false otherwise
 */
static inline bool ena_com_get_cap(struct ena_com_dev *ena_dev,
				   enum ena_admin_aq_caps_id cap_id)
{
	return !!(ena_dev->capabilities & BIT(cap_id));
}

/* ena_com_update_intr_reg - Prepare interrupt register
 * @intr_reg: interrupt register to update.
 * @rx_delay_interval: Rx interval in usecs
+9 −6
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ static const struct ena_stats ena_stats_rx_strings[] = {
	ENA_STAT_RX_ENTRY(rx_copybreak_pkt),
	ENA_STAT_RX_ENTRY(csum_good),
	ENA_STAT_RX_ENTRY(refil_partial),
	ENA_STAT_RX_ENTRY(bad_csum),
	ENA_STAT_RX_ENTRY(csum_bad),
	ENA_STAT_RX_ENTRY(page_alloc_fail),
	ENA_STAT_RX_ENTRY(skb_alloc_fail),
	ENA_STAT_RX_ENTRY(dma_mapping_err),
@@ -110,8 +110,7 @@ static const struct ena_stats ena_stats_ena_com_strings[] = {
#define ENA_STATS_ARRAY_TX		ARRAY_SIZE(ena_stats_tx_strings)
#define ENA_STATS_ARRAY_RX		ARRAY_SIZE(ena_stats_rx_strings)
#define ENA_STATS_ARRAY_ENA_COM		ARRAY_SIZE(ena_stats_ena_com_strings)
#define ENA_STATS_ARRAY_ENI(adapter)	\
	(ARRAY_SIZE(ena_stats_eni_strings) * (adapter)->eni_stats_supported)
#define ENA_STATS_ARRAY_ENI(adapter)	ARRAY_SIZE(ena_stats_eni_strings)

static void ena_safe_update_stat(u64 *src, u64 *dst,
				 struct u64_stats_sync *syncp)
@@ -213,8 +212,9 @@ static void ena_get_ethtool_stats(struct net_device *netdev,
				  u64 *data)
{
	struct ena_adapter *adapter = netdev_priv(netdev);
	struct ena_com_dev *dev = adapter->ena_dev;

	ena_get_stats(adapter, data, adapter->eni_stats_supported);
	ena_get_stats(adapter, data, ena_com_get_cap(dev, ENA_ADMIN_ENI_STATS));
}

static int ena_get_sw_stats_count(struct ena_adapter *adapter)
@@ -226,7 +226,9 @@ static int ena_get_sw_stats_count(struct ena_adapter *adapter)

static int ena_get_hw_stats_count(struct ena_adapter *adapter)
{
	return ENA_STATS_ARRAY_ENI(adapter);
	bool supported = ena_com_get_cap(adapter->ena_dev, ENA_ADMIN_ENI_STATS);

	return ENA_STATS_ARRAY_ENI(adapter) * supported;
}

int ena_get_sset_count(struct net_device *netdev, int sset)
@@ -316,10 +318,11 @@ static void ena_get_ethtool_strings(struct net_device *netdev,
				    u8 *data)
{
	struct ena_adapter *adapter = netdev_priv(netdev);
	struct ena_com_dev *dev = adapter->ena_dev;

	switch (sset) {
	case ETH_SS_STATS:
		ena_get_strings(adapter, data, adapter->eni_stats_supported);
		ena_get_strings(adapter, data, ena_com_get_cap(dev, ENA_ADMIN_ENI_STATS));
		break;
	}
}
Loading