From: <akiyano@amazon.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: Arthur Kiyanovski <akiyano@amazon.com>, <dwmw@amazon.com>,
<zorik@amazon.com>, <matua@amazon.com>, <saeedb@amazon.com>,
<msw@amazon.com>, <aliguori@amazon.com>, <nafea@amazon.com>,
<gtzalik@amazon.com>, <netanel@amazon.com>, <alisaidi@amazon.com>,
<benh@amazon.com>, <ndagan@amazon.com>, <shayagr@amazon.com>,
<sameehj@amazon.com>
Subject: [PATCH V2 net-next 11/14] net: ena: cosmetic: code reorderings
Date: Fri, 22 May 2020 12:09:02 +0300 [thread overview]
Message-ID: <1590138545-501-12-git-send-email-akiyano@amazon.com> (raw)
In-Reply-To: <1590138545-501-1-git-send-email-akiyano@amazon.com>
From: Arthur Kiyanovski <akiyano@amazon.com>
1. Reorder sanity checks in get_comp_ctxt() to make more sense
2. Reorder variables in ena_com_fill_hash_function() and
ena_calc_io_queue_size() in reverse christmas tree.
3. Move around member initializations.
Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
---
drivers/net/ethernet/amazon/ena/ena_com.c | 17 +++++++++--------
drivers/net/ethernet/amazon/ena/ena_netdev.c | 5 ++---
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c
index a513d71576bd..bf3465e5a2e7 100644
--- a/drivers/net/ethernet/amazon/ena/ena_com.c
+++ b/drivers/net/ethernet/amazon/ena/ena_com.c
@@ -200,17 +200,17 @@ static void comp_ctxt_release(struct ena_com_admin_queue *queue,
static struct ena_comp_ctx *get_comp_ctxt(struct ena_com_admin_queue *queue,
u16 command_id, bool capture)
{
- if (unlikely(!queue->comp_ctx)) {
- pr_err("Completion context is NULL\n");
- return NULL;
- }
-
if (unlikely(command_id >= queue->q_depth)) {
pr_err("command id is larger than the queue size. cmd_id: %u queue size %d\n",
command_id, queue->q_depth);
return NULL;
}
+ if (unlikely(!queue->comp_ctx)) {
+ pr_err("Completion context is NULL\n");
+ return NULL;
+ }
+
if (unlikely(queue->comp_ctx[command_id].occupied && capture)) {
pr_err("Completion context is occupied\n");
return NULL;
@@ -2266,13 +2266,14 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,
enum ena_admin_hash_functions func,
const u8 *key, u16 key_len, u32 init_val)
{
- struct ena_rss *rss = &ena_dev->rss;
+ struct ena_admin_feature_rss_flow_hash_control *hash_key;
struct ena_admin_get_feat_resp get_resp;
- struct ena_admin_feature_rss_flow_hash_control *hash_key =
- rss->hash_key;
enum ena_admin_hash_functions old_func;
+ struct ena_rss *rss = &ena_dev->rss;
int rc;
+ hash_key = rss->hash_key;
+
/* Make sure size is a mult of DWs */
if (unlikely(key_len & 0x3))
return -EINVAL;
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 148d13cdd1bf..313e65b17492 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -4121,8 +4121,8 @@ static int 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_com_dev_get_features_ctx get_feat_ctx;
struct ena_calc_queue_size_ctx calc_queue_ctx = { 0 };
+ struct ena_com_dev_get_features_ctx get_feat_ctx;
struct ena_llq_configurations llq_config;
struct ena_com_dev *ena_dev = NULL;
struct ena_adapter *adapter;
@@ -4233,12 +4233,11 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
adapter->num_io_queues = max_num_io_queues;
adapter->max_num_io_queues = max_num_io_queues;
+ adapter->last_monitored_tx_qid = 0;
adapter->xdp_first_ring = 0;
adapter->xdp_num_queues = 0;
- adapter->last_monitored_tx_qid = 0;
-
adapter->rx_copybreak = ENA_DEFAULT_RX_COPYBREAK;
adapter->wd_state = wd_state;
--
2.23.1
next prev parent reply other threads:[~2020-05-22 9:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-22 9:08 [PATCH V2 net-next 00/14] ENA features and cosmetic changes akiyano
2020-05-22 9:08 ` [PATCH V2 net-next 01/14] net: ena: add support for the rx offset feature akiyano
2020-05-22 9:08 ` [PATCH V2 net-next 02/14] net: ena: rename ena_com_free_desc to make API more uniform akiyano
2020-05-22 9:08 ` [PATCH V2 net-next 03/14] net: ena: use explicit variable size for clarity akiyano
2020-05-22 9:08 ` [PATCH V2 net-next 04/14] net: ena: fix ena_com_comp_status_to_errno() return value akiyano
2020-05-22 9:08 ` [PATCH V2 net-next 05/14] net: ena: simplify ena_com_update_intr_delay_resolution() akiyano
2020-05-22 9:08 ` [PATCH V2 net-next 06/14] net: ena: cosmetic: rename ena_update_tx/rx_rings_intr_moderation() akiyano
2020-05-22 9:08 ` [PATCH V2 net-next 07/14] net: ena: cosmetic: set queue sizes to u32 for consistency akiyano
2020-05-22 9:08 ` [PATCH V2 net-next 08/14] net: ena: cosmetic: fix spelling and grammar mistakes in comments akiyano
2020-05-22 9:09 ` [PATCH V2 net-next 09/14] net: ena: cosmetic: fix line break issues akiyano
2020-05-22 9:09 ` [PATCH V2 net-next 10/14] net: ena: cosmetic: remove unnecessary code akiyano
2020-05-22 9:09 ` akiyano [this message]
2020-05-22 9:09 ` [PATCH V2 net-next 12/14] net: ena: cosmetic: fix spacing issues akiyano
2020-05-22 9:09 ` [PATCH V2 net-next 13/14] net: ena: cosmetic: minor code changes akiyano
2020-05-22 9:09 ` [PATCH V2 net-next 14/14] net: ena: reduce driver load time akiyano
2020-05-22 17:48 ` [PATCH V2 net-next 00/14] ENA features and cosmetic changes Jakub Kicinski
2020-05-22 21:13 ` 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=1590138545-501-12-git-send-email-akiyano@amazon.com \
--to=akiyano@amazon.com \
--cc=aliguori@amazon.com \
--cc=alisaidi@amazon.com \
--cc=benh@amazon.com \
--cc=davem@davemloft.net \
--cc=dwmw@amazon.com \
--cc=gtzalik@amazon.com \
--cc=matua@amazon.com \
--cc=msw@amazon.com \
--cc=nafea@amazon.com \
--cc=ndagan@amazon.com \
--cc=netanel@amazon.com \
--cc=netdev@vger.kernel.org \
--cc=saeedb@amazon.com \
--cc=sameehj@amazon.com \
--cc=shayagr@amazon.com \
--cc=zorik@amazon.com \
/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).