Commit 534cb283 authored by David S. Miller's avatar David S. Miller

cxgb3: Convert t3_l2t_get() over to dst_neigh_lookup().

This means passing in a suitable destination address.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1d248b1c
...@@ -1374,7 +1374,7 @@ static int pass_accept_req(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) ...@@ -1374,7 +1374,7 @@ static int pass_accept_req(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
goto reject; goto reject;
} }
dst = &rt->dst; dst = &rt->dst;
l2t = t3_l2t_get(tdev, dst, NULL); l2t = t3_l2t_get(tdev, dst, NULL, &req->peer_ip);
if (!l2t) { if (!l2t) {
printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n", printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n",
__func__); __func__);
...@@ -1942,7 +1942,8 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ...@@ -1942,7 +1942,8 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
goto fail3; goto fail3;
} }
ep->dst = &rt->dst; ep->dst = &rt->dst;
ep->l2t = t3_l2t_get(ep->com.tdev, ep->dst, NULL); ep->l2t = t3_l2t_get(ep->com.tdev, ep->dst, NULL,
&cm_id->remote_addr.sin_addr.s_addr);
if (!ep->l2t) { if (!ep->l2t) {
printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__); printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__);
err = -ENOMEM; err = -ENOMEM;
......
...@@ -63,7 +63,8 @@ static const unsigned int ATID_BASE = 0x10000; ...@@ -63,7 +63,8 @@ static const unsigned int ATID_BASE = 0x10000;
static void cxgb_neigh_update(struct neighbour *neigh); static void cxgb_neigh_update(struct neighbour *neigh);
static void cxgb_redirect(struct dst_entry *old, struct neighbour *old_neigh, static void cxgb_redirect(struct dst_entry *old, struct neighbour *old_neigh,
struct dst_entry *new, struct neighbour *new_neigh); struct dst_entry *new, struct neighbour *new_neigh,
const void *daddr);
static inline int offload_activated(struct t3cdev *tdev) static inline int offload_activated(struct t3cdev *tdev)
{ {
...@@ -970,7 +971,8 @@ static int nb_callback(struct notifier_block *self, unsigned long event, ...@@ -970,7 +971,8 @@ static int nb_callback(struct notifier_block *self, unsigned long event,
case (NETEVENT_REDIRECT):{ case (NETEVENT_REDIRECT):{
struct netevent_redirect *nr = ctx; struct netevent_redirect *nr = ctx;
cxgb_redirect(nr->old, nr->old_neigh, cxgb_redirect(nr->old, nr->old_neigh,
nr->new, nr->new_neigh); nr->new, nr->new_neigh,
nr->daddr);
cxgb_neigh_update(nr->new_neigh); cxgb_neigh_update(nr->new_neigh);
break; break;
} }
...@@ -1110,7 +1112,8 @@ static void set_l2t_ix(struct t3cdev *tdev, u32 tid, struct l2t_entry *e) ...@@ -1110,7 +1112,8 @@ static void set_l2t_ix(struct t3cdev *tdev, u32 tid, struct l2t_entry *e)
} }
static void cxgb_redirect(struct dst_entry *old, struct neighbour *old_neigh, static void cxgb_redirect(struct dst_entry *old, struct neighbour *old_neigh,
struct dst_entry *new, struct neighbour *new_neigh) struct dst_entry *new, struct neighbour *new_neigh,
const void *daddr)
{ {
struct net_device *olddev, *newdev; struct net_device *olddev, *newdev;
struct tid_info *ti; struct tid_info *ti;
...@@ -1139,7 +1142,7 @@ static void cxgb_redirect(struct dst_entry *old, struct neighbour *old_neigh, ...@@ -1139,7 +1142,7 @@ static void cxgb_redirect(struct dst_entry *old, struct neighbour *old_neigh,
} }
/* Add new L2T entry */ /* Add new L2T entry */
e = t3_l2t_get(tdev, new, newdev); e = t3_l2t_get(tdev, new, newdev, daddr);
if (!e) { if (!e) {
printk(KERN_ERR "%s: couldn't allocate new l2t entry!\n", printk(KERN_ERR "%s: couldn't allocate new l2t entry!\n",
__func__); __func__);
......
...@@ -299,7 +299,7 @@ static inline void reuse_entry(struct l2t_entry *e, struct neighbour *neigh) ...@@ -299,7 +299,7 @@ static inline void reuse_entry(struct l2t_entry *e, struct neighbour *neigh)
} }
struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst, struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst,
struct net_device *dev) struct net_device *dev, const void *daddr)
{ {
struct l2t_entry *e = NULL; struct l2t_entry *e = NULL;
struct neighbour *neigh; struct neighbour *neigh;
...@@ -311,7 +311,7 @@ struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst, ...@@ -311,7 +311,7 @@ struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst,
int smt_idx; int smt_idx;
rcu_read_lock(); rcu_read_lock();
neigh = dst_get_neighbour_noref(dst); neigh = dst_neigh_lookup(dst, daddr);
if (!neigh) if (!neigh)
goto done_rcu; goto done_rcu;
...@@ -360,6 +360,8 @@ struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst, ...@@ -360,6 +360,8 @@ struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst,
done_unlock: done_unlock:
write_unlock_bh(&d->lock); write_unlock_bh(&d->lock);
done_rcu: done_rcu:
if (neigh)
neigh_release(neigh);
rcu_read_unlock(); rcu_read_unlock();
return e; return e;
} }
......
...@@ -110,7 +110,7 @@ static inline void set_arp_failure_handler(struct sk_buff *skb, ...@@ -110,7 +110,7 @@ static inline void set_arp_failure_handler(struct sk_buff *skb,
void t3_l2e_free(struct l2t_data *d, struct l2t_entry *e); void t3_l2e_free(struct l2t_data *d, struct l2t_entry *e);
void t3_l2t_update(struct t3cdev *dev, struct neighbour *neigh); void t3_l2t_update(struct t3cdev *dev, struct neighbour *neigh);
struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst, struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst,
struct net_device *dev); struct net_device *dev, const void *daddr);
int t3_l2t_send_slow(struct t3cdev *dev, struct sk_buff *skb, int t3_l2t_send_slow(struct t3cdev *dev, struct sk_buff *skb,
struct l2t_entry *e); struct l2t_entry *e);
void t3_l2t_send_event(struct t3cdev *dev, struct l2t_entry *e); void t3_l2t_send_event(struct t3cdev *dev, struct l2t_entry *e);
......
...@@ -966,7 +966,8 @@ static int init_act_open(struct cxgbi_sock *csk) ...@@ -966,7 +966,8 @@ static int init_act_open(struct cxgbi_sock *csk)
csk->saddr.sin_addr.s_addr = chba->ipv4addr; csk->saddr.sin_addr.s_addr = chba->ipv4addr;
csk->rss_qid = 0; csk->rss_qid = 0;
csk->l2t = t3_l2t_get(t3dev, dst, ndev); csk->l2t = t3_l2t_get(t3dev, dst, ndev,
&csk->daddr.sin_addr.s_addr);
if (!csk->l2t) { if (!csk->l2t) {
pr_err("NO l2t available.\n"); pr_err("NO l2t available.\n");
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