Commit c6d3d73a authored by Shannon Nelson's avatar Shannon Nelson Committed by David S. Miller

ionic: clean up bitflag usage

Remove the unused flags field and and fix the bitflag names
to include the _F_ flag hint.
Signed-off-by: default avatarShannon Nelson <snelson@pensando.io>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b7f55b81
......@@ -440,7 +440,7 @@ static int ionic_set_coalesce(struct net_device *netdev,
if (coal != lif->rx_coalesce_hw) {
lif->rx_coalesce_hw = coal;
if (test_bit(IONIC_LIF_UP, lif->state)) {
if (test_bit(IONIC_LIF_F_UP, lif->state)) {
for (i = 0; i < lif->nxqs; i++) {
qcq = lif->rxqcqs[i].qcq;
ionic_intr_coal_init(lif->ionic->idev.intr_ctrl,
......@@ -487,11 +487,11 @@ static int ionic_set_ringparam(struct net_device *netdev,
ring->rx_pending == lif->nrxq_descs)
return 0;
err = ionic_wait_for_bit(lif, IONIC_LIF_QUEUE_RESET);
err = ionic_wait_for_bit(lif, IONIC_LIF_F_QUEUE_RESET);
if (err)
return err;
running = test_bit(IONIC_LIF_UP, lif->state);
running = test_bit(IONIC_LIF_F_UP, lif->state);
if (running)
ionic_stop(netdev);
......@@ -500,7 +500,7 @@ static int ionic_set_ringparam(struct net_device *netdev,
if (running)
ionic_open(netdev);
clear_bit(IONIC_LIF_QUEUE_RESET, lif->state);
clear_bit(IONIC_LIF_F_QUEUE_RESET, lif->state);
return 0;
}
......@@ -531,11 +531,11 @@ static int ionic_set_channels(struct net_device *netdev,
if (ch->combined_count == lif->nxqs)
return 0;
err = ionic_wait_for_bit(lif, IONIC_LIF_QUEUE_RESET);
err = ionic_wait_for_bit(lif, IONIC_LIF_F_QUEUE_RESET);
if (err)
return err;
running = test_bit(IONIC_LIF_UP, lif->state);
running = test_bit(IONIC_LIF_F_UP, lif->state);
if (running)
ionic_stop(netdev);
......@@ -543,7 +543,7 @@ static int ionic_set_channels(struct net_device *netdev,
if (running)
ionic_open(netdev);
clear_bit(IONIC_LIF_QUEUE_RESET, lif->state);
clear_bit(IONIC_LIF_F_QUEUE_RESET, lif->state);
return 0;
}
......@@ -553,7 +553,7 @@ static u32 ionic_get_priv_flags(struct net_device *netdev)
struct ionic_lif *lif = netdev_priv(netdev);
u32 priv_flags = 0;
if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state))
if (test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state))
priv_flags |= PRIV_F_SW_DBG_STATS;
return priv_flags;
......@@ -562,14 +562,10 @@ static u32 ionic_get_priv_flags(struct net_device *netdev)
static int ionic_set_priv_flags(struct net_device *netdev, u32 priv_flags)
{
struct ionic_lif *lif = netdev_priv(netdev);
u32 flags = lif->flags;
clear_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state);
clear_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state);
if (priv_flags & PRIV_F_SW_DBG_STATS)
set_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state);
if (flags != lif->flags)
lif->flags = flags;
set_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state);
return 0;
}
......
......@@ -84,7 +84,7 @@ static void ionic_link_status_check(struct ionic_lif *lif)
netdev_info(netdev, "Link up - %d Gbps\n",
le32_to_cpu(lif->info->status.link_speed) / 1000);
if (test_bit(IONIC_LIF_UP, lif->state)) {
if (test_bit(IONIC_LIF_F_UP, lif->state)) {
netif_tx_wake_all_queues(lif->netdev);
netif_carrier_on(netdev);
}
......@@ -93,12 +93,12 @@ static void ionic_link_status_check(struct ionic_lif *lif)
/* carrier off first to avoid watchdog timeout */
netif_carrier_off(netdev);
if (test_bit(IONIC_LIF_UP, lif->state))
if (test_bit(IONIC_LIF_F_UP, lif->state))
netif_tx_stop_all_queues(netdev);
}
link_out:
clear_bit(IONIC_LIF_LINK_CHECK_REQUESTED, lif->state);
clear_bit(IONIC_LIF_F_LINK_CHECK_REQUESTED, lif->state);
}
static void ionic_link_status_check_request(struct ionic_lif *lif)
......@@ -106,7 +106,7 @@ static void ionic_link_status_check_request(struct ionic_lif *lif)
struct ionic_deferred_work *work;
/* we only need one request outstanding at a time */
if (test_and_set_bit(IONIC_LIF_LINK_CHECK_REQUESTED, lif->state))
if (test_and_set_bit(IONIC_LIF_F_LINK_CHECK_REQUESTED, lif->state))
return;
if (in_interrupt()) {
......@@ -1579,7 +1579,7 @@ int ionic_open(struct net_device *netdev)
netif_set_real_num_tx_queues(netdev, lif->nxqs);
netif_set_real_num_rx_queues(netdev, lif->nxqs);
set_bit(IONIC_LIF_UP, lif->state);
set_bit(IONIC_LIF_F_UP, lif->state);
ionic_link_status_check_request(lif);
if (netif_carrier_ok(netdev))
......@@ -1599,13 +1599,13 @@ int ionic_stop(struct net_device *netdev)
struct ionic_lif *lif = netdev_priv(netdev);
int err = 0;
if (!test_bit(IONIC_LIF_UP, lif->state)) {
if (!test_bit(IONIC_LIF_F_UP, lif->state)) {
dev_dbg(lif->ionic->dev, "%s: %s state=DOWN\n",
__func__, lif->name);
return 0;
}
dev_dbg(lif->ionic->dev, "%s: %s state=UP\n", __func__, lif->name);
clear_bit(IONIC_LIF_UP, lif->state);
clear_bit(IONIC_LIF_F_UP, lif->state);
/* carrier off before disabling queues to avoid watchdog timeout */
netif_carrier_off(netdev);
......@@ -1872,7 +1872,7 @@ int ionic_reset_queues(struct ionic_lif *lif)
/* Put off the next watchdog timeout */
netif_trans_update(lif->netdev);
err = ionic_wait_for_bit(lif, IONIC_LIF_QUEUE_RESET);
err = ionic_wait_for_bit(lif, IONIC_LIF_F_QUEUE_RESET);
if (err)
return err;
......@@ -1882,7 +1882,7 @@ int ionic_reset_queues(struct ionic_lif *lif)
if (!err && running)
ionic_open(lif->netdev);
clear_bit(IONIC_LIF_QUEUE_RESET, lif->state);
clear_bit(IONIC_LIF_F_QUEUE_RESET, lif->state);
return err;
}
......@@ -2049,10 +2049,10 @@ void ionic_lifs_free(struct ionic *ionic)
static void ionic_lif_deinit(struct ionic_lif *lif)
{
if (!test_bit(IONIC_LIF_INITED, lif->state))
if (!test_bit(IONIC_LIF_F_INITED, lif->state))
return;
clear_bit(IONIC_LIF_INITED, lif->state);
clear_bit(IONIC_LIF_F_INITED, lif->state);
ionic_rx_filters_deinit(lif);
ionic_lif_rss_deinit(lif);
......@@ -2288,7 +2288,7 @@ static int ionic_lif_init(struct ionic_lif *lif)
lif->rx_copybreak = IONIC_RX_COPYBREAK_DEFAULT;
set_bit(IONIC_LIF_INITED, lif->state);
set_bit(IONIC_LIF_F_INITED, lif->state);
INIT_WORK(&lif->tx_timeout_work, ionic_tx_timeout_work);
......
......@@ -121,14 +121,14 @@ struct ionic_lif_sw_stats {
};
enum ionic_lif_state_flags {
IONIC_LIF_INITED,
IONIC_LIF_SW_DEBUG_STATS,
IONIC_LIF_UP,
IONIC_LIF_LINK_CHECK_REQUESTED,
IONIC_LIF_QUEUE_RESET,
IONIC_LIF_F_INITED,
IONIC_LIF_F_SW_DEBUG_STATS,
IONIC_LIF_F_UP,
IONIC_LIF_F_LINK_CHECK_REQUESTED,
IONIC_LIF_F_QUEUE_RESET,
/* leave this as last */
IONIC_LIF_STATE_SIZE
IONIC_LIF_F_STATE_SIZE
};
#define IONIC_LIF_NAME_MAX_SZ 32
......@@ -136,7 +136,7 @@ struct ionic_lif {
char name[IONIC_LIF_NAME_MAX_SZ];
struct list_head list;
struct net_device *netdev;
DECLARE_BITMAP(state, IONIC_LIF_STATE_SIZE);
DECLARE_BITMAP(state, IONIC_LIF_F_STATE_SIZE);
struct ionic *ionic;
bool registered;
unsigned int index;
......@@ -179,7 +179,6 @@ struct ionic_lif {
u32 rx_coalesce_usecs; /* what the user asked for */
u32 rx_coalesce_hw; /* what the hw is using */
u32 flags;
struct work_struct tx_timeout_work;
};
......
......@@ -118,8 +118,8 @@ static u64 ionic_sw_stats_get_count(struct ionic_lif *lif)
/* rx stats */
total += MAX_Q(lif) * IONIC_NUM_RX_STATS;
if (test_bit(IONIC_LIF_UP, lif->state) &&
test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) {
if (test_bit(IONIC_LIF_F_UP, lif->state) &&
test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state)) {
/* tx debug stats */
total += MAX_Q(lif) * (IONIC_NUM_DBG_CQ_STATS +
IONIC_NUM_TX_Q_STATS +
......@@ -151,8 +151,8 @@ static void ionic_sw_stats_get_strings(struct ionic_lif *lif, u8 **buf)
*buf += ETH_GSTRING_LEN;
}
if (test_bit(IONIC_LIF_UP, lif->state) &&
test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) {
if (test_bit(IONIC_LIF_F_UP, lif->state) &&
test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state)) {
for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) {
snprintf(*buf, ETH_GSTRING_LEN,
"txq_%d_%s",
......@@ -190,8 +190,8 @@ static void ionic_sw_stats_get_strings(struct ionic_lif *lif, u8 **buf)
*buf += ETH_GSTRING_LEN;
}
if (test_bit(IONIC_LIF_UP, lif->state) &&
test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) {
if (test_bit(IONIC_LIF_F_UP, lif->state) &&
test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state)) {
for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) {
snprintf(*buf, ETH_GSTRING_LEN,
"rxq_%d_cq_%s",
......@@ -247,8 +247,8 @@ static void ionic_sw_stats_get_values(struct ionic_lif *lif, u64 **buf)
(*buf)++;
}
if (test_bit(IONIC_LIF_UP, lif->state) &&
test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) {
if (test_bit(IONIC_LIF_F_UP, lif->state) &&
test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state)) {
txqcq = lif_to_txqcq(lif, q_num);
for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) {
**buf = IONIC_READ_STAT64(&txqcq->q,
......@@ -281,8 +281,8 @@ static void ionic_sw_stats_get_values(struct ionic_lif *lif, u64 **buf)
(*buf)++;
}
if (test_bit(IONIC_LIF_UP, lif->state) &&
test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) {
if (test_bit(IONIC_LIF_F_UP, lif->state) &&
test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state)) {
rxqcq = lif_to_rxqcq(lif, q_num);
for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) {
**buf = IONIC_READ_STAT64(&rxqcq->cq,
......
......@@ -158,7 +158,7 @@ static void ionic_rx_clean(struct ionic_queue *q, struct ionic_desc_info *desc_i
}
/* no packet processing while resetting */
if (unlikely(test_bit(IONIC_LIF_QUEUE_RESET, q->lif->state))) {
if (unlikely(test_bit(IONIC_LIF_F_QUEUE_RESET, q->lif->state))) {
stats->dropped++;
return;
}
......@@ -1023,7 +1023,7 @@ netdev_tx_t ionic_start_xmit(struct sk_buff *skb, struct net_device *netdev)
int ndescs;
int err;
if (unlikely(!test_bit(IONIC_LIF_UP, lif->state))) {
if (unlikely(!test_bit(IONIC_LIF_F_UP, lif->state))) {
dev_kfree_skb(skb);
return NETDEV_TX_OK;
}
......
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