Commit 1cd127fc authored by David Ahern's avatar David Ahern Committed by David S. Miller

ixgbe: Flip to the new dev walk API

Convert ixgbe users to new dev walk API. This is just a code conversion;
no functional change is intended.
Signed-off-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e0e79c8e
...@@ -5012,24 +5012,23 @@ static int ixgbe_fwd_ring_up(struct net_device *vdev, ...@@ -5012,24 +5012,23 @@ static int ixgbe_fwd_ring_up(struct net_device *vdev,
return err; return err;
} }
static void ixgbe_configure_dfwd(struct ixgbe_adapter *adapter) static int ixgbe_upper_dev_walk(struct net_device *upper, void *data)
{ {
struct net_device *upper; if (netif_is_macvlan(upper)) {
struct list_head *iter; struct macvlan_dev *dfwd = netdev_priv(upper);
int err; struct ixgbe_fwd_adapter *vadapter = dfwd->fwd_priv;
netdev_for_each_all_upper_dev_rcu(adapter->netdev, upper, iter) {
if (netif_is_macvlan(upper)) {
struct macvlan_dev *dfwd = netdev_priv(upper);
struct ixgbe_fwd_adapter *vadapter = dfwd->fwd_priv;
if (dfwd->fwd_priv) { if (dfwd->fwd_priv)
err = ixgbe_fwd_ring_up(upper, vadapter); ixgbe_fwd_ring_up(upper, vadapter);
if (err)
continue;
}
}
} }
return 0;
}
static void ixgbe_configure_dfwd(struct ixgbe_adapter *adapter)
{
netdev_walk_all_upper_dev_rcu(adapter->netdev,
ixgbe_upper_dev_walk, NULL);
} }
static void ixgbe_configure(struct ixgbe_adapter *adapter) static void ixgbe_configure(struct ixgbe_adapter *adapter)
...@@ -5448,12 +5447,25 @@ static void ixgbe_fdir_filter_exit(struct ixgbe_adapter *adapter) ...@@ -5448,12 +5447,25 @@ static void ixgbe_fdir_filter_exit(struct ixgbe_adapter *adapter)
spin_unlock(&adapter->fdir_perfect_lock); spin_unlock(&adapter->fdir_perfect_lock);
} }
static int ixgbe_disable_macvlan(struct net_device *upper, void *data)
{
if (netif_is_macvlan(upper)) {
struct macvlan_dev *vlan = netdev_priv(upper);
if (vlan->fwd_priv) {
netif_tx_stop_all_queues(upper);
netif_carrier_off(upper);
netif_tx_disable(upper);
}
}
return 0;
}
void ixgbe_down(struct ixgbe_adapter *adapter) void ixgbe_down(struct ixgbe_adapter *adapter)
{ {
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
struct net_device *upper;
struct list_head *iter;
int i; int i;
/* signal that we are down to the interrupt handler */ /* signal that we are down to the interrupt handler */
...@@ -5477,17 +5489,8 @@ void ixgbe_down(struct ixgbe_adapter *adapter) ...@@ -5477,17 +5489,8 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
netif_tx_disable(netdev); netif_tx_disable(netdev);
/* disable any upper devices */ /* disable any upper devices */
netdev_for_each_all_upper_dev_rcu(adapter->netdev, upper, iter) { netdev_walk_all_upper_dev_rcu(adapter->netdev,
if (netif_is_macvlan(upper)) { ixgbe_disable_macvlan, NULL);
struct macvlan_dev *vlan = netdev_priv(upper);
if (vlan->fwd_priv) {
netif_tx_stop_all_queues(upper);
netif_carrier_off(upper);
netif_tx_disable(upper);
}
}
}
ixgbe_irq_disable(adapter); ixgbe_irq_disable(adapter);
...@@ -6723,6 +6726,18 @@ static void ixgbe_update_default_up(struct ixgbe_adapter *adapter) ...@@ -6723,6 +6726,18 @@ static void ixgbe_update_default_up(struct ixgbe_adapter *adapter)
#endif #endif
} }
static int ixgbe_enable_macvlan(struct net_device *upper, void *data)
{
if (netif_is_macvlan(upper)) {
struct macvlan_dev *vlan = netdev_priv(upper);
if (vlan->fwd_priv)
netif_tx_wake_all_queues(upper);
}
return 0;
}
/** /**
* ixgbe_watchdog_link_is_up - update netif_carrier status and * ixgbe_watchdog_link_is_up - update netif_carrier status and
* print link up message * print link up message
...@@ -6732,8 +6747,6 @@ static void ixgbe_watchdog_link_is_up(struct ixgbe_adapter *adapter) ...@@ -6732,8 +6747,6 @@ static void ixgbe_watchdog_link_is_up(struct ixgbe_adapter *adapter)
{ {
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
struct net_device *upper;
struct list_head *iter;
u32 link_speed = adapter->link_speed; u32 link_speed = adapter->link_speed;
const char *speed_str; const char *speed_str;
bool flow_rx, flow_tx; bool flow_rx, flow_tx;
...@@ -6804,14 +6817,8 @@ static void ixgbe_watchdog_link_is_up(struct ixgbe_adapter *adapter) ...@@ -6804,14 +6817,8 @@ static void ixgbe_watchdog_link_is_up(struct ixgbe_adapter *adapter)
/* enable any upper devices */ /* enable any upper devices */
rtnl_lock(); rtnl_lock();
netdev_for_each_all_upper_dev_rcu(adapter->netdev, upper, iter) { netdev_walk_all_upper_dev_rcu(adapter->netdev,
if (netif_is_macvlan(upper)) { ixgbe_enable_macvlan, NULL);
struct macvlan_dev *vlan = netdev_priv(upper);
if (vlan->fwd_priv)
netif_tx_wake_all_queues(upper);
}
}
rtnl_unlock(); rtnl_unlock();
/* update the default user priority for VFs */ /* update the default user priority for VFs */
...@@ -8345,12 +8352,38 @@ static int ixgbe_configure_clsu32_del_hnode(struct ixgbe_adapter *adapter, ...@@ -8345,12 +8352,38 @@ static int ixgbe_configure_clsu32_del_hnode(struct ixgbe_adapter *adapter,
} }
#ifdef CONFIG_NET_CLS_ACT #ifdef CONFIG_NET_CLS_ACT
struct upper_walk_data {
struct ixgbe_adapter *adapter;
u64 action;
int ifindex;
u8 queue;
};
static int get_macvlan_queue(struct net_device *upper, void *_data)
{
if (netif_is_macvlan(upper)) {
struct macvlan_dev *dfwd = netdev_priv(upper);
struct ixgbe_fwd_adapter *vadapter = dfwd->fwd_priv;
struct upper_walk_data *data = _data;
struct ixgbe_adapter *adapter = data->adapter;
int ifindex = data->ifindex;
if (vadapter && vadapter->netdev->ifindex == ifindex) {
data->queue = adapter->rx_ring[vadapter->rx_base_queue]->reg_idx;
data->action = data->queue;
return 1;
}
}
return 0;
}
static int handle_redirect_action(struct ixgbe_adapter *adapter, int ifindex, static int handle_redirect_action(struct ixgbe_adapter *adapter, int ifindex,
u8 *queue, u64 *action) u8 *queue, u64 *action)
{ {
unsigned int num_vfs = adapter->num_vfs, vf; unsigned int num_vfs = adapter->num_vfs, vf;
struct upper_walk_data data;
struct net_device *upper; struct net_device *upper;
struct list_head *iter;
/* redirect to a SRIOV VF */ /* redirect to a SRIOV VF */
for (vf = 0; vf < num_vfs; ++vf) { for (vf = 0; vf < num_vfs; ++vf) {
...@@ -8368,17 +8401,16 @@ static int handle_redirect_action(struct ixgbe_adapter *adapter, int ifindex, ...@@ -8368,17 +8401,16 @@ static int handle_redirect_action(struct ixgbe_adapter *adapter, int ifindex,
} }
/* redirect to a offloaded macvlan netdev */ /* redirect to a offloaded macvlan netdev */
netdev_for_each_all_upper_dev_rcu(adapter->netdev, upper, iter) { data.adapter = adapter;
if (netif_is_macvlan(upper)) { data.ifindex = ifindex;
struct macvlan_dev *dfwd = netdev_priv(upper); data.action = 0;
struct ixgbe_fwd_adapter *vadapter = dfwd->fwd_priv; data.queue = 0;
if (netdev_walk_all_upper_dev_rcu(adapter->netdev,
if (vadapter && vadapter->netdev->ifindex == ifindex) { get_macvlan_queue, &data)) {
*queue = adapter->rx_ring[vadapter->rx_base_queue]->reg_idx; *action = data.action;
*action = *queue; *queue = data.queue;
return 0;
} return 0;
}
} }
return -EINVAL; return -EINVAL;
......
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