Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 327555
b: refs/heads/master
c: afaa945
h: refs/heads/master
i:
  327553: 27296ea
  327551: 6d63e39
v: v3
  • Loading branch information
Alexander Duyck authored and Peter P Waskiewicz Jr committed Aug 16, 2012
1 parent 87ff2ef commit af1aec9
Show file tree
Hide file tree
Showing 20 changed files with 137 additions and 199 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: e6a04b1d3ff9d5af219b2fcaebe0ef04733d597c
refs/heads/master: afaa9459de639591ff3318fd215a813c8d794759
27 changes: 1 addition & 26 deletions trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ static bool ixgbe_alloc_mapped_page(struct ixgbe_ring *rx_ring,
}

bi->dma = dma;
bi->page_offset ^= ixgbe_rx_bufsz(rx_ring);
bi->page_offset = 0;

return true;
}
Expand Down Expand Up @@ -4129,27 +4129,6 @@ void ixgbe_reset(struct ixgbe_adapter *adapter)
hw->mac.ops.set_vmdq_san_mac(hw, VMDQ_P(0));
}

/**
* ixgbe_init_rx_page_offset - initialize page offset values for Rx buffers
* @rx_ring: ring to setup
*
* On many IA platforms the L1 cache has a critical stride of 4K, this
* results in each receive buffer starting in the same cache set. To help
* reduce the pressure on this cache set we can interleave the offsets so
* that only every other buffer will be in the same cache set.
**/
static void ixgbe_init_rx_page_offset(struct ixgbe_ring *rx_ring)
{
struct ixgbe_rx_buffer *rx_buffer = rx_ring->rx_buffer_info;
u16 i;

for (i = 0; i < rx_ring->count; i += 2) {
rx_buffer[0].page_offset = 0;
rx_buffer[1].page_offset = ixgbe_rx_bufsz(rx_ring);
rx_buffer = &rx_buffer[2];
}
}

/**
* ixgbe_clean_rx_ring - Free Rx Buffers per Queue
* @rx_ring: ring to free buffers from
Expand Down Expand Up @@ -4195,8 +4174,6 @@ static void ixgbe_clean_rx_ring(struct ixgbe_ring *rx_ring)
size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count;
memset(rx_ring->rx_buffer_info, 0, size);

ixgbe_init_rx_page_offset(rx_ring);

/* Zero out the descriptor ring */
memset(rx_ring->desc, 0, rx_ring->size);

Expand Down Expand Up @@ -4646,8 +4623,6 @@ int ixgbe_setup_rx_resources(struct ixgbe_ring *rx_ring)
rx_ring->next_to_clean = 0;
rx_ring->next_to_use = 0;

ixgbe_init_rx_page_offset(rx_ring);

return 0;
err:
vfree(rx_ring->rx_buffer_info);
Expand Down
15 changes: 0 additions & 15 deletions trunk/include/linux/packet_diag.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ struct packet_diag_req {

#define PACKET_SHOW_INFO 0x00000001 /* Basic packet_sk information */
#define PACKET_SHOW_MCLIST 0x00000002 /* A set of packet_diag_mclist-s */
#define PACKET_SHOW_RING_CFG 0x00000004 /* Rings configuration parameters */
#define PACKET_SHOW_FANOUT 0x00000008

struct packet_diag_msg {
__u8 pdiag_family;
Expand All @@ -29,9 +27,6 @@ struct packet_diag_msg {
enum {
PACKET_DIAG_INFO,
PACKET_DIAG_MCLIST,
PACKET_DIAG_RX_RING,
PACKET_DIAG_TX_RING,
PACKET_DIAG_FANOUT,

PACKET_DIAG_MAX,
};
Expand Down Expand Up @@ -59,14 +54,4 @@ struct packet_diag_mclist {
__u8 pdmc_addr[MAX_ADDR_LEN];
};

struct packet_diag_ring {
__u32 pdr_block_size;
__u32 pdr_block_nr;
__u32 pdr_frame_size;
__u32 pdr_frame_nr;
__u32 pdr_retire_tmo;
__u32 pdr_sizeof_priv;
__u32 pdr_features;
};

#endif
8 changes: 4 additions & 4 deletions trunk/include/linux/tipc_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@

#define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */
#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */
#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* obsoleted */
#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* obsoleted */
#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* tx none, rx unsigned */
#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */
#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */
#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */
#define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */
Expand All @@ -115,8 +115,8 @@
#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */
#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */
#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */
#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* obsoleted */
#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* obsoleted */
#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */
#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */
#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */
#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */
#define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */
Expand Down
2 changes: 0 additions & 2 deletions trunk/net/ipv6/ip6_tunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1312,8 +1312,6 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
}
ip6_tnl_parm_from_user(&p1, &p);
t = ip6_tnl_locate(net, &p1, 0);
} else {
memset(&p, 0, sizeof(p));
}
if (t == NULL)
t = netdev_priv(dev);
Expand Down
23 changes: 20 additions & 3 deletions trunk/net/packet/af_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,24 @@ static void prb_fill_vlan_info(struct tpacket_kbdq_core *,
struct tpacket3_hdr *);
static void packet_flush_mclist(struct sock *sk);

#define PACKET_FANOUT_MAX 256

struct packet_fanout {
#ifdef CONFIG_NET_NS
struct net *net;
#endif
unsigned int num_members;
u16 id;
u8 type;
u8 defrag;
atomic_t rr_cur;
struct list_head list;
struct sock *arr[PACKET_FANOUT_MAX];
spinlock_t lock;
atomic_t sk_ref;
struct packet_type prot_hook ____cacheline_aligned_in_smp;
};

struct packet_skb_cb {
unsigned int origlen;
union {
Expand Down Expand Up @@ -1130,8 +1148,7 @@ static int packet_rcv_fanout(struct sk_buff *skb, struct net_device *dev,
return po->prot_hook.func(skb, dev, &po->prot_hook, orig_dev);
}

DEFINE_MUTEX(fanout_mutex);
EXPORT_SYMBOL_GPL(fanout_mutex);
static DEFINE_MUTEX(fanout_mutex);
static LIST_HEAD(fanout_list);

static void __fanout_link(struct sock *sk, struct packet_sock *po)
Expand Down Expand Up @@ -1243,9 +1260,9 @@ static void fanout_release(struct sock *sk)
if (!f)
return;

mutex_lock(&fanout_mutex);
po->fanout = NULL;

mutex_lock(&fanout_mutex);
if (atomic_dec_and_test(&f->sk_ref)) {
list_del(&f->list);
dev_remove_pack(&f->prot_hook);
Expand Down
68 changes: 1 addition & 67 deletions trunk/net/packet/diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,70 +67,12 @@ static int pdiag_put_mclist(const struct packet_sock *po, struct sk_buff *nlskb)
return 0;
}

static int pdiag_put_ring(struct packet_ring_buffer *ring, int ver, int nl_type,
struct sk_buff *nlskb)
{
struct packet_diag_ring pdr;

if (!ring->pg_vec || ((ver > TPACKET_V2) &&
(nl_type == PACKET_DIAG_TX_RING)))
return 0;

pdr.pdr_block_size = ring->pg_vec_pages << PAGE_SHIFT;
pdr.pdr_block_nr = ring->pg_vec_len;
pdr.pdr_frame_size = ring->frame_size;
pdr.pdr_frame_nr = ring->frame_max + 1;

if (ver > TPACKET_V2) {
pdr.pdr_retire_tmo = ring->prb_bdqc.retire_blk_tov;
pdr.pdr_sizeof_priv = ring->prb_bdqc.blk_sizeof_priv;
pdr.pdr_features = ring->prb_bdqc.feature_req_word;
} else {
pdr.pdr_retire_tmo = 0;
pdr.pdr_sizeof_priv = 0;
pdr.pdr_features = 0;
}

return nla_put(nlskb, nl_type, sizeof(pdr), &pdr);
}

static int pdiag_put_rings_cfg(struct packet_sock *po, struct sk_buff *skb)
{
int ret;

mutex_lock(&po->pg_vec_lock);
ret = pdiag_put_ring(&po->rx_ring, po->tp_version,
PACKET_DIAG_RX_RING, skb);
if (!ret)
ret = pdiag_put_ring(&po->tx_ring, po->tp_version,
PACKET_DIAG_TX_RING, skb);
mutex_unlock(&po->pg_vec_lock);

return ret;
}

static int pdiag_put_fanout(struct packet_sock *po, struct sk_buff *nlskb)
{
int ret = 0;

mutex_lock(&fanout_mutex);
if (po->fanout) {
u32 val;

val = (u32)po->fanout->id | ((u32)po->fanout->type << 16);
ret = nla_put_u32(nlskb, PACKET_DIAG_FANOUT, val);
}
mutex_unlock(&fanout_mutex);

return ret;
}

static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct packet_diag_req *req,
u32 pid, u32 seq, u32 flags, int sk_ino)
{
struct nlmsghdr *nlh;
struct packet_diag_msg *rp;
struct packet_sock *po = pkt_sk(sk);
const struct packet_sock *po = pkt_sk(sk);

nlh = nlmsg_put(skb, pid, seq, SOCK_DIAG_BY_FAMILY, sizeof(*rp), flags);
if (!nlh)
Expand All @@ -151,14 +93,6 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct packet_diag
pdiag_put_mclist(po, skb))
goto out_nlmsg_trim;

if ((req->pdiag_show & PACKET_SHOW_RING_CFG) &&
pdiag_put_rings_cfg(po, skb))
goto out_nlmsg_trim;

if ((req->pdiag_show & PACKET_SHOW_FANOUT) &&
pdiag_put_fanout(po, skb))
goto out_nlmsg_trim;

return nlmsg_end(skb, nlh);

out_nlmsg_trim:
Expand Down
20 changes: 1 addition & 19 deletions trunk/net/packet/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,7 @@ struct packet_ring_buffer {
atomic_t pending;
};

extern struct mutex fanout_mutex;
#define PACKET_FANOUT_MAX 256

struct packet_fanout {
#ifdef CONFIG_NET_NS
struct net *net;
#endif
unsigned int num_members;
u16 id;
u8 type;
u8 defrag;
atomic_t rr_cur;
struct list_head list;
struct sock *arr[PACKET_FANOUT_MAX];
spinlock_t lock;
atomic_t sk_ref;
struct packet_type prot_hook ____cacheline_aligned_in_smp;
};

struct packet_fanout;
struct packet_sock {
/* struct sock has to be the first member of packet_sock */
struct sock sk;
Expand Down
21 changes: 19 additions & 2 deletions trunk/net/tipc/bearer.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ struct tipc_bearer tipc_bearers[MAX_BEARERS];

static void bearer_disable(struct tipc_bearer *b_ptr);

/**
* media_name_valid - validate media name
*
* Returns 1 if media name is valid, otherwise 0.
*/
static int media_name_valid(const char *name)
{
u32 len;

len = strlen(name);
if ((len + 1) > TIPC_MAX_MEDIA_NAME)
return 0;
return strspn(name, tipc_alphabet) == len;
}

/**
* tipc_media_find - locates specified media object by name
*/
Expand Down Expand Up @@ -87,7 +102,7 @@ int tipc_register_media(struct tipc_media *m_ptr)

write_lock_bh(&tipc_net_lock);

if ((strlen(m_ptr->name) + 1) > TIPC_MAX_MEDIA_NAME)
if (!media_name_valid(m_ptr->name))
goto exit;
if ((m_ptr->bcast_addr.media_id != m_ptr->type_id) ||
!m_ptr->bcast_addr.broadcast)
Expand Down Expand Up @@ -191,7 +206,9 @@ static int bearer_name_validate(const char *name,

/* validate component parts of bearer name */
if ((media_len <= 1) || (media_len > TIPC_MAX_MEDIA_NAME) ||
(if_len <= 1) || (if_len > TIPC_MAX_IF_NAME))
(if_len <= 1) || (if_len > TIPC_MAX_IF_NAME) ||
(strspn(media_name, tipc_alphabet) != (media_len - 1)) ||
(strspn(if_name, tipc_alphabet) != (if_len - 1)))
return 0;

/* return bearer name components, if necessary */
Expand Down
Loading

0 comments on commit af1aec9

Please sign in to comment.