ENA: capabilities field and cosmetic changes
Subsystems (4)
Arthur Kiyanovski
maintainerv2 cover ENA: capabilities field and cosmetic changes
V2 Changes
----------
Fixed "mixing different enum types" warning in patch
10/10 "net: ena: Extract recurring driver reset code into a function"
Original Cover Letter
---------------------
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...
Arthur Kiyanovski (10):
net: ena: Change return value of ena_calc_io_queue_size() to void
net: ena: Add capabilities field with support for ENI stats capability
net: ena: Change ENI stats support check to use capabilities field
net: ena: Update LLQ header length in ena documentation
net: ena: Remove redundant return code check
net: ena: Move reset completion print to the reset function
net: ena: Remove ena_calc_queue_size_ctx struct
net: ena: Add debug prints for invalid req_id resets
net: ena: Change the name of bad_csum variable
net: ena: Extract recurring driver reset code into a function
.../device_drivers/ethernet/amazon/ena.rst | 2 +- .../net/ethernet/amazon/ena/ena_admin_defs.h | 10 +- drivers/net/ethernet/amazon/ena/ena_com.c | 8 ++ drivers/net/ethernet/amazon/ena/ena_com.h | 13 ++ drivers/net/ethernet/amazon/ena/ena_ethtool.c | 15 ++- drivers/net/ethernet/amazon/ena/ena_netdev.c | 125 +++++++----------- drivers/net/ethernet/amazon/ena/ena_netdev.h | 24 ++-- 7 files changed, 95 insertions(+), 102 deletions(-)
Signature · 1 line
2.32.0
Arthur Kiyanovski
maintainerPATCH v2 1/10 net: ena: Change return value of ena_calc_io_queue_size() to void
ena_calc_io_queue_size() always returns 0, therefore make it a void function and update the calling function to stop checking the return value.
--- drivers/net/ethernet/amazon/ena/ena_netdev.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ethernet/amazon/ena/ena_netdev.c +3 -5
@@ -4146,7 +4146,7 @@ static void ena_release_bars(struct ena_com_dev *ena_dev, struct pci_dev *pdev) } -static int ena_calc_io_queue_size (struct ena_calc_queue_size_ctx *ctx) +static void ena_calc_io_queue_size (struct ena_calc_queue_size_ctx *ctx) {struct ena_admin_feature_llq_desc *llq = &ctx->get_feat_ctx->llq;struct ena_com_dev *ena_dev = ctx->ena_dev;
@@ -4208,8 +4208,6 @@ static int ena_calc_io_queue_size(struct ena_calc_queue_size_ctx *ctx) ctx->max_rx_queue_size = max_rx_queue_size; ctx->tx_queue_size = tx_queue_size; ctx->rx_queue_size = rx_queue_size; - -return 0 ; }/* ena_probe - Device Initialization Routine
@@ -4320,8 +4318,8 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ena_dev->intr_moder_rx_interval =ENA_INTR_INITIAL_RX_INTERVAL_USECS ; ena_dev->intr_delay_resolution =ENA_DEFAULT_INTR_DELAY_RESOLUTION ; max_num_io_queues =ena_calc_max_io_queue_num (pdev, ena_dev, &get_feat_ctx); - rc =ena_calc_io_queue_size (&calc_queue_ctx); -if (rc || !max_num_io_queues) { +ena_calc_io_queue_size (&calc_queue_ctx); +if (unlikely (!max_num_io_queues)) { rc = -EFAULT ; goto err_device_destroy; }
Signature · 1 line
2.32.0
Arthur Kiyanovski
maintainerPATCH v2 2/10 net: ena: Add capabilities field with support for ENI stats capability
In reply to Arthur KiyanovskiThis bitmask field indicates what capabilities are supported by the device.
The capabilities field differs from the 'supported_features' field which indicates what sub-commands for the set/get feature commands are supported. The sub-commands are specified in the 'feature_id' field of the 'ena_admin_set_feat_cmd' struct in the following way:
struct ena_admin_set_feat_cmd cmd;
cmd.aq_common_descriptor.opcode = ENA_ADMIN_SET_FEATURE;
cmd.feat_common.feature_The 'capabilities' field, on the other hand, specifies different capabilities of the device. For example, whether the device supports querying of ENI stats.
Also add an enumerator which contains all the capabilities. The first added capability macro is for ENI stats feature.
Capabilities are queried along with the other device attributes (in ena_com_get_dev_attr_feat()) during device initialization and are stored in the ena_com_dev struct. They can be later queried using the ena_com_get_cap() helper function.
--- drivers/net/ethernet/amazon/ena/ena_admin_defs.h | 10 +++++++++- drivers/net/ethernet/amazon/ena/ena_com.c | 8 ++++++++ drivers/net/ethernet/amazon/ena/ena_com.h | 13 +++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-)
drivers/net/ethernet/amazon/ena/ena_admin_defs.h +9 -1
@@ -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;
drivers/net/ethernet/amazon/ena/ena_com.c +8 -0
@@ -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 ))
drivers/net/ethernet/amazon/ena/ena_com.h +13 -0
@@ -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
Signature · 1 line
2.32.0
Arthur Kiyanovski
maintainerPATCH v2 3/10 net: ena: Change ENI stats support check to use capabilities field
In reply to Arthur KiyanovskiUse the capabilities field to query the device for ENI stats support.
This replaces the previous method that tried to get the ENI stats during ena_probe() and used the success or failure as an indication for support by the device.
Remove eni_stats_supported field from struct ena_adapter. This field was used for the previous method of queriying for ENI stats support.
Change the severity level of the print in case of ena_com_get_eni_stats() failure from info to error.
With the previous method of querying form ENI stats support, failure to get ENI stats was normal for devices that don't support it. With the use of the capabilities field such a failure is unexpected, as it is called only if the device reported that it supports ENI stats.
--- drivers/net/ethernet/amazon/ena/ena_ethtool.c | 13 ++++++++----- drivers/net/ethernet/amazon/ena/ena_netdev.c | 9 ++------- drivers/net/ethernet/amazon/ena/ena_netdev.h | 1 - 3 files changed, 10 insertions(+), 13 deletions(-)
drivers/net/ethernet/amazon/ena/ena_ethtool.c +8 -5
@@ -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 ; } }
drivers/net/ethernet/amazon/ena/ena_netdev.c +2 -7
@@ -3253,11 +3253,11 @@ static void ena_config_debug_area(struct ena_adapter *adapter)int ena_update_hw_stats (struct ena_adapter *adapter) { -int rc =0 ; +int rc; rc =ena_com_get_eni_stats (adapter->ena_dev, &adapter->eni_stats);if (rc) { -dev_info_once (&adapter->pdev->dev,"Failed to get ENI stats\n" ); +netdev_err (adapter->netdev,"Failed to get ENI stats\n" );return rc; }
@@ -4385,11 +4385,6 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent)ena_config_debug_area (adapter); -if (!ena_update_hw_stats (adapter)) - adapter->eni_stats_supported = true; -else - adapter->eni_stats_supported = false; -memcpy (adapter->netdev->perm_addr, adapter->mac_addr, netdev->addr_len);netif_carrier_off (netdev);
drivers/net/ethernet/amazon/ena/ena_netdev.h +0 -1
@@ -379,7 +379,6 @@ struct ena_adapter {struct u64_stats_sync syncp;struct ena_stats_dev dev_stats;struct ena_admin_eni_stats eni_stats; -bool eni_stats_supported;/* last queue index that was checked for uncompleted tx packets */ u32 last_monitored_tx_qid;
Signature · 1 line
2.32.0
Arthur Kiyanovski
maintainerPATCH v2 4/10 net: ena: Update LLQ header length in ena documentation
In reply to Arthur KiyanovskiLLQ entry length is 128 bytes. Therefore the maximum header in the entry is calculated by:tx_max_header_size =LLQ_ENTRY_SIZE - DESCRIPTORS_NUM_BEFORE_HEADER * 16 = 128 - 2 * 16 = 96
This patch updates the documentation so that it states the correct max header length.
--- Documentation/networking/device_drivers/ethernet/amazon/ena.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/networking/device_drivers/ethernet/amazon/ena.rst +1 -1
@@ -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.
Signature · 1 line
2.32.0
Arthur Kiyanovski
maintainerPATCH v2 5/10 net: ena: Remove redundant return code check
In reply to Arthur KiyanovskiThe ena_com_indirect_table_fill_entry() function only returns -EINVAL or 0, no need to check for -EOPNOTSUPP.
--- drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amazon/ena/ena_netdev.c +1 -1
@@ -4110,7 +4110,7 @@ static int ena_rss_init_default(struct ena_adapter *adapter) val =ethtool_rxfh_indir_default (i, adapter->num_io_queues); rc =ena_com_indirect_table_fill_entry (ena_dev, i,ENA_IO_RXQ_IDX (val)); -if (unlikely (rc && (rc != -EOPNOTSUPP ))) { +if (unlikely (rc)) {dev_err (dev,"Cannot fill indirect table\n" ); goto err_fill_indir; }
Signature · 1 line
2.32.0
Arthur Kiyanovski
maintainerPATCH v2 6/10 net: ena: Move reset completion print to the reset function
In reply to Arthur KiyanovskiThe print that indicates that device reset has finished is currently called from ena_restore_device().
Move it to ena_fw_reset_device() as it is the more natural location for it.
--- drivers/net/ethernet/amazon/ena/ena_netdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/amazon/ena/ena_netdev.c +2 -2
@@ -3654,8 +3654,6 @@ static int ena_restore_device(struct ena_adapter *adapter)mod_timer (&adapter->timer_service,round_jiffies (jiffies +HZ )); adapter->last_keep_alive_jiffies = jiffies; -dev_err (&pdev->dev,"Device reset completed successfully\n" ); -return rc; err_disable_msix:ena_free_mgmnt_irq (adapter);
@@ -3685,6 +3683,8 @@ static void ena_fw_reset_device(struct work_struct *work)if (likely (test_bit (ENA_FLAG_TRIGGER_RESET , &adapter->flags))) {ena_destroy_device (adapter, false);ena_restore_device (adapter); + +dev_err (&adapter->pdev->dev,"Device reset completed successfully\n" ); }rtnl_unlock ();
Signature · 1 line
2.32.0
Arthur Kiyanovski
maintainerPATCH v2 7/10 net: ena: Remove ena_calc_queue_size_ctx struct
In reply to Arthur KiyanovskiThis struct was used to pass data from callee function to its caller. Its usage can be avoided.
Removing it results in less code without any damage to code readability. Also it allows to consolidate ring size calculation into a single function (ena_calc_io_queue_size()).
--- drivers/net/ethernet/amazon/ena/ena_netdev.c | 49 ++++++++------------ drivers/net/ethernet/amazon/ena/ena_netdev.h | 12 ----- 2 files changed, 19 insertions(+), 42 deletions(-)
drivers/net/ethernet/amazon/ena/ena_netdev.c +19 -30
@@ -4146,10 +4146,11 @@ static void ena_release_bars(struct ena_com_dev *ena_dev, struct pci_dev *pdev) } -static void ena_calc_io_queue_size (struct ena_calc_queue_size_ctx *ctx) +static void ena_calc_io_queue_size (struct ena_adapter *adapter, +struct ena_com_dev_get_features_ctx *get_feat_ctx) { -struct ena_admin_feature_llq_desc *llq = &ctx->get_feat_ctx->llq; -struct ena_com_dev *ena_dev = ctx->ena_dev; +struct ena_admin_feature_llq_desc *llq = &get_feat_ctx->llq; +struct ena_com_dev *ena_dev = adapter->ena_dev;u32 tx_queue_size =ENA_DEFAULT_RING_SIZE ;u32 rx_queue_size =ENA_DEFAULT_RING_SIZE ;u32 max_tx_queue_size;
@@ -4157,7 +4158,7 @@ static void ena_calc_io_queue_size(struct ena_calc_queue_size_ctx *ctx)if (ena_dev->supported_features &BIT (ENA_ADMIN_MAX_QUEUES_EXT )) {struct ena_admin_queue_ext_feature_fields *max_queue_ext = - &ctx->get_feat_ctx->max_queue_ext.max_queue_ext; + &get_feat_ctx->max_queue_ext.max_queue_ext; max_rx_queue_size =min_t (u32, max_queue_ext->max_rx_cq_depth, max_queue_ext->max_rx_sq_depth); max_tx_queue_size = max_queue_ext->max_tx_cq_depth;
@@ -4169,13 +4170,13 @@ static void ena_calc_io_queue_size(struct ena_calc_queue_size_ctx *ctx) max_tx_queue_size =min_t (u32, max_tx_queue_size, max_queue_ext->max_tx_sq_depth); - ctx->max_tx_sgl_size =min_t (u16,ENA_PKT_MAX_BUFS , - max_queue_ext->max_per_packet_tx_descs); - ctx->max_rx_sgl_size =min_t (u16,ENA_PKT_MAX_BUFS , - max_queue_ext->max_per_packet_rx_descs); + adapter->max_tx_sgl_size =min_t (u16,ENA_PKT_MAX_BUFS , + max_queue_ext->max_per_packet_tx_descs); + adapter->max_rx_sgl_size =min_t (u16,ENA_PKT_MAX_BUFS , + max_queue_ext->max_per_packet_rx_descs); }else {struct ena_admin_queue_feature_desc *max_queues = - &ctx->get_feat_ctx->max_queues; + &get_feat_ctx->max_queues; max_rx_queue_size =min_t (u32, max_queues->max_cq_depth, max_queues->max_sq_depth); max_tx_queue_size = max_queues->max_cq_depth;
@@ -4187,10 +4188,10 @@ static void ena_calc_io_queue_size(struct ena_calc_queue_size_ctx *ctx) max_tx_queue_size =min_t (u32, max_tx_queue_size, max_queues->max_sq_depth); - ctx->max_tx_sgl_size =min_t (u16,ENA_PKT_MAX_BUFS , - max_queues->max_packet_tx_descs); - ctx->max_rx_sgl_size =min_t (u16,ENA_PKT_MAX_BUFS , - max_queues->max_packet_rx_descs); + adapter->max_tx_sgl_size =min_t (u16,ENA_PKT_MAX_BUFS , + max_queues->max_packet_tx_descs); + adapter->max_rx_sgl_size =min_t (u16,ENA_PKT_MAX_BUFS , + max_queues->max_packet_rx_descs); } max_tx_queue_size =rounddown_pow_of_two (max_tx_queue_size);
@@ -4204,10 +4205,10 @@ static void ena_calc_io_queue_size(struct ena_calc_queue_size_ctx *ctx) tx_queue_size =rounddown_pow_of_two (tx_queue_size); rx_queue_size =rounddown_pow_of_two (rx_queue_size); - ctx->max_tx_queue_size = max_tx_queue_size; - ctx->max_rx_queue_size = max_rx_queue_size; - ctx->tx_queue_size = tx_queue_size; - ctx->rx_queue_size = rx_queue_size; + adapter->max_tx_ring_size = max_tx_queue_size; + adapter->max_rx_ring_size = max_rx_queue_size; + adapter->requested_tx_ring_size = tx_queue_size; + adapter->requested_rx_ring_size = rx_queue_size; }/* ena_probe - Device Initialization Routine
@@ -4222,7 +4223,6 @@ static void ena_calc_io_queue_size(struct ena_calc_queue_size_ctx *ctx)*/ static int ena_probe (struct pci_dev *pdev,const struct pci_device_id *ent) { -struct ena_calc_queue_size_ctx calc_queue_ctx = {};struct ena_com_dev_get_features_ctx get_feat_ctx;struct ena_com_dev *ena_dev =NULL ;struct ena_adapter *adapter;
@@ -4307,10 +4307,6 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_device_destroy; } - calc_queue_ctx.ena_dev = ena_dev; - calc_queue_ctx.get_feat_ctx = &get_feat_ctx; - calc_queue_ctx.pdev = pdev; -/* Initial TX and RX interrupt delay. Assumes 1 usec granularity. * Updated during device initialization with the real granularity */
@@ -4318,7 +4314,7 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ena_dev->intr_moder_rx_interval =ENA_INTR_INITIAL_RX_INTERVAL_USECS ; ena_dev->intr_delay_resolution =ENA_DEFAULT_INTR_DELAY_RESOLUTION ; max_num_io_queues =ena_calc_max_io_queue_num (pdev, ena_dev, &get_feat_ctx); -ena_calc_io_queue_size (&calc_queue_ctx); +ena_calc_io_queue_size (adapter, &get_feat_ctx);if (unlikely (!max_num_io_queues)) { rc = -EFAULT ; goto err_device_destroy;
@@ -4328,13 +4324,6 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) adapter->reset_reason =ENA_REGS_RESET_NORMAL ; - adapter->requested_tx_ring_size = calc_queue_ctx.tx_queue_size; - adapter->requested_rx_ring_size = calc_queue_ctx.rx_queue_size; - adapter->max_tx_ring_size = calc_queue_ctx.max_tx_queue_size; - adapter->max_rx_ring_size = calc_queue_ctx.max_rx_queue_size; - adapter->max_tx_sgl_size = calc_queue_ctx.max_tx_sgl_size; - adapter->max_rx_sgl_size = calc_queue_ctx.max_rx_sgl_size; - adapter->num_io_queues = max_num_io_queues; adapter->max_num_io_queues = max_num_io_queues; adapter->last_monitored_tx_qid =0 ;
drivers/net/ethernet/amazon/ena/ena_netdev.h +0 -12
@@ -140,18 +140,6 @@ struct ena_napi {struct dim dim; }; -struct ena_calc_queue_size_ctx { -struct ena_com_dev_get_features_ctx *get_feat_ctx; -struct ena_com_dev *ena_dev; -struct pci_dev *pdev; -u32 tx_queue_size; -u32 rx_queue_size; -u32 max_tx_queue_size; -u32 max_rx_queue_size; -u16 max_tx_sgl_size; -u16 max_rx_sgl_size; -}; -struct ena_tx_buffer {struct sk_buff *skb;/* num of ena desc for this specific skb
Signature · 1 line
2.32.0
Arthur Kiyanovski
maintainerPATCH v2 8/10 net: ena: Add debug prints for invalid req_id resets
In reply to Arthur KiyanovskiAdd qid and req_id to error prints when ENA_REGS_RESET_INV_TX_REQ_ID reset occurs.
Switch from %hu to %u, since u16 should be printed with %u, as explained in [1].
[1] - https://www.kernel.org/doc/html/latest/core-api/printk-formats.html
--- drivers/net/ethernet/amazon/ena/ena_netdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/amazon/ena/ena_netdev.c +4 -4
@@ -1269,14 +1269,14 @@ static int handle_invalid_req_id(struct ena_ring *ring, u16 req_id,netif_err (ring->adapter, tx_done, ring->netdev, -"tx_info doesn't have valid %s" , - is_xdp ?"xdp frame" :"skb" ); +"tx_info doesn't have valid %s. qid %u req_id %u" , + is_xdp ?"xdp frame" :"skb" , ring->qid, req_id); else netif_err(ring->adapter, tx_done, ring->netdev, - "Invalid req_id: %hu\n", -req_id ); +"Invalid req_id %u in qid %u\n" , + req_id, ring->qid);ena_increase_stat (&ring->tx_stats.bad_req_id,1 , &ring->syncp);
Signature · 1 line
2.32.0
Arthur Kiyanovski
maintainerPATCH v2 9/10 net: ena: Change the name of bad_csum variable
In reply to Arthur KiyanovskiChanged bad_csum to csum_bad to align with csum_unchecked & csum_good
--- drivers/net/ethernet/amazon/ena/ena_ethtool.c | 2 +- drivers/net/ethernet/amazon/ena/ena_netdev.c | 4 ++-- drivers/net/ethernet/amazon/ena/ena_netdev.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/amazon/ena/ena_ethtool.c +1 -1
@@ -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),
drivers/net/ethernet/amazon/ena/ena_netdev.c +2 -2
@@ -1558,7 +1558,7 @@ static void ena_rx_checksum(struct ena_ring *rx_ring, (ena_rx_ctx->l3_csum_err))) {/* ipv4 checksum error */ skb->ip_summed =CHECKSUM_NONE ; -ena_increase_stat (&rx_ring->rx_stats.bad_csum,1 , +ena_increase_stat (&rx_ring->rx_stats.csum_bad,1 , &rx_ring->syncp);netif_dbg (rx_ring->adapter, rx_err, rx_ring->netdev,"RX IPv4 header checksum error\n" );
@@ -1570,7 +1570,7 @@ static void ena_rx_checksum(struct ena_ring *rx_ring, (ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_UDP))) {if (unlikely (ena_rx_ctx->l4_csum_err)) {/* TCP/UDP checksum error */ -ena_increase_stat (&rx_ring->rx_stats.bad_csum,1 , +ena_increase_stat (&rx_ring->rx_stats.csum_bad,1 , &rx_ring->syncp);netif_dbg (rx_ring->adapter, rx_err, rx_ring->netdev,"RX L4 checksum error\n" );
drivers/net/ethernet/amazon/ena/ena_netdev.h +1 -1
@@ -204,7 +204,7 @@ struct ena_stats_rx {u64 rx_copybreak_pkt;u64 csum_good;u64 refil_partial; -u64 bad_csum; +u64 csum_bad;u64 page_alloc_fail;u64 skb_alloc_fail;u64 dma_mapping_err;
Signature · 1 line
2.32.0
Jakub Kicinski
maintainerRe: [PATCH V2 net-next 09/10] net: ena: Change the name of bad_csum variable
drivers/net/ethernet/amazon/ena/ena_ethtool.c static const struct ena_stats ena_stats_rx_strings[] = { · line 85
Quoted 2 lines · On Fri, 7 Jan 2022 20:23:45 +0000 Arthur Kiyanovski wrote:
drivers/net/ethernet/amazon/ena/ena_ethtool.c +1
-1- ENA_STAT_RX_ENTRY(bad_csum), + ENA_STAT_RX_ENTRY(csum_bad),
If any of your users complains that this broke their scripts you'll need to revert.
Arthur Kiyanovski
maintainerPATCH v2 10/10 net: ena: Extract recurring driver reset code into a function
In reply to Arthur KiyanovskiCreate an inline function for resetting the driver to reduce code duplication.
--- drivers/net/ethernet/amazon/ena/ena_netdev.c | 45 ++++++-------------- drivers/net/ethernet/amazon/ena/ena_netdev.h | 9 ++++ 2 files changed, 23 insertions(+), 31 deletions(-)
drivers/net/ethernet/amazon/ena/ena_netdev.c +14 -31
@@ -103,7 +103,7 @@ static void ena_tx_timeout(struct net_device *dev, unsigned int txqueue)if (test_and_set_bit (ENA_FLAG_TRIGGER_RESET , &adapter->flags))return ; - adapter->reset_reason =ENA_REGS_RESET_OS_NETDEV_WD ; +ena_reset_device (adapter,ENA_REGS_RESET_OS_NETDEV_WD );ena_increase_stat (&adapter->dev_stats.tx_timeout,1 , &adapter->syncp);netif_err (adapter, tx_err, dev,"Transmit time out\n" );
@@ -166,11 +166,9 @@ static int ena_xmit_common(struct net_device *dev, "Failed to prepare tx bufs\n");ena_increase_stat (&ring->tx_stats.prepare_ctx_err,1 , &ring->syncp); -if (rc != -ENOMEM ) { - adapter->reset_reason = -ENA_REGS_RESET_DRIVER_INVALID_STATE ; -set_bit (ENA_FLAG_TRIGGER_RESET , &adapter->flags); - } +if (rc != -ENOMEM ) +ena_reset_device (adapter, +ENA_REGS_RESET_DRIVER_INVALID_STATE );return rc; }
@@ -1279,10 +1277,8 @@ static int handle_invalid_req_id(struct ena_ring *ring, u16 req_id, req_id, ring->qid);ena_increase_stat (&ring->tx_stats.bad_req_id,1 , &ring->syncp); +ena_reset_device (ring->adapter,ENA_REGS_RESET_INV_TX_REQ_ID ); -/* Trigger device reset */ - ring->adapter->reset_reason =ENA_REGS_RESET_INV_TX_REQ_ID ; -set_bit (ENA_FLAG_TRIGGER_RESET , &ring->adapter->flags);return -EFAULT ; }
@@ -1445,10 +1441,7 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,netif_err (adapter, rx_err, rx_ring->netdev,"Page is NULL. qid %u req_id %u\n" , rx_ring->qid, req_id);ena_increase_stat (&rx_ring->rx_stats.bad_req_id,1 , &rx_ring->syncp); - adapter->reset_reason =ENA_REGS_RESET_INV_RX_REQ_ID ; -/* Make sure reset reason is set before triggering the reset */ -smp_mb__before_atomic (); -set_bit (ENA_FLAG_TRIGGER_RESET , &adapter->flags); +ena_reset_device (adapter,ENA_REGS_RESET_INV_RX_REQ_ID );return NULL ; }
@@ -1781,15 +1774,12 @@ static int ena_clean_rx_irq(struct ena_ring *rx_ring, struct napi_struct *napi,if (rc == -ENOSPC ) {ena_increase_stat (&rx_ring->rx_stats.bad_desc_num,1 , &rx_ring->syncp); - adapter->reset_reason =ENA_REGS_RESET_TOO_MANY_RX_DESCS ; +ena_reset_device (adapter,ENA_REGS_RESET_TOO_MANY_RX_DESCS ); }else {ena_increase_stat (&rx_ring->rx_stats.bad_req_id,1 , &rx_ring->syncp); - adapter->reset_reason =ENA_REGS_RESET_INV_RX_REQ_ID ; +ena_reset_device (adapter,ENA_REGS_RESET_INV_RX_REQ_ID ); } - -set_bit (ENA_FLAG_TRIGGER_RESET , &adapter->flags); -return 0 ; }
@@ -3707,9 +3697,8 @@ static int check_for_rx_interrupt_queue(struct ena_adapter *adapter,netif_err (adapter, rx_err, adapter->netdev,"Potential MSIX issue on Rx side Queue = %d. Reset the device\n" , rx_ring->qid); - adapter->reset_reason =ENA_REGS_RESET_MISS_INTERRUPT ; -smp_mb__before_atomic (); -set_bit (ENA_FLAG_TRIGGER_RESET , &adapter->flags); + +ena_reset_device (adapter,ENA_REGS_RESET_MISS_INTERRUPT );return -EIO ; }
@@ -3746,9 +3735,7 @@ static int check_missing_comp_in_tx_queue(struct ena_adapter *adapter,netif_err (adapter, tx_err, adapter->netdev,"Potential MSIX issue on Tx side Queue = %d. Reset the device\n" , tx_ring->qid); - adapter->reset_reason =ENA_REGS_RESET_MISS_INTERRUPT ; -smp_mb__before_atomic (); -set_bit (ENA_FLAG_TRIGGER_RESET , &adapter->flags); +ena_reset_device (adapter,ENA_REGS_RESET_MISS_INTERRUPT );return -EIO ; }
@@ -3774,9 +3761,7 @@ static int check_missing_comp_in_tx_queue(struct ena_adapter *adapter,"The number of lost tx completions is above the threshold (%d > %d). Reset the device\n" , missed_tx, adapter->missing_tx_completion_threshold); - adapter->reset_reason = -ENA_REGS_RESET_MISS_TX_CMPL ; -set_bit (ENA_FLAG_TRIGGER_RESET , &adapter->flags); +ena_reset_device (adapter,ENA_REGS_RESET_MISS_TX_CMPL ); rc = -EIO ; }
@@ -3897,8 +3882,7 @@ static void check_for_missing_keep_alive(struct ena_adapter *adapter) "Keep alive watchdog timeout.\n");ena_increase_stat (&adapter->dev_stats.wd_expired,1 , &adapter->syncp); - adapter->reset_reason =ENA_REGS_RESET_KEEP_ALIVE_TO ; -set_bit (ENA_FLAG_TRIGGER_RESET , &adapter->flags); +ena_reset_device (adapter,ENA_REGS_RESET_KEEP_ALIVE_TO ); } }
@@ -3909,8 +3893,7 @@ static void check_for_admin_com_state(struct ena_adapter *adapter) "ENA admin queue is not in running state!\n");ena_increase_stat (&adapter->dev_stats.admin_q_pause,1 , &adapter->syncp); - adapter->reset_reason =ENA_REGS_RESET_ADMIN_TO ; -set_bit (ENA_FLAG_TRIGGER_RESET , &adapter->flags); +ena_reset_device (adapter,ENA_REGS_RESET_ADMIN_TO ); } }
drivers/net/ethernet/amazon/ena/ena_netdev.h +9 -0
@@ -394,6 +394,15 @@ int ena_update_queue_count(struct ena_adapter *adapter, u32 new_channel_count);int ena_get_sset_count (struct net_device *netdev,int sset); +static inline void ena_reset_device (struct ena_adapter *adapter, +enum ena_regs_reset_reason_types reset_reason) +{ + adapter->reset_reason = reset_reason; +/* Make sure reset reason is set before triggering the reset */ +smp_mb__before_atomic (); +set_bit (ENA_FLAG_TRIGGER_RESET , &adapter->flags); +} +enum ena_xdp_errors_t {ENA_XDP_ALLOWED =0 ,ENA_XDP_CURRENT_MTU_TOO_LARGE ,
Signature · 1 line
2.32.0
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Fri, 7 Jan 2022 20:23:36 +0000 you wrote:
V2 Changes
----------
Fixed "mixing different enum types" warning in patch
10/10 "net: ena: Extract recurring driver reset code into a function"Original Cover Letter
[...]
Here is the summary with links:
- [V2,net-next,01/10] net: ena: Change return value of ena_calc_io_queue_size() to void
https://git.kernel.org/netdev/net-next/c/7dcf92215227 - [V2,net-next,02/10] net: ena: Add capabilities field with support for ENI stats capability https://git.kernel.org/netdev/net-next/c/a2d5d6a70fa5 - [V2,net-next,03/10] net: ena: Change ENI stats support check to use capabilities field https://git.kernel.org/netdev/net-next/c/394c48e08bbc - [V2,net-next,04/10] net: ena: Update LLQ header length in ena documentation https://git.kernel.org/netdev/net-next/c/273a2397fc91 - [V2,net-next,05/10] net: ena: Remove redundant return code check https://git.kernel.org/netdev/net-next/c/09f8676eae1d - [V2,net-next,06/10] net: ena: Move reset completion print to the reset function https://git.kernel.org/netdev/net-next/c/e34454698033 - [V2,net-next,07/10] net: ena: Remove ena_calc_queue_size_ctx struct https://git.kernel.org/netdev/net-next/c/c215941abacf - [V2,net-next,08/10] net: ena: Add debug prints for invalid req_id resets https://git.kernel.org/netdev/net-next/c/9b648bb1d89e - [V2,net-next,09/10] net: ena: Change the name of bad_csum variable https://git.kernel.org/netdev/net-next/c/d0e8831d6c93 - [V2,net-next,10/10] net: ena: Extract recurring driver reset code into a function https://git.kernel.org/netdev/net-next/c/9fe890cc5bb8
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html