aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/nes/nes_cm.c
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2008-04-17 00:01:09 -0400
committerRoland Dreier <rolandd@cisco.com>2008-04-17 00:01:09 -0400
commit1a855fbfb65e0b7b5cce00d7c6a61185ed765edf (patch)
tree7f6bfd3a7e17abf99fa6d529f9dec3842f701a38 /drivers/infiniband/hw/nes/nes_cm.c
parent71e0957c6291da030e6f89351846225876731df3 (diff)
RDMA/nes: Make symbols used only in a single source file static
Avoid namespace pollution and allow the compiler to optimize better. Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/nes/nes_cm.c')
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.c97
1 files changed, 61 insertions, 36 deletions
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 81c8e462521..456da13b68d 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -80,7 +80,30 @@ static struct nes_cm_listener *mini_cm_listen(struct nes_cm_core *,
80static int add_ref_cm_node(struct nes_cm_node *); 80static int add_ref_cm_node(struct nes_cm_node *);
81static int rem_ref_cm_node(struct nes_cm_core *, struct nes_cm_node *); 81static int rem_ref_cm_node(struct nes_cm_core *, struct nes_cm_node *);
82static int mini_cm_del_listen(struct nes_cm_core *, struct nes_cm_listener *); 82static int mini_cm_del_listen(struct nes_cm_core *, struct nes_cm_listener *);
83 83static struct sk_buff *form_cm_frame(struct sk_buff *, struct nes_cm_node *,
84 void *, u32, void *, u32, u8);
85static struct sk_buff *get_free_pkt(struct nes_cm_node *cm_node);
86
87static struct nes_cm_node *mini_cm_connect(struct nes_cm_core *,
88 struct nes_vnic *,
89 struct ietf_mpa_frame *,
90 struct nes_cm_info *);
91static int mini_cm_accept(struct nes_cm_core *, struct ietf_mpa_frame *,
92 struct nes_cm_node *);
93static int mini_cm_reject(struct nes_cm_core *, struct ietf_mpa_frame *,
94 struct nes_cm_node *);
95static int mini_cm_close(struct nes_cm_core *, struct nes_cm_node *);
96static int mini_cm_recv_pkt(struct nes_cm_core *, struct nes_vnic *,
97 struct sk_buff *);
98static int mini_cm_dealloc_core(struct nes_cm_core *);
99static int mini_cm_get(struct nes_cm_core *);
100static int mini_cm_set(struct nes_cm_core *, u32, u32);
101static int nes_cm_disconn_true(struct nes_qp *);
102static int nes_cm_post_event(struct nes_cm_event *event);
103static int nes_disconnect(struct nes_qp *nesqp, int abrupt);
104static void nes_disconnect_worker(struct work_struct *work);
105static int send_ack(struct nes_cm_node *cm_node);
106static int send_fin(struct nes_cm_node *cm_node, struct sk_buff *skb);
84 107
85/* External CM API Interface */ 108/* External CM API Interface */
86/* instance of function pointers for client API */ 109/* instance of function pointers for client API */
@@ -99,7 +122,7 @@ static struct nes_cm_ops nes_cm_api = {
99 mini_cm_set 122 mini_cm_set
100}; 123};
101 124
102struct nes_cm_core *g_cm_core; 125static struct nes_cm_core *g_cm_core;
103 126
104atomic_t cm_connects; 127atomic_t cm_connects;
105atomic_t cm_accepts; 128atomic_t cm_accepts;
@@ -149,7 +172,7 @@ static struct nes_cm_event *create_event(struct nes_cm_node *cm_node,
149/** 172/**
150 * send_mpa_request 173 * send_mpa_request
151 */ 174 */
152int send_mpa_request(struct nes_cm_node *cm_node) 175static int send_mpa_request(struct nes_cm_node *cm_node)
153{ 176{
154 struct sk_buff *skb; 177 struct sk_buff *skb;
155 int ret; 178 int ret;
@@ -243,8 +266,9 @@ static int handle_exception_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb
243 * form_cm_frame - get a free packet and build empty frame Use 266 * form_cm_frame - get a free packet and build empty frame Use
244 * node info to build. 267 * node info to build.
245 */ 268 */
246struct sk_buff *form_cm_frame(struct sk_buff *skb, struct nes_cm_node *cm_node, 269static struct sk_buff *form_cm_frame(struct sk_buff *skb, struct nes_cm_node *cm_node,
247 void *options, u32 optionsize, void *data, u32 datasize, u8 flags) 270 void *options, u32 optionsize, void *data,
271 u32 datasize, u8 flags)
248{ 272{
249 struct tcphdr *tcph; 273 struct tcphdr *tcph;
250 struct iphdr *iph; 274 struct iphdr *iph;
@@ -442,7 +466,7 @@ int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb,
442/** 466/**
443 * nes_cm_timer_tick 467 * nes_cm_timer_tick
444 */ 468 */
445void nes_cm_timer_tick(unsigned long pass) 469static void nes_cm_timer_tick(unsigned long pass)
446{ 470{
447 unsigned long flags, qplockflags; 471 unsigned long flags, qplockflags;
448 unsigned long nexttimeout = jiffies + NES_LONG_TIME; 472 unsigned long nexttimeout = jiffies + NES_LONG_TIME;
@@ -644,7 +668,7 @@ void nes_cm_timer_tick(unsigned long pass)
644/** 668/**
645 * send_syn 669 * send_syn
646 */ 670 */
647int send_syn(struct nes_cm_node *cm_node, u32 sendack) 671static int send_syn(struct nes_cm_node *cm_node, u32 sendack)
648{ 672{
649 int ret; 673 int ret;
650 int flags = SET_SYN; 674 int flags = SET_SYN;
@@ -710,7 +734,7 @@ int send_syn(struct nes_cm_node *cm_node, u32 sendack)
710/** 734/**
711 * send_reset 735 * send_reset
712 */ 736 */
713int send_reset(struct nes_cm_node *cm_node) 737static int send_reset(struct nes_cm_node *cm_node)
714{ 738{
715 int ret; 739 int ret;
716 struct sk_buff *skb = get_free_pkt(cm_node); 740 struct sk_buff *skb = get_free_pkt(cm_node);
@@ -732,7 +756,7 @@ int send_reset(struct nes_cm_node *cm_node)
732/** 756/**
733 * send_ack 757 * send_ack
734 */ 758 */
735int send_ack(struct nes_cm_node *cm_node) 759static int send_ack(struct nes_cm_node *cm_node)
736{ 760{
737 int ret; 761 int ret;
738 struct sk_buff *skb = get_free_pkt(cm_node); 762 struct sk_buff *skb = get_free_pkt(cm_node);
@@ -752,7 +776,7 @@ int send_ack(struct nes_cm_node *cm_node)
752/** 776/**
753 * send_fin 777 * send_fin
754 */ 778 */
755int send_fin(struct nes_cm_node *cm_node, struct sk_buff *skb) 779static int send_fin(struct nes_cm_node *cm_node, struct sk_buff *skb)
756{ 780{
757 int ret; 781 int ret;
758 782
@@ -775,7 +799,7 @@ int send_fin(struct nes_cm_node *cm_node, struct sk_buff *skb)
775/** 799/**
776 * get_free_pkt 800 * get_free_pkt
777 */ 801 */
778struct sk_buff *get_free_pkt(struct nes_cm_node *cm_node) 802static struct sk_buff *get_free_pkt(struct nes_cm_node *cm_node)
779{ 803{
780 struct sk_buff *skb, *new_skb; 804 struct sk_buff *skb, *new_skb;
781 805
@@ -1272,8 +1296,8 @@ static int process_options(struct nes_cm_node *cm_node, u8 *optionsloc, u32 opti
1272/** 1296/**
1273 * process_packet 1297 * process_packet
1274 */ 1298 */
1275int process_packet(struct nes_cm_node *cm_node, struct sk_buff *skb, 1299static int process_packet(struct nes_cm_node *cm_node, struct sk_buff *skb,
1276 struct nes_cm_core *cm_core) 1300 struct nes_cm_core *cm_core)
1277{ 1301{
1278 int optionsize; 1302 int optionsize;
1279 int datasize; 1303 int datasize;
@@ -1631,9 +1655,10 @@ static struct nes_cm_listener *mini_cm_listen(struct nes_cm_core *cm_core,
1631/** 1655/**
1632 * mini_cm_connect - make a connection node with params 1656 * mini_cm_connect - make a connection node with params
1633 */ 1657 */
1634struct nes_cm_node *mini_cm_connect(struct nes_cm_core *cm_core, 1658static struct nes_cm_node *mini_cm_connect(struct nes_cm_core *cm_core,
1635 struct nes_vnic *nesvnic, struct ietf_mpa_frame *mpa_frame, 1659 struct nes_vnic *nesvnic,
1636 struct nes_cm_info *cm_info) 1660 struct ietf_mpa_frame *mpa_frame,
1661 struct nes_cm_info *cm_info)
1637{ 1662{
1638 int ret = 0; 1663 int ret = 0;
1639 struct nes_cm_node *cm_node; 1664 struct nes_cm_node *cm_node;
@@ -1717,8 +1742,8 @@ struct nes_cm_node *mini_cm_connect(struct nes_cm_core *cm_core,
1717 * mini_cm_accept - accept a connection 1742 * mini_cm_accept - accept a connection
1718 * This function is never called 1743 * This function is never called
1719 */ 1744 */
1720int mini_cm_accept(struct nes_cm_core *cm_core, struct ietf_mpa_frame *mpa_frame, 1745static int mini_cm_accept(struct nes_cm_core *cm_core, struct ietf_mpa_frame *mpa_frame,
1721 struct nes_cm_node *cm_node) 1746 struct nes_cm_node *cm_node)
1722{ 1747{
1723 return 0; 1748 return 0;
1724} 1749}
@@ -1727,9 +1752,9 @@ int mini_cm_accept(struct nes_cm_core *cm_core, struct ietf_mpa_frame *mpa_frame
1727/** 1752/**
1728 * mini_cm_reject - reject and teardown a connection 1753 * mini_cm_reject - reject and teardown a connection
1729 */ 1754 */
1730int mini_cm_reject(struct nes_cm_core *cm_core, 1755static int mini_cm_reject(struct nes_cm_core *cm_core,
1731 struct ietf_mpa_frame *mpa_frame, 1756 struct ietf_mpa_frame *mpa_frame,
1732 struct nes_cm_node *cm_node) 1757 struct nes_cm_node *cm_node)
1733{ 1758{
1734 int ret = 0; 1759 int ret = 0;
1735 struct sk_buff *skb; 1760 struct sk_buff *skb;
@@ -1761,7 +1786,7 @@ int mini_cm_reject(struct nes_cm_core *cm_core,
1761/** 1786/**
1762 * mini_cm_close 1787 * mini_cm_close
1763 */ 1788 */
1764int mini_cm_close(struct nes_cm_core *cm_core, struct nes_cm_node *cm_node) 1789static int mini_cm_close(struct nes_cm_core *cm_core, struct nes_cm_node *cm_node)
1765{ 1790{
1766 int ret = 0; 1791 int ret = 0;
1767 1792
@@ -1808,8 +1833,8 @@ int mini_cm_close(struct nes_cm_core *cm_core, struct nes_cm_node *cm_node)
1808 * recv_pkt - recv an ETHERNET packet, and process it through CM 1833 * recv_pkt - recv an ETHERNET packet, and process it through CM
1809 * node state machine 1834 * node state machine
1810 */ 1835 */
1811int mini_cm_recv_pkt(struct nes_cm_core *cm_core, struct nes_vnic *nesvnic, 1836static int mini_cm_recv_pkt(struct nes_cm_core *cm_core, struct nes_vnic *nesvnic,
1812 struct sk_buff *skb) 1837 struct sk_buff *skb)
1813{ 1838{
1814 struct nes_cm_node *cm_node = NULL; 1839 struct nes_cm_node *cm_node = NULL;
1815 struct nes_cm_listener *listener = NULL; 1840 struct nes_cm_listener *listener = NULL;
@@ -1898,7 +1923,7 @@ int mini_cm_recv_pkt(struct nes_cm_core *cm_core, struct nes_vnic *nesvnic,
1898/** 1923/**
1899 * nes_cm_alloc_core - allocate a top level instance of a cm core 1924 * nes_cm_alloc_core - allocate a top level instance of a cm core
1900 */ 1925 */
1901struct nes_cm_core *nes_cm_alloc_core(void) 1926static struct nes_cm_core *nes_cm_alloc_core(void)
1902{ 1927{
1903 int i; 1928 int i;
1904 1929
@@ -1958,7 +1983,7 @@ struct nes_cm_core *nes_cm_alloc_core(void)
1958/** 1983/**
1959 * mini_cm_dealloc_core - deallocate a top level instance of a cm core 1984 * mini_cm_dealloc_core - deallocate a top level instance of a cm core
1960 */ 1985 */
1961int mini_cm_dealloc_core(struct nes_cm_core *cm_core) 1986static int mini_cm_dealloc_core(struct nes_cm_core *cm_core)
1962{ 1987{
1963 nes_debug(NES_DBG_CM, "De-Alloc CM Core (%p)\n", cm_core); 1988 nes_debug(NES_DBG_CM, "De-Alloc CM Core (%p)\n", cm_core);
1964 1989
@@ -1983,7 +2008,7 @@ int mini_cm_dealloc_core(struct nes_cm_core *cm_core)
1983/** 2008/**
1984 * mini_cm_get 2009 * mini_cm_get
1985 */ 2010 */
1986int mini_cm_get(struct nes_cm_core *cm_core) 2011static int mini_cm_get(struct nes_cm_core *cm_core)
1987{ 2012{
1988 return cm_core->state; 2013 return cm_core->state;
1989} 2014}
@@ -1992,7 +2017,7 @@ int mini_cm_get(struct nes_cm_core *cm_core)
1992/** 2017/**
1993 * mini_cm_set 2018 * mini_cm_set
1994 */ 2019 */
1995int mini_cm_set(struct nes_cm_core *cm_core, u32 type, u32 value) 2020static int mini_cm_set(struct nes_cm_core *cm_core, u32 type, u32 value)
1996{ 2021{
1997 int ret = 0; 2022 int ret = 0;
1998 2023
@@ -2109,7 +2134,7 @@ int nes_cm_disconn(struct nes_qp *nesqp)
2109/** 2134/**
2110 * nes_disconnect_worker 2135 * nes_disconnect_worker
2111 */ 2136 */
2112void nes_disconnect_worker(struct work_struct *work) 2137static void nes_disconnect_worker(struct work_struct *work)
2113{ 2138{
2114 struct nes_qp *nesqp = container_of(work, struct nes_qp, disconn_work); 2139 struct nes_qp *nesqp = container_of(work, struct nes_qp, disconn_work);
2115 2140
@@ -2122,7 +2147,7 @@ void nes_disconnect_worker(struct work_struct *work)
2122/** 2147/**
2123 * nes_cm_disconn_true 2148 * nes_cm_disconn_true
2124 */ 2149 */
2125int nes_cm_disconn_true(struct nes_qp *nesqp) 2150static int nes_cm_disconn_true(struct nes_qp *nesqp)
2126{ 2151{
2127 unsigned long flags; 2152 unsigned long flags;
2128 int ret = 0; 2153 int ret = 0;
@@ -2265,7 +2290,7 @@ int nes_cm_disconn_true(struct nes_qp *nesqp)
2265/** 2290/**
2266 * nes_disconnect 2291 * nes_disconnect
2267 */ 2292 */
2268int nes_disconnect(struct nes_qp *nesqp, int abrupt) 2293static int nes_disconnect(struct nes_qp *nesqp, int abrupt)
2269{ 2294{
2270 int ret = 0; 2295 int ret = 0;
2271 struct nes_vnic *nesvnic; 2296 struct nes_vnic *nesvnic;
@@ -2740,7 +2765,7 @@ int nes_cm_stop(void)
2740 * cm_event_connected 2765 * cm_event_connected
2741 * handle a connected event, setup QPs and HW 2766 * handle a connected event, setup QPs and HW
2742 */ 2767 */
2743void cm_event_connected(struct nes_cm_event *event) 2768static void cm_event_connected(struct nes_cm_event *event)
2744{ 2769{
2745 u64 u64temp; 2770 u64 u64temp;
2746 struct nes_qp *nesqp; 2771 struct nes_qp *nesqp;
@@ -2877,7 +2902,7 @@ void cm_event_connected(struct nes_cm_event *event)
2877/** 2902/**
2878 * cm_event_connect_error 2903 * cm_event_connect_error
2879 */ 2904 */
2880void cm_event_connect_error(struct nes_cm_event *event) 2905static void cm_event_connect_error(struct nes_cm_event *event)
2881{ 2906{
2882 struct nes_qp *nesqp; 2907 struct nes_qp *nesqp;
2883 struct iw_cm_id *cm_id; 2908 struct iw_cm_id *cm_id;
@@ -2930,7 +2955,7 @@ void cm_event_connect_error(struct nes_cm_event *event)
2930/** 2955/**
2931 * cm_event_reset 2956 * cm_event_reset
2932 */ 2957 */
2933void cm_event_reset(struct nes_cm_event *event) 2958static void cm_event_reset(struct nes_cm_event *event)
2934{ 2959{
2935 struct nes_qp *nesqp; 2960 struct nes_qp *nesqp;
2936 struct iw_cm_id *cm_id; 2961 struct iw_cm_id *cm_id;
@@ -2973,7 +2998,7 @@ void cm_event_reset(struct nes_cm_event *event)
2973/** 2998/**
2974 * cm_event_mpa_req 2999 * cm_event_mpa_req
2975 */ 3000 */
2976void cm_event_mpa_req(struct nes_cm_event *event) 3001static void cm_event_mpa_req(struct nes_cm_event *event)
2977{ 3002{
2978 struct iw_cm_id *cm_id; 3003 struct iw_cm_id *cm_id;
2979 struct iw_cm_event cm_event; 3004 struct iw_cm_event cm_event;
@@ -3019,7 +3044,7 @@ static void nes_cm_event_handler(struct work_struct *);
3019 * nes_cm_post_event 3044 * nes_cm_post_event
3020 * post an event to the cm event handler 3045 * post an event to the cm event handler
3021 */ 3046 */
3022int nes_cm_post_event(struct nes_cm_event *event) 3047static int nes_cm_post_event(struct nes_cm_event *event)
3023{ 3048{
3024 atomic_inc(&event->cm_node->cm_core->events_posted); 3049 atomic_inc(&event->cm_node->cm_core->events_posted);
3025 add_ref_cm_node(event->cm_node); 3050 add_ref_cm_node(event->cm_node);