Skip to content

Commit

Permalink
net: introduce and use netdev_features_t for device features sets
Browse files Browse the repository at this point in the history
v2:	add couple missing conversions in drivers
	split unexporting netdev_fix_features()
	implemented %pNF
	convert sock::sk_route_(no?)caps

Signed-off-by: Michał Mirosław <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
osctobe authored and davem330 committed Nov 16, 2011
1 parent a59e2ec commit c8f44af
Show file tree
Hide file tree
Showing 74 changed files with 305 additions and 202 deletions.
9 changes: 5 additions & 4 deletions drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1325,11 +1325,12 @@ static int bond_sethwaddr(struct net_device *bond_dev,
return 0;
}

static u32 bond_fix_features(struct net_device *dev, u32 features)
static netdev_features_t bond_fix_features(struct net_device *dev,
netdev_features_t features)
{
struct slave *slave;
struct bonding *bond = netdev_priv(dev);
u32 mask;
netdev_features_t mask;
int i;

read_lock(&bond->lock);
Expand Down Expand Up @@ -1363,7 +1364,7 @@ static void bond_compute_features(struct bonding *bond)
{
struct slave *slave;
struct net_device *bond_dev = bond->dev;
u32 vlan_features = BOND_VLAN_FEATURES;
netdev_features_t vlan_features = BOND_VLAN_FEATURES;
unsigned short max_hard_header_len = ETH_HLEN;
int i;

Expand Down Expand Up @@ -1897,7 +1898,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
struct bonding *bond = netdev_priv(bond_dev);
struct slave *slave, *oldcurrent;
struct sockaddr addr;
u32 old_features = bond_dev->features;
netdev_features_t old_features = bond_dev->features;

/* slave is not a slave or master is not master of this slave */
if (!(slave_dev->flags & IFF_SLAVE) ||
Expand Down
13 changes: 8 additions & 5 deletions drivers/net/ethernet/atheros/atl1c/atl1c_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ static void atl1c_set_multi(struct net_device *netdev)
}
}

static void __atl1c_vlan_mode(u32 features, u32 *mac_ctrl_data)
static void __atl1c_vlan_mode(netdev_features_t features, u32 *mac_ctrl_data)
{
if (features & NETIF_F_HW_VLAN_RX) {
/* enable VLAN tag insert/strip */
Expand All @@ -422,7 +422,8 @@ static void __atl1c_vlan_mode(u32 features, u32 *mac_ctrl_data)
}
}

static void atl1c_vlan_mode(struct net_device *netdev, u32 features)
static void atl1c_vlan_mode(struct net_device *netdev,
netdev_features_t features)
{
struct atl1c_adapter *adapter = netdev_priv(netdev);
struct pci_dev *pdev = adapter->pdev;
Expand Down Expand Up @@ -482,7 +483,8 @@ static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter,
roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE;
}

static u32 atl1c_fix_features(struct net_device *netdev, u32 features)
static netdev_features_t atl1c_fix_features(struct net_device *netdev,
netdev_features_t features)
{
/*
* Since there is no support for separate rx/tx vlan accel
Expand All @@ -499,9 +501,10 @@ static u32 atl1c_fix_features(struct net_device *netdev, u32 features)
return features;
}

static int atl1c_set_features(struct net_device *netdev, u32 features)
static int atl1c_set_features(struct net_device *netdev,
netdev_features_t features)
{
u32 changed = netdev->features ^ features;
netdev_features_t changed = netdev->features ^ features;

if (changed & NETIF_F_HW_VLAN_RX)
atl1c_vlan_mode(netdev, features);
Expand Down
13 changes: 8 additions & 5 deletions drivers/net/ethernet/atheros/atl1e/atl1e_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ static void atl1e_set_multi(struct net_device *netdev)
}
}

static void __atl1e_vlan_mode(u32 features, u32 *mac_ctrl_data)
static void __atl1e_vlan_mode(netdev_features_t features, u32 *mac_ctrl_data)
{
if (features & NETIF_F_HW_VLAN_RX) {
/* enable VLAN tag insert/strip */
Expand All @@ -324,7 +324,8 @@ static void __atl1e_vlan_mode(u32 features, u32 *mac_ctrl_data)
}
}

static void atl1e_vlan_mode(struct net_device *netdev, u32 features)
static void atl1e_vlan_mode(struct net_device *netdev,
netdev_features_t features)
{
struct atl1e_adapter *adapter = netdev_priv(netdev);
u32 mac_ctrl_data = 0;
Expand Down Expand Up @@ -370,7 +371,8 @@ static int atl1e_set_mac_addr(struct net_device *netdev, void *p)
return 0;
}

static u32 atl1e_fix_features(struct net_device *netdev, u32 features)
static netdev_features_t atl1e_fix_features(struct net_device *netdev,
netdev_features_t features)
{
/*
* Since there is no support for separate rx/tx vlan accel
Expand All @@ -384,9 +386,10 @@ static u32 atl1e_fix_features(struct net_device *netdev, u32 features)
return features;
}

static int atl1e_set_features(struct net_device *netdev, u32 features)
static int atl1e_set_features(struct net_device *netdev,
netdev_features_t features)
{
u32 changed = netdev->features ^ features;
netdev_features_t changed = netdev->features ^ features;

if (changed & NETIF_F_HW_VLAN_RX)
atl1e_vlan_mode(netdev, features);
Expand Down
13 changes: 8 additions & 5 deletions drivers/net/ethernet/atheros/atlx/atl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ static inline void atl2_irq_disable(struct atl2_adapter *adapter)
synchronize_irq(adapter->pdev->irq);
}

static void __atl2_vlan_mode(u32 features, u32 *ctrl)
static void __atl2_vlan_mode(netdev_features_t features, u32 *ctrl)
{
if (features & NETIF_F_HW_VLAN_RX) {
/* enable VLAN tag insert/strip */
Expand All @@ -372,7 +372,8 @@ static void __atl2_vlan_mode(u32 features, u32 *ctrl)
}
}

static void atl2_vlan_mode(struct net_device *netdev, u32 features)
static void atl2_vlan_mode(struct net_device *netdev,
netdev_features_t features)
{
struct atl2_adapter *adapter = netdev_priv(netdev);
u32 ctrl;
Expand All @@ -391,7 +392,8 @@ static void atl2_restore_vlan(struct atl2_adapter *adapter)
atl2_vlan_mode(adapter->netdev, adapter->netdev->features);
}

static u32 atl2_fix_features(struct net_device *netdev, u32 features)
static netdev_features_t atl2_fix_features(struct net_device *netdev,
netdev_features_t features)
{
/*
* Since there is no support for separate rx/tx vlan accel
Expand All @@ -405,9 +407,10 @@ static u32 atl2_fix_features(struct net_device *netdev, u32 features)
return features;
}

static int atl2_set_features(struct net_device *netdev, u32 features)
static int atl2_set_features(struct net_device *netdev,
netdev_features_t features)
{
u32 changed = netdev->features ^ features;
netdev_features_t changed = netdev->features ^ features;

if (changed & NETIF_F_HW_VLAN_RX)
atl2_vlan_mode(netdev, features);
Expand Down
13 changes: 8 additions & 5 deletions drivers/net/ethernet/atheros/atlx/atlx.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static void atlx_link_chg_task(struct work_struct *work)
spin_unlock_irqrestore(&adapter->lock, flags);
}

static void __atlx_vlan_mode(u32 features, u32 *ctrl)
static void __atlx_vlan_mode(netdev_features_t features, u32 *ctrl)
{
if (features & NETIF_F_HW_VLAN_RX) {
/* enable VLAN tag insert/strip */
Expand All @@ -222,7 +222,8 @@ static void __atlx_vlan_mode(u32 features, u32 *ctrl)
}
}

static void atlx_vlan_mode(struct net_device *netdev, u32 features)
static void atlx_vlan_mode(struct net_device *netdev,
netdev_features_t features)
{
struct atlx_adapter *adapter = netdev_priv(netdev);
unsigned long flags;
Expand All @@ -242,7 +243,8 @@ static void atlx_restore_vlan(struct atlx_adapter *adapter)
atlx_vlan_mode(adapter->netdev, adapter->netdev->features);
}

static u32 atlx_fix_features(struct net_device *netdev, u32 features)
static netdev_features_t atlx_fix_features(struct net_device *netdev,
netdev_features_t features)
{
/*
* Since there is no support for separate rx/tx vlan accel
Expand All @@ -256,9 +258,10 @@ static u32 atlx_fix_features(struct net_device *netdev, u32 features)
return features;
}

static int atlx_set_features(struct net_device *netdev, u32 features)
static int atlx_set_features(struct net_device *netdev,
netdev_features_t features)
{
u32 changed = netdev->features ^ features;
netdev_features_t changed = netdev->features ^ features;

if (changed & NETIF_F_HW_VLAN_RX)
atlx_vlan_mode(netdev, features);
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ethernet/broadcom/bnx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -7571,8 +7571,8 @@ bnx2_set_phys_id(struct net_device *dev, enum ethtool_phys_id_state state)
return 0;
}

static u32
bnx2_fix_features(struct net_device *dev, u32 features)
static netdev_features_t
bnx2_fix_features(struct net_device *dev, netdev_features_t features)
{
struct bnx2 *bp = netdev_priv(dev);

Expand All @@ -7583,7 +7583,7 @@ bnx2_fix_features(struct net_device *dev, u32 features)
}

static int
bnx2_set_features(struct net_device *dev, u32 features)
bnx2_set_features(struct net_device *dev, netdev_features_t features)
{
struct bnx2 *bp = netdev_priv(dev);

Expand Down
5 changes: 3 additions & 2 deletions drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -3398,7 +3398,8 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu)
return bnx2x_reload_if_running(dev);
}

u32 bnx2x_fix_features(struct net_device *dev, u32 features)
netdev_features_t bnx2x_fix_features(struct net_device *dev,
netdev_features_t features)
{
struct bnx2x *bp = netdev_priv(dev);

Expand All @@ -3409,7 +3410,7 @@ u32 bnx2x_fix_features(struct net_device *dev, u32 features)
return features;
}

int bnx2x_set_features(struct net_device *dev, u32 features)
int bnx2x_set_features(struct net_device *dev, netdev_features_t features)
{
struct bnx2x *bp = netdev_priv(dev);
u32 flags = bp->flags;
Expand Down
5 changes: 3 additions & 2 deletions drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,9 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu);
*/
int bnx2x_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type);
#endif
u32 bnx2x_fix_features(struct net_device *dev, u32 features);
int bnx2x_set_features(struct net_device *dev, u32 features);
netdev_features_t bnx2x_fix_features(struct net_device *dev,
netdev_features_t features);
int bnx2x_set_features(struct net_device *dev, netdev_features_t features);

/**
* bnx2x_tx_timeout - tx timeout netdev callback
Expand Down
11 changes: 6 additions & 5 deletions drivers/net/ethernet/broadcom/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -6968,7 +6968,7 @@ static int tg3_phy_lpbk_set(struct tg3 *tp, u32 speed, bool extlpbk)
return 0;
}

static void tg3_set_loopback(struct net_device *dev, u32 features)
static void tg3_set_loopback(struct net_device *dev, netdev_features_t features)
{
struct tg3 *tp = netdev_priv(dev);

Expand All @@ -6994,7 +6994,8 @@ static void tg3_set_loopback(struct net_device *dev, u32 features)
}
}

static u32 tg3_fix_features(struct net_device *dev, u32 features)
static netdev_features_t tg3_fix_features(struct net_device *dev,
netdev_features_t features)
{
struct tg3 *tp = netdev_priv(dev);

Expand All @@ -7004,9 +7005,9 @@ static u32 tg3_fix_features(struct net_device *dev, u32 features)
return features;
}

static int tg3_set_features(struct net_device *dev, u32 features)
static int tg3_set_features(struct net_device *dev, netdev_features_t features)
{
u32 changed = dev->features ^ features;
netdev_features_t changed = dev->features ^ features;

if ((changed & NETIF_F_LOOPBACK) && netif_running(dev))
tg3_set_loopback(dev, features);
Expand Down Expand Up @@ -15313,7 +15314,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
u32 sndmbx, rcvmbx, intmbx;
char str[40];
u64 dma_mask, persist_dma_mask;
u32 features = 0;
netdev_features_t features = 0;

printk_once(KERN_INFO "%s\n", version);

Expand Down
7 changes: 4 additions & 3 deletions drivers/net/ethernet/chelsio/cxgb/cxgb2.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,8 @@ static int t1_set_mac_addr(struct net_device *dev, void *p)
return 0;
}

static u32 t1_fix_features(struct net_device *dev, u32 features)
static netdev_features_t t1_fix_features(struct net_device *dev,
netdev_features_t features)
{
/*
* Since there is no support for separate rx/tx vlan accel
Expand All @@ -864,9 +865,9 @@ static u32 t1_fix_features(struct net_device *dev, u32 features)
return features;
}

static int t1_set_features(struct net_device *dev, u32 features)
static int t1_set_features(struct net_device *dev, netdev_features_t features)
{
u32 changed = dev->features ^ features;
netdev_features_t changed = dev->features ^ features;
struct adapter *adapter = dev->ml_priv;

if (changed & NETIF_F_HW_VLAN_RX)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/chelsio/cxgb/sge.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ static inline void setup_ring_params(struct adapter *adapter, u64 addr,
/*
* Enable/disable VLAN acceleration.
*/
void t1_vlan_mode(struct adapter *adapter, u32 features)
void t1_vlan_mode(struct adapter *adapter, netdev_features_t features)
{
struct sge *sge = adapter->sge;

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/chelsio/cxgb/sge.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ irqreturn_t t1_interrupt(int irq, void *cookie);
int t1_poll(struct napi_struct *, int);

netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev);
void t1_vlan_mode(struct adapter *adapter, u32 features);
void t1_vlan_mode(struct adapter *adapter, netdev_features_t features);
void t1_sge_start(struct sge *);
void t1_sge_stop(struct sge *);
int t1_sge_intr_error_handler(struct sge *);
Expand Down
9 changes: 5 additions & 4 deletions drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2532,7 +2532,7 @@ static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p)
}
}

static void cxgb_vlan_mode(struct net_device *dev, u32 features)
static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features)
{
struct port_info *pi = netdev_priv(dev);
struct adapter *adapter = pi->adapter;
Expand All @@ -2553,7 +2553,8 @@ static void cxgb_vlan_mode(struct net_device *dev, u32 features)
t3_synchronize_rx(adapter, pi);
}

static u32 cxgb_fix_features(struct net_device *dev, u32 features)
static netdev_features_t cxgb_fix_features(struct net_device *dev,
netdev_features_t features)
{
/*
* Since there is no support for separate rx/tx vlan accel
Expand All @@ -2567,9 +2568,9 @@ static u32 cxgb_fix_features(struct net_device *dev, u32 features)
return features;
}

static int cxgb_set_features(struct net_device *dev, u32 features)
static int cxgb_set_features(struct net_device *dev, netdev_features_t features)
{
u32 changed = dev->features ^ features;
netdev_features_t changed = dev->features ^ features;

if (changed & NETIF_F_HW_VLAN_RX)
cxgb_vlan_mode(dev, features);
Expand Down
Loading

0 comments on commit c8f44af

Please sign in to comment.