Lines Matching refs:ntb
100 struct ntb_dev *ntb; member
121 link = ntb_link_is_up(pp->ntb, NULL, NULL); in pp_find_next_peer()
146 ntb_db_set_mask(pp->ntb, pp->in_db); in pp_setup()
152 dev_dbg(&pp->ntb->dev, "Got no peers, so cancel\n"); in pp_setup()
156 dev_dbg(&pp->ntb->dev, "Ping-pong started with port %d, db %#llx\n", in pp_setup()
157 ntb_peer_port_number(pp->ntb, pp->out_pidx), pp->out_db); in pp_setup()
166 ntb_db_set_mask(pp->ntb, pp->in_db); in pp_clear()
168 dev_dbg(&pp->ntb->dev, "Ping-pong cancelled\n"); in pp_clear()
178 ntb_peer_spad_write(pp->ntb, pp->out_pidx, 0, count); in pp_ping()
179 ntb_peer_msg_write(pp->ntb, pp->out_pidx, 0, count); in pp_ping()
181 dev_dbg(&pp->ntb->dev, "Ping port %d spad %#x, msg %#x\n", in pp_ping()
182 ntb_peer_port_number(pp->ntb, pp->out_pidx), count, count); in pp_ping()
184 ntb_peer_db_set(pp->ntb, pp->out_db); in pp_ping()
185 ntb_db_clear_mask(pp->ntb, pp->in_db); in pp_ping()
195 spad_data = ntb_spad_read(pp->ntb, 0); in pp_pong()
196 msg_data = ntb_msg_read(pp->ntb, &pidx, 0); in pp_pong()
197 ntb_msg_clear_sts(pp->ntb, -1); in pp_pong()
204 dev_dbg(&pp->ntb->dev, "Pong spad %#x, msg %#x (port %d)\n", in pp_pong()
205 spad_data, msg_data, ntb_peer_port_number(pp->ntb, pidx)); in pp_pong()
209 ntb_db_set_mask(pp->ntb, pp->in_db); in pp_pong()
210 ntb_db_clear(pp->ntb, pp->in_db); in pp_pong()
243 static int pp_check_ntb(struct ntb_dev *ntb) in pp_check_ntb() argument
247 if (ntb_db_is_unsafe(ntb)) { in pp_check_ntb()
248 dev_dbg(&ntb->dev, "Doorbell is unsafe\n"); in pp_check_ntb()
253 if (ntb_spad_is_unsafe(ntb)) { in pp_check_ntb()
254 dev_dbg(&ntb->dev, "Scratchpad is unsafe\n"); in pp_check_ntb()
259 pmask = GENMASK_ULL(ntb_peer_port_count(ntb), 0); in pp_check_ntb()
260 if ((ntb_db_valid_mask(ntb) & pmask) != pmask) { in pp_check_ntb()
261 dev_err(&ntb->dev, "Unsupported DB configuration\n"); in pp_check_ntb()
265 if (ntb_spad_count(ntb) < 1 && ntb_msg_count(ntb) < 1) { in pp_check_ntb()
266 dev_err(&ntb->dev, "Scratchpads and messages unsupported\n"); in pp_check_ntb()
268 } else if (ntb_spad_count(ntb) < 1) { in pp_check_ntb()
269 dev_dbg(&ntb->dev, "Scratchpads unsupported\n"); in pp_check_ntb()
270 } else if (ntb_msg_count(ntb) < 1) { in pp_check_ntb()
271 dev_dbg(&ntb->dev, "Messages unsupported\n"); in pp_check_ntb()
277 static struct pp_ctx *pp_create_data(struct ntb_dev *ntb) in pp_create_data() argument
281 pp = devm_kzalloc(&ntb->dev, sizeof(*pp), GFP_KERNEL); in pp_create_data()
285 pp->ntb = ntb; in pp_create_data()
299 lport = ntb_port_number(pp->ntb); in pp_init_flds()
300 pcnt = ntb_peer_port_count(pp->ntb); in pp_init_flds()
302 if (lport < ntb_peer_port_number(pp->ntb, pidx)) in pp_init_flds()
310 dev_dbg(&pp->ntb->dev, "Inbound db %#llx, prev %#llx, next %#llx\n", in pp_init_flds()
319 db_mask = ntb_db_valid_mask(pp->ntb); in pp_mask_events()
320 ret = ntb_db_set_mask(pp->ntb, db_mask); in pp_mask_events()
325 if (ntb_msg_count(pp->ntb) < 1) in pp_mask_events()
328 msg_mask = ntb_msg_outbits(pp->ntb) | ntb_msg_inbits(pp->ntb); in pp_mask_events()
329 return ntb_msg_set_mask(pp->ntb, msg_mask); in pp_mask_events()
336 ret = ntb_set_ctx(pp->ntb, pp, &pp_ops); in pp_setup_ctx()
340 ntb_link_enable(pp->ntb, NTB_SPEED_AUTO, NTB_WIDTH_AUTO); in pp_setup_ctx()
342 ntb_link_event(pp->ntb); in pp_setup_ctx()
349 ntb_link_disable(pp->ntb); in pp_clear_ctx()
351 ntb_clear_ctx(pp->ntb); in pp_clear_ctx()
356 struct pci_dev *pdev = pp->ntb->pdev; in pp_setup_dbgfs()
363 dev_warn(&pp->ntb->dev, "DebugFS unsupported\n"); in pp_setup_dbgfs()
371 static int pp_probe(struct ntb_client *client, struct ntb_dev *ntb) in pp_probe() argument
376 ret = pp_check_ntb(ntb); in pp_probe()
380 pp = pp_create_data(ntb); in pp_probe()
399 static void pp_remove(struct ntb_client *client, struct ntb_dev *ntb) in pp_remove() argument
401 struct pp_ctx *pp = ntb->ctx; in pp_remove()