Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 183328
b: refs/heads/master
c: 6d2e3ea
h: refs/heads/master
v: v3
  • Loading branch information
Octavian Purdila authored and David S. Miller committed Dec 27, 2009
1 parent 3df31f9 commit a12c627
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 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: 0f7b67dd9e1192976f5e5a78934c7a339ff7c45f
refs/heads/master: 6d2e3ea284463d5ab34e9cf2a41d0b8627b95d02
11 changes: 11 additions & 0 deletions trunk/include/net/llc.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ struct llc_addr {
#define LLC_SAP_STATE_INACTIVE 1
#define LLC_SAP_STATE_ACTIVE 2

#define LLC_SK_DEV_HASH_BITS 6
#define LLC_SK_DEV_HASH_ENTRIES (1<<LLC_SK_DEV_HASH_BITS)

/**
* struct llc_sap - Defines the SAP component
*
Expand All @@ -56,8 +59,16 @@ struct llc_sap {
struct list_head node;
spinlock_t sk_lock;
struct hlist_nulls_head sk_list;
struct hlist_head sk_dev_hash[LLC_SK_DEV_HASH_ENTRIES];
};

static inline
struct hlist_head *llc_sk_dev_hash(struct llc_sap *sap, int ifindex)
{
return &sap->sk_dev_hash[ifindex % LLC_SK_DEV_HASH_ENTRIES];
}


#define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */
#define LLC_DEST_SAP 1 /* Type 1 goes here */
#define LLC_DEST_CONN 2 /* Type 2 goes here */
Expand Down
1 change: 1 addition & 0 deletions trunk/include/net/llc_conn.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ struct llc_sock {
received and caused sending FRMR.
Used for resending FRMR */
u32 cmsg_flags;
struct hlist_node dev_hash_node;
};

static inline struct llc_sock *llc_sk(const struct sock *sk)
Expand Down
10 changes: 9 additions & 1 deletion trunk/net/llc/llc_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,10 +682,15 @@ static int llc_find_offset(int state, int ev_type)
*/
void llc_sap_add_socket(struct llc_sap *sap, struct sock *sk)
{
struct llc_sock *llc = llc_sk(sk);
struct hlist_head *dev_hb = llc_sk_dev_hash(sap, llc->dev->ifindex);

llc_sap_hold(sap);
spin_lock_bh(&sap->sk_lock);
llc_sk(sk)->sap = sap;

spin_lock_bh(&sap->sk_lock);
sk_nulls_add_node_rcu(sk, &sap->sk_list);
hlist_add_head(&llc->dev_hash_node, dev_hb);
spin_unlock_bh(&sap->sk_lock);
}

Expand All @@ -699,8 +704,11 @@ void llc_sap_add_socket(struct llc_sap *sap, struct sock *sk)
*/
void llc_sap_remove_socket(struct llc_sap *sap, struct sock *sk)
{
struct llc_sock *llc = llc_sk(sk);

spin_lock_bh(&sap->sk_lock);
sk_nulls_del_node_init_rcu(sk);
hlist_del(&llc->dev_hash_node);
spin_unlock_bh(&sap->sk_lock);
llc_sap_put(sap);
}
Expand Down
8 changes: 6 additions & 2 deletions trunk/net/llc/llc_sap.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,14 @@ static void llc_sap_mcast(struct llc_sap *sap,
{
int i = 0, count = 256 / sizeof(struct sock *);
struct sock *sk, *stack[count];
struct hlist_nulls_node *node;
struct hlist_node *node;
struct llc_sock *llc;
struct hlist_head *dev_hb = llc_sk_dev_hash(sap, skb->dev->ifindex);

spin_lock_bh(&sap->sk_lock);
sk_nulls_for_each_rcu(sk, node, &sap->sk_list) {
hlist_for_each_entry(llc, node, dev_hb, dev_hash_node) {

sk = &llc->sk;

if (!llc_mcast_match(sap, laddr, skb, sk))
continue;
Expand Down

0 comments on commit a12c627

Please sign in to comment.