mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-29 05:55:02 +08:00
net: ena: re-organize code to improve readability
Restructure some ethtool to a switch-case blocks to make it more uniform with other similar functions. Also restructure variable declaration to create reversed x-mas tree. Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com> Signed-off-by: Shay Agroskin <shayagr@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
947c54c395
commit
a01f2cd0cc
@ -1979,7 +1979,8 @@ int ena_com_get_dev_attr_feat(struct ena_com_dev *ena_dev,
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (get_resp.u.max_queue_ext.version != ENA_FEATURE_MAX_QUEUE_EXT_VER)
|
||||
if (get_resp.u.max_queue_ext.version !=
|
||||
ENA_FEATURE_MAX_QUEUE_EXT_VER)
|
||||
return -EINVAL;
|
||||
|
||||
memcpy(&get_feat_ctx->max_queue_ext, &get_resp.u.max_queue_ext,
|
||||
|
@ -233,10 +233,13 @@ int ena_get_sset_count(struct net_device *netdev, int sset)
|
||||
{
|
||||
struct ena_adapter *adapter = netdev_priv(netdev);
|
||||
|
||||
if (sset != ETH_SS_STATS)
|
||||
return -EOPNOTSUPP;
|
||||
switch (sset) {
|
||||
case ETH_SS_STATS:
|
||||
return ena_get_sw_stats_count(adapter) +
|
||||
ena_get_hw_stats_count(adapter);
|
||||
}
|
||||
|
||||
return ena_get_sw_stats_count(adapter) + ena_get_hw_stats_count(adapter);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static void ena_queue_strings(struct ena_adapter *adapter, u8 **data)
|
||||
@ -314,10 +317,11 @@ static void ena_get_ethtool_strings(struct net_device *netdev,
|
||||
{
|
||||
struct ena_adapter *adapter = netdev_priv(netdev);
|
||||
|
||||
if (sset != ETH_SS_STATS)
|
||||
return;
|
||||
|
||||
ena_get_strings(adapter, data, adapter->eni_stats_supported);
|
||||
switch (sset) {
|
||||
case ETH_SS_STATS:
|
||||
ena_get_strings(adapter, data, adapter->eni_stats_supported);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int ena_get_link_ksettings(struct net_device *netdev,
|
||||
|
@ -1426,9 +1426,9 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
|
||||
u32 descs,
|
||||
u16 *next_to_clean)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
struct ena_rx_buffer *rx_info;
|
||||
u16 len, req_id, buf = 0;
|
||||
struct sk_buff *skb;
|
||||
void *page_addr;
|
||||
u32 page_offset;
|
||||
void *data_addr;
|
||||
|
Loading…
Reference in New Issue
Block a user