diff options
author | Varun Prakash <varun@chelsio.com> | 2016-09-13 11:53:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-09-15 20:49:19 -0400 |
commit | b65eef0a5b1a635f9b056cf74d3ef778f3794a75 (patch) | |
tree | d3aa3cd881f9079fd6b5c0a15462a608407e1c62 | |
parent | 95554761d1db54f7c058cc0ed389282ce7361999 (diff) |
libcxgb,iw_cxgb4,cxgbit: add cxgb_is_neg_adv()
Add cxgb_is_neg_adv() in libcxgb_cm.h to remove
it's duplicate definitions from cxgb4/cm.c and
cxgbit/cxgbit_cm.c.
Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/infiniband/hw/cxgb4/cm.c | 15 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h | 9 | ||||
-rw-r--r-- | drivers/target/iscsi/cxgbit/cxgbit_cm.c | 11 |
3 files changed, 13 insertions, 22 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index a08a74839c13..b35fdc0e0004 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -1987,15 +1987,6 @@ static inline int act_open_has_tid(int status) | |||
1987 | status != CPL_ERR_CONN_EXIST); | 1987 | status != CPL_ERR_CONN_EXIST); |
1988 | } | 1988 | } |
1989 | 1989 | ||
1990 | /* Returns whether a CPL status conveys negative advice. | ||
1991 | */ | ||
1992 | static int is_neg_adv(unsigned int status) | ||
1993 | { | ||
1994 | return status == CPL_ERR_RTX_NEG_ADVICE || | ||
1995 | status == CPL_ERR_PERSIST_NEG_ADVICE || | ||
1996 | status == CPL_ERR_KEEPALV_NEG_ADVICE; | ||
1997 | } | ||
1998 | |||
1999 | static char *neg_adv_str(unsigned int status) | 1990 | static char *neg_adv_str(unsigned int status) |
2000 | { | 1991 | { |
2001 | switch (status) { | 1992 | switch (status) { |
@@ -2235,7 +2226,7 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb) | |||
2235 | PDBG("%s ep %p atid %u status %u errno %d\n", __func__, ep, atid, | 2226 | PDBG("%s ep %p atid %u status %u errno %d\n", __func__, ep, atid, |
2236 | status, status2errno(status)); | 2227 | status, status2errno(status)); |
2237 | 2228 | ||
2238 | if (is_neg_adv(status)) { | 2229 | if (cxgb_is_neg_adv(status)) { |
2239 | PDBG("%s Connection problems for atid %u status %u (%s)\n", | 2230 | PDBG("%s Connection problems for atid %u status %u (%s)\n", |
2240 | __func__, atid, status, neg_adv_str(status)); | 2231 | __func__, atid, status, neg_adv_str(status)); |
2241 | ep->stats.connect_neg_adv++; | 2232 | ep->stats.connect_neg_adv++; |
@@ -2751,7 +2742,7 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb) | |||
2751 | if (!ep) | 2742 | if (!ep) |
2752 | return 0; | 2743 | return 0; |
2753 | 2744 | ||
2754 | if (is_neg_adv(req->status)) { | 2745 | if (cxgb_is_neg_adv(req->status)) { |
2755 | PDBG("%s Negative advice on abort- tid %u status %d (%s)\n", | 2746 | PDBG("%s Negative advice on abort- tid %u status %d (%s)\n", |
2756 | __func__, ep->hwtid, req->status, | 2747 | __func__, ep->hwtid, req->status, |
2757 | neg_adv_str(req->status)); | 2748 | neg_adv_str(req->status)); |
@@ -4227,7 +4218,7 @@ static int peer_abort_intr(struct c4iw_dev *dev, struct sk_buff *skb) | |||
4227 | kfree_skb(skb); | 4218 | kfree_skb(skb); |
4228 | return 0; | 4219 | return 0; |
4229 | } | 4220 | } |
4230 | if (is_neg_adv(req->status)) { | 4221 | if (cxgb_is_neg_adv(req->status)) { |
4231 | PDBG("%s Negative advice on abort- tid %u status %d (%s)\n", | 4222 | PDBG("%s Negative advice on abort- tid %u status %d (%s)\n", |
4232 | __func__, ep->hwtid, req->status, | 4223 | __func__, ep->hwtid, req->status, |
4233 | neg_adv_str(req->status)); | 4224 | neg_adv_str(req->status)); |
diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h index c4df04a4a323..57fcc9899234 100644 --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h | |||
@@ -47,4 +47,13 @@ struct dst_entry * | |||
47 | cxgb_find_route6(struct cxgb4_lld_info *, | 47 | cxgb_find_route6(struct cxgb4_lld_info *, |
48 | struct net_device *(*)(struct net_device *), | 48 | struct net_device *(*)(struct net_device *), |
49 | __u8 *, __u8 *, __be16, __be16, u8, __u32); | 49 | __u8 *, __u8 *, __be16, __be16, u8, __u32); |
50 | |||
51 | /* Returns whether a CPL status conveys negative advice. | ||
52 | */ | ||
53 | static inline bool cxgb_is_neg_adv(unsigned int status) | ||
54 | { | ||
55 | return status == CPL_ERR_RTX_NEG_ADVICE || | ||
56 | status == CPL_ERR_PERSIST_NEG_ADVICE || | ||
57 | status == CPL_ERR_KEEPALV_NEG_ADVICE; | ||
58 | } | ||
50 | #endif | 59 | #endif |
diff --git a/drivers/target/iscsi/cxgbit/cxgbit_cm.c b/drivers/target/iscsi/cxgbit/cxgbit_cm.c index e961ac4bf5db..c46bdd5d58ca 100644 --- a/drivers/target/iscsi/cxgbit/cxgbit_cm.c +++ b/drivers/target/iscsi/cxgbit/cxgbit_cm.c | |||
@@ -73,15 +73,6 @@ out: | |||
73 | return wr_waitp->ret; | 73 | return wr_waitp->ret; |
74 | } | 74 | } |
75 | 75 | ||
76 | /* Returns whether a CPL status conveys negative advice. | ||
77 | */ | ||
78 | static int cxgbit_is_neg_adv(unsigned int status) | ||
79 | { | ||
80 | return status == CPL_ERR_RTX_NEG_ADVICE || | ||
81 | status == CPL_ERR_PERSIST_NEG_ADVICE || | ||
82 | status == CPL_ERR_KEEPALV_NEG_ADVICE; | ||
83 | } | ||
84 | |||
85 | static int cxgbit_np_hashfn(const struct cxgbit_np *cnp) | 76 | static int cxgbit_np_hashfn(const struct cxgbit_np *cnp) |
86 | { | 77 | { |
87 | return ((unsigned long)cnp >> 10) & (NP_INFO_HASH_SIZE - 1); | 78 | return ((unsigned long)cnp >> 10) & (NP_INFO_HASH_SIZE - 1); |
@@ -1704,7 +1695,7 @@ static void cxgbit_abort_req_rss(struct cxgbit_sock *csk, struct sk_buff *skb) | |||
1704 | pr_debug("%s: csk %p; tid %u; state %d\n", | 1695 | pr_debug("%s: csk %p; tid %u; state %d\n", |
1705 | __func__, csk, tid, csk->com.state); | 1696 | __func__, csk, tid, csk->com.state); |
1706 | 1697 | ||
1707 | if (cxgbit_is_neg_adv(hdr->status)) { | 1698 | if (cxgb_is_neg_adv(hdr->status)) { |
1708 | pr_err("%s: got neg advise %d on tid %u\n", | 1699 | pr_err("%s: got neg advise %d on tid %u\n", |
1709 | __func__, hdr->status, tid); | 1700 | __func__, hdr->status, tid); |
1710 | goto rel_skb; | 1701 | goto rel_skb; |