Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 150529
b: refs/heads/master
c: 1ce8e7b
h: refs/heads/master
i:
  150527: 1df12be
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed May 27, 2009
1 parent 9c00f4f commit 284b9a1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0bb32417ff0f6ac385e4eec3ef6641950bbb3694
refs/heads/master: 1ce8e7b57b3a4527ef83da1c5c7bd8a6b9d87b56
5 changes: 1 addition & 4 deletions trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,6 @@ struct net_device
#define to_net_dev(d) container_of(d, struct net_device, dev)

#define NETDEV_ALIGN 32
#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)

static inline
struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
Expand Down Expand Up @@ -976,9 +975,7 @@ static inline bool netdev_uses_trailer_tags(struct net_device *dev)
*/
static inline void *netdev_priv(const struct net_device *dev)
{
return (char *)dev + ((sizeof(struct net_device)
+ NETDEV_ALIGN_CONST)
& ~NETDEV_ALIGN_CONST);
return (char *)dev + ALIGN(sizeof(struct net_device), NETDEV_ALIGN);
}

/* Set the sysfs physical device reference for the network logical device
Expand Down
9 changes: 4 additions & 5 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -4988,18 +4988,18 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
struct netdev_queue *tx;
struct net_device *dev;
size_t alloc_size;
void *p;
struct net_device *p;

BUG_ON(strlen(name) >= sizeof(dev->name));

alloc_size = sizeof(struct net_device);
if (sizeof_priv) {
/* ensure 32-byte alignment of private area */
alloc_size = (alloc_size + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST;
alloc_size = ALIGN(alloc_size, NETDEV_ALIGN);
alloc_size += sizeof_priv;
}
/* ensure 32-byte alignment of whole construct */
alloc_size += NETDEV_ALIGN_CONST;
alloc_size += NETDEV_ALIGN - 1;

p = kzalloc(alloc_size, GFP_KERNEL);
if (!p) {
Expand All @@ -5014,8 +5014,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
goto free_p;
}

dev = (struct net_device *)
(((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
dev = PTR_ALIGN(p, NETDEV_ALIGN);
dev->padded = (char *)dev - (char *)p;

if (dev_addr_init(dev))
Expand Down
8 changes: 2 additions & 6 deletions trunk/net/mac80211/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
* +-------------------------+
*
*/
priv_size = ((sizeof(struct ieee80211_local) +
NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST) +
priv_data_len;
priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;

wiphy = wiphy_new(&mac80211_config_ops, priv_size);

Expand All @@ -754,9 +752,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,

local->hw.wiphy = wiphy;

local->hw.priv = (char *)local +
((sizeof(struct ieee80211_local) +
NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN);

BUG_ON(!ops->tx);
BUG_ON(!ops->start);
Expand Down

0 comments on commit 284b9a1

Please sign in to comment.