39 #include <linux/slab.h>
40 #include <linux/string.h>
46 #define SPFX "ib_agent: "
62 if (entry->
agent[1]->device == device &&
63 entry->
agent[1]->port_num == port_num)
70 ib_get_agent_port(
struct ib_device *device,
int port_num)
76 entry = __ib_get_agent_port(device, port_num);
77 spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
83 int port_num,
int qpn)
92 port_priv = ib_get_agent_port(device, 0);
94 port_priv = ib_get_agent_port(device, port_num);
101 agent = port_priv->
agent[qpn];
112 if (IS_ERR(send_buf)) {
138 static void agent_send_handler(
struct ib_mad_agent *mad_agent,
152 port_priv = kzalloc(
sizeof *port_priv,
GFP_KERNEL);
165 if (IS_ERR(port_priv->
agent[0])) {
166 ret = PTR_ERR(port_priv->
agent[0]);
176 if (IS_ERR(port_priv->
agent[1])) {
177 ret = PTR_ERR(port_priv->
agent[1]);
183 spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
188 if (port_priv->
agent[0])
202 port_priv = __ib_get_agent_port(device, port_num);
203 if (port_priv ==
NULL) {
204 spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
209 spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
212 if (port_priv->
agent[0])