Commit bf2746e8 authored by Shay Agroskin's avatar Shay Agroskin Committed by David S. Miller

net: ena: Capitalize all log strings and improve code readability

Capitalize all log strings printed by the ena driver to make their
format uniform across it.

Also fix indentation, spelling mistakes and comments to improve code
readability. This also includes adding comments to macros/enums whose
purpose might be difficult to understand.
Separate some code into functions to make it easier to understand the
purpose of these lines.
Signed-off-by: default avatarAmit Bernstein <amitbern@amazon.com>
Signed-off-by: default avatarShay Agroskin <shayagr@amazon.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f0525298
...@@ -28,6 +28,7 @@ enum ena_admin_aq_completion_status { ...@@ -28,6 +28,7 @@ enum ena_admin_aq_completion_status {
ENA_ADMIN_RESOURCE_BUSY = 7, ENA_ADMIN_RESOURCE_BUSY = 7,
}; };
/* subcommands for the set/get feature admin commands */
enum ena_admin_aq_feature_id { enum ena_admin_aq_feature_id {
ENA_ADMIN_DEVICE_ATTRIBUTES = 1, ENA_ADMIN_DEVICE_ATTRIBUTES = 1,
ENA_ADMIN_MAX_QUEUES_NUM = 2, ENA_ADMIN_MAX_QUEUES_NUM = 2,
...@@ -213,8 +214,8 @@ struct ena_admin_aq_create_sq_cmd { ...@@ -213,8 +214,8 @@ struct ena_admin_aq_create_sq_cmd {
*/ */
u8 sq_caps_3; u8 sq_caps_3;
/* associated completion queue id. This CQ must be created prior to /* associated completion queue id. This CQ must be created prior to SQ
* SQ creation * creation
*/ */
u16 cq_idx; u16 cq_idx;
...@@ -448,7 +449,9 @@ struct ena_admin_device_attr_feature_desc { ...@@ -448,7 +449,9 @@ struct ena_admin_device_attr_feature_desc {
u32 device_version; u32 device_version;
/* bitmap of ena_admin_aq_feature_id */ /* bitmap of ena_admin_aq_feature_id, which represents supported
* subcommands for the set/get feature admin commands.
*/
u32 supported_features; u32 supported_features;
u32 reserved3; u32 reserved3;
...@@ -534,32 +537,30 @@ struct ena_admin_feature_llq_desc { ...@@ -534,32 +537,30 @@ struct ena_admin_feature_llq_desc {
u32 max_llq_depth; u32 max_llq_depth;
/* specify the header locations the device supports. bitfield of /* specify the header locations the device supports. bitfield of enum
* enum ena_admin_llq_header_location. * ena_admin_llq_header_location.
*/ */
u16 header_location_ctrl_supported; u16 header_location_ctrl_supported;
/* the header location the driver selected to use. */ /* the header location the driver selected to use. */
u16 header_location_ctrl_enabled; u16 header_location_ctrl_enabled;
/* if inline header is specified - this is the size of descriptor /* if inline header is specified - this is the size of descriptor list
* list entry. If header in a separate ring is specified - this is * entry. If header in a separate ring is specified - this is the size
* the size of header ring entry. bitfield of enum * of header ring entry. bitfield of enum ena_admin_llq_ring_entry_size.
* ena_admin_llq_ring_entry_size. specify the entry sizes the device * specify the entry sizes the device supports
* supports
*/ */
u16 entry_size_ctrl_supported; u16 entry_size_ctrl_supported;
/* the entry size the driver selected to use. */ /* the entry size the driver selected to use. */
u16 entry_size_ctrl_enabled; u16 entry_size_ctrl_enabled;
/* valid only if inline header is specified. First entry associated /* valid only if inline header is specified. First entry associated with
* with the packet includes descriptors and header. Rest of the * the packet includes descriptors and header. Rest of the entries
* entries occupied by descriptors. This parameter defines the max * occupied by descriptors. This parameter defines the max number of
* number of descriptors precedding the header in the first entry. * descriptors precedding the header in the first entry. The field is
* The field is bitfield of enum * bitfield of enum ena_admin_llq_num_descs_before_header and specify
* ena_admin_llq_num_descs_before_header and specify the values the * the values the device supports
* device supports
*/ */
u16 desc_num_before_header_supported; u16 desc_num_before_header_supported;
...@@ -602,8 +603,8 @@ struct ena_admin_queue_ext_feature_fields { ...@@ -602,8 +603,8 @@ struct ena_admin_queue_ext_feature_fields {
u32 max_tx_header_size; u32 max_tx_header_size;
/* Maximum Descriptors number, including meta descriptor, allowed for /* Maximum Descriptors number, including meta descriptor, allowed for a
* a single Tx packet * single Tx packet
*/ */
u16 max_per_packet_tx_descs; u16 max_per_packet_tx_descs;
...@@ -626,8 +627,8 @@ struct ena_admin_queue_feature_desc { ...@@ -626,8 +627,8 @@ struct ena_admin_queue_feature_desc {
u32 max_header_size; u32 max_header_size;
/* Maximum Descriptors number, including meta descriptor, allowed for /* Maximum Descriptors number, including meta descriptor, allowed for a
* a single Tx packet * single Tx packet
*/ */
u16 max_packet_tx_descs; u16 max_packet_tx_descs;
...@@ -1015,7 +1016,7 @@ struct ena_admin_set_feat_resp { ...@@ -1015,7 +1016,7 @@ struct ena_admin_set_feat_resp {
struct ena_admin_aenq_common_desc { struct ena_admin_aenq_common_desc {
u16 group; u16 group;
u16 syndrom; u16 syndrome;
/* 0 : phase /* 0 : phase
* 7:1 : reserved - MBZ * 7:1 : reserved - MBZ
...@@ -1039,7 +1040,7 @@ enum ena_admin_aenq_group { ...@@ -1039,7 +1040,7 @@ enum ena_admin_aenq_group {
ENA_ADMIN_AENQ_GROUPS_NUM = 5, ENA_ADMIN_AENQ_GROUPS_NUM = 5,
}; };
enum ena_admin_aenq_notification_syndrom { enum ena_admin_aenq_notification_syndrome {
ENA_ADMIN_SUSPEND = 0, ENA_ADMIN_SUSPEND = 0,
ENA_ADMIN_RESUME = 1, ENA_ADMIN_RESUME = 1,
ENA_ADMIN_UPDATE_HINTS = 2, ENA_ADMIN_UPDATE_HINTS = 2,
......
This diff is collapsed.
...@@ -509,7 +509,7 @@ void ena_com_admin_q_comp_intr_handler(struct ena_com_dev *ena_dev); ...@@ -509,7 +509,7 @@ void ena_com_admin_q_comp_intr_handler(struct ena_com_dev *ena_dev);
* This method goes over the async event notification queue and calls the proper * This method goes over the async event notification queue and calls the proper
* aenq handler. * aenq handler.
*/ */
void ena_com_aenq_intr_handler(struct ena_com_dev *dev, void *data); void ena_com_aenq_intr_handler(struct ena_com_dev *ena_dev, void *data);
/* ena_com_abort_admin_commands - Abort all the outstanding admin commands. /* ena_com_abort_admin_commands - Abort all the outstanding admin commands.
* @ena_dev: ENA communication layer struct * @ena_dev: ENA communication layer struct
......
...@@ -18,7 +18,8 @@ static struct ena_eth_io_rx_cdesc_base *ena_com_get_next_rx_cdesc( ...@@ -18,7 +18,8 @@ static struct ena_eth_io_rx_cdesc_base *ena_com_get_next_rx_cdesc(
cdesc = (struct ena_eth_io_rx_cdesc_base *)(io_cq->cdesc_addr.virt_addr cdesc = (struct ena_eth_io_rx_cdesc_base *)(io_cq->cdesc_addr.virt_addr
+ (head_masked * io_cq->cdesc_entry_size_in_bytes)); + (head_masked * io_cq->cdesc_entry_size_in_bytes));
desc_phase = (READ_ONCE(cdesc->status) & ENA_ETH_IO_RX_CDESC_BASE_PHASE_MASK) >> desc_phase = (READ_ONCE(cdesc->status) &
ENA_ETH_IO_RX_CDESC_BASE_PHASE_MASK) >>
ENA_ETH_IO_RX_CDESC_BASE_PHASE_SHIFT; ENA_ETH_IO_RX_CDESC_BASE_PHASE_SHIFT;
if (desc_phase != expected_phase) if (desc_phase != expected_phase)
...@@ -62,7 +63,7 @@ static int ena_com_write_bounce_buffer_to_dev(struct ena_com_io_sq *io_sq, ...@@ -62,7 +63,7 @@ static int ena_com_write_bounce_buffer_to_dev(struct ena_com_io_sq *io_sq,
} }
io_sq->entries_in_tx_burst_left--; io_sq->entries_in_tx_burst_left--;
pr_debug("decreasing entries_in_tx_burst_left of queue %d to %d\n", pr_debug("Decreasing entries_in_tx_burst_left of queue %d to %d\n",
io_sq->qid, io_sq->entries_in_tx_burst_left); io_sq->qid, io_sq->entries_in_tx_burst_left);
} }
...@@ -101,12 +102,12 @@ static int ena_com_write_header_to_bounce(struct ena_com_io_sq *io_sq, ...@@ -101,12 +102,12 @@ static int ena_com_write_header_to_bounce(struct ena_com_io_sq *io_sq,
if (unlikely((header_offset + header_len) > if (unlikely((header_offset + header_len) >
llq_info->desc_list_entry_size)) { llq_info->desc_list_entry_size)) {
pr_err("trying to write header larger than llq entry can accommodate\n"); pr_err("Trying to write header larger than llq entry can accommodate\n");
return -EFAULT; return -EFAULT;
} }
if (unlikely(!bounce_buffer)) { if (unlikely(!bounce_buffer)) {
pr_err("bounce buffer is NULL\n"); pr_err("Bounce buffer is NULL\n");
return -EFAULT; return -EFAULT;
} }
...@@ -124,7 +125,7 @@ static void *get_sq_desc_llq(struct ena_com_io_sq *io_sq) ...@@ -124,7 +125,7 @@ static void *get_sq_desc_llq(struct ena_com_io_sq *io_sq)
bounce_buffer = pkt_ctrl->curr_bounce_buf; bounce_buffer = pkt_ctrl->curr_bounce_buf;
if (unlikely(!bounce_buffer)) { if (unlikely(!bounce_buffer)) {
pr_err("bounce buffer is NULL\n"); pr_err("Bounce buffer is NULL\n");
return NULL; return NULL;
} }
...@@ -235,7 +236,8 @@ static u16 ena_com_cdesc_rx_pkt_get(struct ena_com_io_cq *io_cq, ...@@ -235,7 +236,8 @@ static u16 ena_com_cdesc_rx_pkt_get(struct ena_com_io_cq *io_cq,
ena_com_cq_inc_head(io_cq); ena_com_cq_inc_head(io_cq);
count++; count++;
last = (READ_ONCE(cdesc->status) & ENA_ETH_IO_RX_CDESC_BASE_LAST_MASK) >> last = (READ_ONCE(cdesc->status) &
ENA_ETH_IO_RX_CDESC_BASE_LAST_MASK) >>
ENA_ETH_IO_RX_CDESC_BASE_LAST_SHIFT; ENA_ETH_IO_RX_CDESC_BASE_LAST_SHIFT;
} while (!last); } while (!last);
...@@ -248,7 +250,7 @@ static u16 ena_com_cdesc_rx_pkt_get(struct ena_com_io_cq *io_cq, ...@@ -248,7 +250,7 @@ static u16 ena_com_cdesc_rx_pkt_get(struct ena_com_io_cq *io_cq,
io_cq->cur_rx_pkt_cdesc_count = 0; io_cq->cur_rx_pkt_cdesc_count = 0;
io_cq->cur_rx_pkt_cdesc_start_idx = head_masked; io_cq->cur_rx_pkt_cdesc_start_idx = head_masked;
pr_debug("ena q_id: %d packets were completed. first desc idx %u descs# %d\n", pr_debug("ENA q_id: %d packets were completed. first desc idx %u descs# %d\n",
io_cq->qid, *first_cdesc_idx, count); io_cq->qid, *first_cdesc_idx, count);
} else { } else {
io_cq->cur_rx_pkt_cdesc_count += count; io_cq->cur_rx_pkt_cdesc_count += count;
...@@ -352,7 +354,7 @@ static void ena_com_rx_set_flags(struct ena_com_rx_ctx *ena_rx_ctx, ...@@ -352,7 +354,7 @@ static void ena_com_rx_set_flags(struct ena_com_rx_ctx *ena_rx_ctx,
(cdesc->status & ENA_ETH_IO_RX_CDESC_BASE_IPV4_FRAG_MASK) >> (cdesc->status & ENA_ETH_IO_RX_CDESC_BASE_IPV4_FRAG_MASK) >>
ENA_ETH_IO_RX_CDESC_BASE_IPV4_FRAG_SHIFT; ENA_ETH_IO_RX_CDESC_BASE_IPV4_FRAG_SHIFT;
pr_debug("ena_rx_ctx->l3_proto %d ena_rx_ctx->l4_proto %d\nena_rx_ctx->l3_csum_err %d ena_rx_ctx->l4_csum_err %d\nhash frag %d frag: %d cdesc_status: %x\n", pr_debug("l3_proto %d l4_proto %d l3_csum_err %d l4_csum_err %d hash %d frag %d cdesc_status %x\n",
ena_rx_ctx->l3_proto, ena_rx_ctx->l4_proto, ena_rx_ctx->l3_proto, ena_rx_ctx->l4_proto,
ena_rx_ctx->l3_csum_err, ena_rx_ctx->l4_csum_err, ena_rx_ctx->l3_csum_err, ena_rx_ctx->l4_csum_err,
ena_rx_ctx->hash, ena_rx_ctx->frag, cdesc->status); ena_rx_ctx->hash, ena_rx_ctx->frag, cdesc->status);
...@@ -385,7 +387,7 @@ int ena_com_prepare_tx(struct ena_com_io_sq *io_sq, ...@@ -385,7 +387,7 @@ int ena_com_prepare_tx(struct ena_com_io_sq *io_sq,
} }
if (unlikely(header_len > io_sq->tx_max_header_size)) { if (unlikely(header_len > io_sq->tx_max_header_size)) {
pr_err("header size is too large %d max header: %d\n", pr_err("Header size is too large %d max header: %d\n",
header_len, io_sq->tx_max_header_size); header_len, io_sq->tx_max_header_size);
return -EINVAL; return -EINVAL;
} }
...@@ -400,7 +402,7 @@ int ena_com_prepare_tx(struct ena_com_io_sq *io_sq, ...@@ -400,7 +402,7 @@ int ena_com_prepare_tx(struct ena_com_io_sq *io_sq,
rc = ena_com_create_and_store_tx_meta_desc(io_sq, ena_tx_ctx, &have_meta); rc = ena_com_create_and_store_tx_meta_desc(io_sq, ena_tx_ctx, &have_meta);
if (unlikely(rc)) { if (unlikely(rc)) {
pr_err("failed to create and store tx meta desc\n"); pr_err("Failed to create and store tx meta desc\n");
return rc; return rc;
} }
...@@ -523,7 +525,7 @@ int ena_com_rx_pkt(struct ena_com_io_cq *io_cq, ...@@ -523,7 +525,7 @@ int ena_com_rx_pkt(struct ena_com_io_cq *io_cq,
return 0; return 0;
} }
pr_debug("fetch rx packet: queue %d completed desc: %d\n", io_cq->qid, pr_debug("Fetch rx packet: queue %d completed desc: %d\n", io_cq->qid,
nb_hw_desc); nb_hw_desc);
if (unlikely(nb_hw_desc > ena_rx_ctx->max_bufs)) { if (unlikely(nb_hw_desc > ena_rx_ctx->max_bufs)) {
......
...@@ -140,7 +140,7 @@ static inline bool ena_com_is_doorbell_needed(struct ena_com_io_sq *io_sq, ...@@ -140,7 +140,7 @@ static inline bool ena_com_is_doorbell_needed(struct ena_com_io_sq *io_sq,
llq_info->descs_per_entry); llq_info->descs_per_entry);
} }
pr_debug("queue: %d num_descs: %d num_entries_needed: %d\n", io_sq->qid, pr_debug("Queue: %d num_descs: %d num_entries_needed: %d\n", io_sq->qid,
num_descs, num_entries_needed); num_descs, num_entries_needed);
return num_entries_needed > io_sq->entries_in_tx_burst_left; return num_entries_needed > io_sq->entries_in_tx_burst_left;
...@@ -151,13 +151,13 @@ static inline int ena_com_write_sq_doorbell(struct ena_com_io_sq *io_sq) ...@@ -151,13 +151,13 @@ static inline int ena_com_write_sq_doorbell(struct ena_com_io_sq *io_sq)
u16 max_entries_in_tx_burst = io_sq->llq_info.max_entries_in_tx_burst; u16 max_entries_in_tx_burst = io_sq->llq_info.max_entries_in_tx_burst;
u16 tail = io_sq->tail; u16 tail = io_sq->tail;
pr_debug("write submission queue doorbell for queue: %d tail: %d\n", pr_debug("Write submission queue doorbell for queue: %d tail: %d\n",
io_sq->qid, tail); io_sq->qid, tail);
writel(tail, io_sq->db_addr); writel(tail, io_sq->db_addr);
if (is_llq_max_tx_burst_exists(io_sq)) { if (is_llq_max_tx_burst_exists(io_sq)) {
pr_debug("reset available entries in tx burst for queue %d to %d\n", pr_debug("Reset available entries in tx burst for queue %d to %d\n",
io_sq->qid, max_entries_in_tx_burst); io_sq->qid, max_entries_in_tx_burst);
io_sq->entries_in_tx_burst_left = max_entries_in_tx_burst; io_sq->entries_in_tx_burst_left = max_entries_in_tx_burst;
} }
......
...@@ -939,7 +939,7 @@ static void ena_dump_stats_ex(struct ena_adapter *adapter, u8 *buf) ...@@ -939,7 +939,7 @@ static void ena_dump_stats_ex(struct ena_adapter *adapter, u8 *buf)
GFP_ATOMIC); GFP_ATOMIC);
if (!strings_buf) { if (!strings_buf) {
netif_err(adapter, drv, netdev, netif_err(adapter, drv, netdev,
"failed to alloc strings_buf\n"); "Failed to allocate strings_buf\n");
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment