Searched refs:mlxsw_pci (Results 1 - 2 of 2) sorted by relevance

/linux-4.4.14/drivers/net/ethernet/mellanox/mlxsw/
H A DMakefile3 obj-$(CONFIG_MLXSW_PCI) += mlxsw_pci.o
4 mlxsw_pci-objs := pci.o
H A Dpci.c56 static const char mlxsw_pci_driver_name[] = "mlxsw_pci";
78 #define mlxsw_pci_write32(mlxsw_pci, reg, val) \
79 iowrite32be(val, (mlxsw_pci)->hw_addr + (MLXSW_PCI_ ## reg))
80 #define mlxsw_pci_read32(mlxsw_pci, reg) \
81 ioread32be((mlxsw_pci)->hw_addr + (MLXSW_PCI_ ## reg))
150 struct mlxsw_pci *pci;
169 struct mlxsw_pci { struct
259 mlxsw_pci_queue_type_group_get(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_queue_type_group_get() argument
262 return &mlxsw_pci->queues[q_type]; mlxsw_pci_queue_type_group_get()
265 static u8 __mlxsw_pci_queue_count(struct mlxsw_pci *mlxsw_pci, __mlxsw_pci_queue_count() argument
270 queue_group = mlxsw_pci_queue_type_group_get(mlxsw_pci, q_type); __mlxsw_pci_queue_count()
274 static u8 mlxsw_pci_sdq_count(struct mlxsw_pci *mlxsw_pci) mlxsw_pci_sdq_count() argument
276 return __mlxsw_pci_queue_count(mlxsw_pci, MLXSW_PCI_QUEUE_TYPE_SDQ); mlxsw_pci_sdq_count()
279 static u8 mlxsw_pci_rdq_count(struct mlxsw_pci *mlxsw_pci) mlxsw_pci_rdq_count() argument
281 return __mlxsw_pci_queue_count(mlxsw_pci, MLXSW_PCI_QUEUE_TYPE_RDQ); mlxsw_pci_rdq_count()
284 static u8 mlxsw_pci_cq_count(struct mlxsw_pci *mlxsw_pci) mlxsw_pci_cq_count() argument
286 return __mlxsw_pci_queue_count(mlxsw_pci, MLXSW_PCI_QUEUE_TYPE_CQ); mlxsw_pci_cq_count()
289 static u8 mlxsw_pci_eq_count(struct mlxsw_pci *mlxsw_pci) mlxsw_pci_eq_count() argument
291 return __mlxsw_pci_queue_count(mlxsw_pci, MLXSW_PCI_QUEUE_TYPE_EQ); mlxsw_pci_eq_count()
295 __mlxsw_pci_queue_get(struct mlxsw_pci *mlxsw_pci, __mlxsw_pci_queue_get() argument
298 return &mlxsw_pci->queues[q_type].q[q_num]; __mlxsw_pci_queue_get()
301 static struct mlxsw_pci_queue *mlxsw_pci_sdq_get(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_sdq_get() argument
304 return __mlxsw_pci_queue_get(mlxsw_pci, mlxsw_pci_sdq_get()
308 static struct mlxsw_pci_queue *mlxsw_pci_rdq_get(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_rdq_get() argument
311 return __mlxsw_pci_queue_get(mlxsw_pci, mlxsw_pci_rdq_get()
315 static struct mlxsw_pci_queue *mlxsw_pci_cq_get(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_cq_get() argument
318 return __mlxsw_pci_queue_get(mlxsw_pci, MLXSW_PCI_QUEUE_TYPE_CQ, q_num); mlxsw_pci_cq_get()
321 static struct mlxsw_pci_queue *mlxsw_pci_eq_get(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_eq_get() argument
324 return __mlxsw_pci_queue_get(mlxsw_pci, MLXSW_PCI_QUEUE_TYPE_EQ, q_num); mlxsw_pci_eq_get()
327 static void __mlxsw_pci_queue_doorbell_set(struct mlxsw_pci *mlxsw_pci, __mlxsw_pci_queue_doorbell_set() argument
331 mlxsw_pci_write32(mlxsw_pci, __mlxsw_pci_queue_doorbell_set()
332 DOORBELL(mlxsw_pci->doorbell_offset, __mlxsw_pci_queue_doorbell_set()
337 static void __mlxsw_pci_queue_doorbell_arm_set(struct mlxsw_pci *mlxsw_pci, __mlxsw_pci_queue_doorbell_arm_set() argument
341 mlxsw_pci_write32(mlxsw_pci, __mlxsw_pci_queue_doorbell_arm_set()
342 DOORBELL(mlxsw_pci->doorbell_offset, __mlxsw_pci_queue_doorbell_arm_set()
347 static void mlxsw_pci_queue_doorbell_producer_ring(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_queue_doorbell_producer_ring() argument
351 __mlxsw_pci_queue_doorbell_set(mlxsw_pci, q, q->producer_counter); mlxsw_pci_queue_doorbell_producer_ring()
354 static void mlxsw_pci_queue_doorbell_consumer_ring(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_queue_doorbell_consumer_ring() argument
358 __mlxsw_pci_queue_doorbell_set(mlxsw_pci, q, mlxsw_pci_queue_doorbell_consumer_ring()
363 mlxsw_pci_queue_doorbell_arm_consumer_ring(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_queue_doorbell_arm_consumer_ring() argument
367 __mlxsw_pci_queue_doorbell_arm_set(mlxsw_pci, q, q->consumer_counter); mlxsw_pci_queue_doorbell_arm_consumer_ring()
376 static int mlxsw_pci_sdq_init(struct mlxsw_pci *mlxsw_pci, char *mbox, mlxsw_pci_sdq_init() argument
395 err = mlxsw_cmd_sw2hw_sdq(mlxsw_pci->core, mbox, q->num); mlxsw_pci_sdq_init()
398 mlxsw_pci_queue_doorbell_producer_ring(mlxsw_pci, q); mlxsw_pci_sdq_init()
402 static void mlxsw_pci_sdq_fini(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_sdq_fini() argument
405 mlxsw_cmd_hw2sw_sdq(mlxsw_pci->core, q->num); mlxsw_pci_sdq_fini()
410 struct mlxsw_pci *mlxsw_pci = dev_get_drvdata(file->private); mlxsw_pci_sdq_dbg_read() local
417 for (i = 0; i < mlxsw_pci_sdq_count(mlxsw_pci); i++) { mlxsw_pci_sdq_dbg_read()
418 q = mlxsw_pci_sdq_get(mlxsw_pci, i); mlxsw_pci_sdq_dbg_read()
428 static int mlxsw_pci_wqe_frag_map(struct mlxsw_pci *mlxsw_pci, char *wqe, mlxsw_pci_wqe_frag_map() argument
432 struct pci_dev *pdev = mlxsw_pci->pdev; mlxsw_pci_wqe_frag_map()
445 static void mlxsw_pci_wqe_frag_unmap(struct mlxsw_pci *mlxsw_pci, char *wqe, mlxsw_pci_wqe_frag_unmap() argument
448 struct pci_dev *pdev = mlxsw_pci->pdev; mlxsw_pci_wqe_frag_unmap()
457 static int mlxsw_pci_rdq_skb_alloc(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_rdq_skb_alloc() argument
472 err = mlxsw_pci_wqe_frag_map(mlxsw_pci, wqe, 0, skb->data, mlxsw_pci_rdq_skb_alloc()
485 static void mlxsw_pci_rdq_skb_free(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_rdq_skb_free() argument
494 mlxsw_pci_wqe_frag_unmap(mlxsw_pci, wqe, 0, DMA_FROM_DEVICE); mlxsw_pci_rdq_skb_free()
498 static int mlxsw_pci_rdq_init(struct mlxsw_pci *mlxsw_pci, char *mbox, mlxsw_pci_rdq_init() argument
502 u8 sdq_count = mlxsw_pci_sdq_count(mlxsw_pci); mlxsw_pci_rdq_init()
520 err = mlxsw_cmd_sw2hw_rdq(mlxsw_pci->core, mbox, q->num); mlxsw_pci_rdq_init()
524 mlxsw_pci_queue_doorbell_producer_ring(mlxsw_pci, q); mlxsw_pci_rdq_init()
529 err = mlxsw_pci_rdq_skb_alloc(mlxsw_pci, elem_info); mlxsw_pci_rdq_init()
534 mlxsw_pci_queue_doorbell_producer_ring(mlxsw_pci, q); mlxsw_pci_rdq_init()
542 mlxsw_pci_rdq_skb_free(mlxsw_pci, elem_info); mlxsw_pci_rdq_init()
544 mlxsw_cmd_hw2sw_rdq(mlxsw_pci->core, q->num); mlxsw_pci_rdq_init()
549 static void mlxsw_pci_rdq_fini(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_rdq_fini() argument
555 mlxsw_cmd_hw2sw_rdq(mlxsw_pci->core, q->num); mlxsw_pci_rdq_fini()
558 mlxsw_pci_rdq_skb_free(mlxsw_pci, elem_info); mlxsw_pci_rdq_fini()
564 struct mlxsw_pci *mlxsw_pci = dev_get_drvdata(file->private); mlxsw_pci_rdq_dbg_read() local
571 for (i = 0; i < mlxsw_pci_rdq_count(mlxsw_pci); i++) { mlxsw_pci_rdq_dbg_read()
572 q = mlxsw_pci_rdq_get(mlxsw_pci, i); mlxsw_pci_rdq_dbg_read()
582 static int mlxsw_pci_cq_init(struct mlxsw_pci *mlxsw_pci, char *mbox, mlxsw_pci_cq_init() argument
606 err = mlxsw_cmd_sw2hw_cq(mlxsw_pci->core, mbox, q->num); mlxsw_pci_cq_init()
609 mlxsw_pci_queue_doorbell_consumer_ring(mlxsw_pci, q); mlxsw_pci_cq_init()
610 mlxsw_pci_queue_doorbell_arm_consumer_ring(mlxsw_pci, q); mlxsw_pci_cq_init()
614 static void mlxsw_pci_cq_fini(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_cq_fini() argument
617 mlxsw_cmd_hw2sw_cq(mlxsw_pci->core, q->num); mlxsw_pci_cq_fini()
622 struct mlxsw_pci *mlxsw_pci = dev_get_drvdata(file->private); mlxsw_pci_cq_dbg_read() local
630 for (i = 0; i < mlxsw_pci_cq_count(mlxsw_pci); i++) { mlxsw_pci_cq_dbg_read()
631 q = mlxsw_pci_cq_get(mlxsw_pci, i); mlxsw_pci_cq_dbg_read()
641 static void mlxsw_pci_cqe_sdq_handle(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_cqe_sdq_handle() argument
646 struct pci_dev *pdev = mlxsw_pci->pdev; mlxsw_pci_cqe_sdq_handle()
657 mlxsw_pci_wqe_frag_unmap(mlxsw_pci, wqe, i, DMA_TO_DEVICE); mlxsw_pci_cqe_sdq_handle()
666 static void mlxsw_pci_cqe_rdq_handle(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_cqe_rdq_handle() argument
671 struct pci_dev *pdev = mlxsw_pci->pdev; mlxsw_pci_cqe_rdq_handle()
684 mlxsw_pci_wqe_frag_unmap(mlxsw_pci, wqe, 0, DMA_FROM_DEVICE); mlxsw_pci_cqe_rdq_handle()
700 mlxsw_core_skb_receive(mlxsw_pci->core, skb, &rx_info); mlxsw_pci_cqe_rdq_handle()
704 err = mlxsw_pci_rdq_skb_alloc(mlxsw_pci, elem_info); mlxsw_pci_cqe_rdq_handle()
709 mlxsw_pci_queue_doorbell_producer_ring(mlxsw_pci, q); mlxsw_pci_cqe_rdq_handle()
725 struct mlxsw_pci *mlxsw_pci = q->pci; mlxsw_pci_cq_tasklet() local
738 sdq = mlxsw_pci_sdq_get(mlxsw_pci, dqn); mlxsw_pci_cq_tasklet()
739 mlxsw_pci_cqe_sdq_handle(mlxsw_pci, sdq, mlxsw_pci_cq_tasklet()
745 rdq = mlxsw_pci_rdq_get(mlxsw_pci, dqn); mlxsw_pci_cq_tasklet()
746 mlxsw_pci_cqe_rdq_handle(mlxsw_pci, rdq, mlxsw_pci_cq_tasklet()
754 mlxsw_pci_queue_doorbell_consumer_ring(mlxsw_pci, q); mlxsw_pci_cq_tasklet()
755 mlxsw_pci_queue_doorbell_arm_consumer_ring(mlxsw_pci, q); mlxsw_pci_cq_tasklet()
759 static int mlxsw_pci_eq_init(struct mlxsw_pci *mlxsw_pci, char *mbox, mlxsw_pci_eq_init() argument
782 err = mlxsw_cmd_sw2hw_eq(mlxsw_pci->core, mbox, q->num); mlxsw_pci_eq_init()
785 mlxsw_pci_queue_doorbell_consumer_ring(mlxsw_pci, q); mlxsw_pci_eq_init()
786 mlxsw_pci_queue_doorbell_arm_consumer_ring(mlxsw_pci, q); mlxsw_pci_eq_init()
790 static void mlxsw_pci_eq_fini(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_eq_fini() argument
793 mlxsw_cmd_hw2sw_eq(mlxsw_pci->core, q->num); mlxsw_pci_eq_fini()
798 struct mlxsw_pci *mlxsw_pci = dev_get_drvdata(file->private); mlxsw_pci_eq_dbg_read() local
805 for (i = 0; i < mlxsw_pci_eq_count(mlxsw_pci); i++) { mlxsw_pci_eq_dbg_read()
806 q = mlxsw_pci_eq_get(mlxsw_pci, i); mlxsw_pci_eq_dbg_read()
817 static void mlxsw_pci_eq_cmd_event(struct mlxsw_pci *mlxsw_pci, char *eqe) mlxsw_pci_eq_cmd_event() argument
819 mlxsw_pci->cmd.comp.status = mlxsw_pci_eqe_cmd_status_get(eqe); mlxsw_pci_eq_cmd_event()
820 mlxsw_pci->cmd.comp.out_param = mlxsw_pci_eq_cmd_event()
823 mlxsw_pci->cmd.wait_done = true; mlxsw_pci_eq_cmd_event()
824 wake_up(&mlxsw_pci->cmd.wait); mlxsw_pci_eq_cmd_event()
835 struct mlxsw_pci *mlxsw_pci = q->pci; mlxsw_pci_eq_tasklet() local
836 u8 cq_count = mlxsw_pci_cq_count(mlxsw_pci); mlxsw_pci_eq_tasklet()
851 mlxsw_pci_eq_cmd_event(mlxsw_pci, eqe); mlxsw_pci_eq_tasklet()
867 mlxsw_pci_queue_doorbell_consumer_ring(mlxsw_pci, q); mlxsw_pci_eq_tasklet()
868 mlxsw_pci_queue_doorbell_arm_consumer_ring(mlxsw_pci, q); mlxsw_pci_eq_tasklet()
874 q = mlxsw_pci_cq_get(mlxsw_pci, cqn); for_each_set_bit()
882 int (*init)(struct mlxsw_pci *mlxsw_pci, char *mbox,
884 void (*fini)(struct mlxsw_pci *mlxsw_pci,
930 static int mlxsw_pci_queue_init(struct mlxsw_pci *mlxsw_pci, char *mbox, mlxsw_pci_queue_init() argument
943 q->pci = mlxsw_pci; mlxsw_pci_queue_init()
949 mem_item->buf = pci_alloc_consistent(mlxsw_pci->pdev, mlxsw_pci_queue_init()
974 err = q_ops->init(mlxsw_pci, mbox, q); mlxsw_pci_queue_init()
982 pci_free_consistent(mlxsw_pci->pdev, mem_item->size, mlxsw_pci_queue_init()
987 static void mlxsw_pci_queue_fini(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_queue_fini() argument
993 q_ops->fini(mlxsw_pci, q); mlxsw_pci_queue_fini()
995 pci_free_consistent(mlxsw_pci->pdev, mem_item->size, mlxsw_pci_queue_fini()
999 static int mlxsw_pci_queue_group_init(struct mlxsw_pci *mlxsw_pci, char *mbox, mlxsw_pci_queue_group_init() argument
1003 struct pci_dev *pdev = mlxsw_pci->pdev; mlxsw_pci_queue_group_init()
1009 queue_group = mlxsw_pci_queue_type_group_get(mlxsw_pci, q_ops->type); mlxsw_pci_queue_group_init()
1015 err = mlxsw_pci_queue_init(mlxsw_pci, mbox, q_ops, mlxsw_pci_queue_group_init()
1023 debugfs_create_devm_seqfile(&pdev->dev, tmp, mlxsw_pci->dbg_dir, mlxsw_pci_queue_group_init()
1030 mlxsw_pci_queue_fini(mlxsw_pci, q_ops, &queue_group->q[i]); mlxsw_pci_queue_group_init()
1035 static void mlxsw_pci_queue_group_fini(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_queue_group_fini() argument
1041 queue_group = mlxsw_pci_queue_type_group_get(mlxsw_pci, q_ops->type); mlxsw_pci_queue_group_fini()
1043 mlxsw_pci_queue_fini(mlxsw_pci, q_ops, &queue_group->q[i]); mlxsw_pci_queue_group_fini()
1047 static int mlxsw_pci_aqs_init(struct mlxsw_pci *mlxsw_pci, char *mbox) mlxsw_pci_aqs_init() argument
1049 struct pci_dev *pdev = mlxsw_pci->pdev; mlxsw_pci_aqs_init()
1061 err = mlxsw_cmd_query_aq_cap(mlxsw_pci->core, mbox); mlxsw_pci_aqs_init()
1088 err = mlxsw_pci_queue_group_init(mlxsw_pci, mbox, &mlxsw_pci_eq_ops, mlxsw_pci_aqs_init()
1095 err = mlxsw_pci_queue_group_init(mlxsw_pci, mbox, &mlxsw_pci_cq_ops, mlxsw_pci_aqs_init()
1102 err = mlxsw_pci_queue_group_init(mlxsw_pci, mbox, &mlxsw_pci_sdq_ops, mlxsw_pci_aqs_init()
1109 err = mlxsw_pci_queue_group_init(mlxsw_pci, mbox, &mlxsw_pci_rdq_ops, mlxsw_pci_aqs_init()
1117 mlxsw_pci->cmd.nopoll = true; mlxsw_pci_aqs_init()
1121 mlxsw_pci_queue_group_fini(mlxsw_pci, &mlxsw_pci_sdq_ops); mlxsw_pci_aqs_init()
1123 mlxsw_pci_queue_group_fini(mlxsw_pci, &mlxsw_pci_cq_ops); mlxsw_pci_aqs_init()
1125 mlxsw_pci_queue_group_fini(mlxsw_pci, &mlxsw_pci_eq_ops); mlxsw_pci_aqs_init()
1129 static void mlxsw_pci_aqs_fini(struct mlxsw_pci *mlxsw_pci) mlxsw_pci_aqs_fini() argument
1131 mlxsw_pci->cmd.nopoll = false; mlxsw_pci_aqs_fini()
1132 mlxsw_pci_queue_group_fini(mlxsw_pci, &mlxsw_pci_rdq_ops); mlxsw_pci_aqs_fini()
1133 mlxsw_pci_queue_group_fini(mlxsw_pci, &mlxsw_pci_sdq_ops); mlxsw_pci_aqs_fini()
1134 mlxsw_pci_queue_group_fini(mlxsw_pci, &mlxsw_pci_cq_ops); mlxsw_pci_aqs_fini()
1135 mlxsw_pci_queue_group_fini(mlxsw_pci, &mlxsw_pci_eq_ops); mlxsw_pci_aqs_fini()
1139 mlxsw_pci_config_profile_swid_config(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_config_profile_swid_config() argument
1158 static int mlxsw_pci_config_profile(struct mlxsw_pci *mlxsw_pci, char *mbox, mlxsw_pci_config_profile() argument
1261 mlxsw_pci_config_profile_swid_config(mlxsw_pci, mbox, i, mlxsw_pci_config_profile()
1264 return mlxsw_cmd_config_profile_set(mlxsw_pci->core, mbox); mlxsw_pci_config_profile()
1267 static int mlxsw_pci_boardinfo(struct mlxsw_pci *mlxsw_pci, char *mbox) mlxsw_pci_boardinfo() argument
1269 struct mlxsw_bus_info *bus_info = &mlxsw_pci->bus_info; mlxsw_pci_boardinfo()
1273 err = mlxsw_cmd_boardinfo(mlxsw_pci->core, mbox); mlxsw_pci_boardinfo()
1281 static int mlxsw_pci_fw_area_init(struct mlxsw_pci *mlxsw_pci, char *mbox, mlxsw_pci_fw_area_init() argument
1289 mlxsw_pci->fw_area.items = kcalloc(num_pages, sizeof(*mem_item), mlxsw_pci_fw_area_init()
1291 if (!mlxsw_pci->fw_area.items) mlxsw_pci_fw_area_init()
1293 mlxsw_pci->fw_area.count = num_pages; mlxsw_pci_fw_area_init()
1297 mem_item = &mlxsw_pci->fw_area.items[i]; mlxsw_pci_fw_area_init()
1300 mem_item->buf = pci_alloc_consistent(mlxsw_pci->pdev, mlxsw_pci_fw_area_init()
1310 err = mlxsw_cmd_map_fa(mlxsw_pci->core, mbox, nent); mlxsw_pci_fw_area_init()
1319 err = mlxsw_cmd_map_fa(mlxsw_pci->core, mbox, nent); mlxsw_pci_fw_area_init()
1329 mem_item = &mlxsw_pci->fw_area.items[i]; mlxsw_pci_fw_area_init()
1331 pci_free_consistent(mlxsw_pci->pdev, mem_item->size, mlxsw_pci_fw_area_init()
1334 kfree(mlxsw_pci->fw_area.items); mlxsw_pci_fw_area_init()
1338 static void mlxsw_pci_fw_area_fini(struct mlxsw_pci *mlxsw_pci) mlxsw_pci_fw_area_fini() argument
1343 mlxsw_cmd_unmap_fa(mlxsw_pci->core); mlxsw_pci_fw_area_fini()
1345 for (i = 0; i < mlxsw_pci->fw_area.count; i++) { mlxsw_pci_fw_area_fini()
1346 mem_item = &mlxsw_pci->fw_area.items[i]; mlxsw_pci_fw_area_fini()
1348 pci_free_consistent(mlxsw_pci->pdev, mem_item->size, mlxsw_pci_fw_area_fini()
1351 kfree(mlxsw_pci->fw_area.items); mlxsw_pci_fw_area_fini()
1356 struct mlxsw_pci *mlxsw_pci = dev_id; mlxsw_pci_eq_irq_handler() local
1361 q = mlxsw_pci_eq_get(mlxsw_pci, i); mlxsw_pci_eq_irq_handler()
1367 static int mlxsw_pci_mbox_alloc(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_mbox_alloc() argument
1370 struct pci_dev *pdev = mlxsw_pci->pdev; mlxsw_pci_mbox_alloc()
1384 static void mlxsw_pci_mbox_free(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_mbox_free() argument
1387 struct pci_dev *pdev = mlxsw_pci->pdev; mlxsw_pci_mbox_free()
1396 struct mlxsw_pci *mlxsw_pci = bus_priv; mlxsw_pci_init() local
1397 struct pci_dev *pdev = mlxsw_pci->pdev; mlxsw_pci_init()
1402 mutex_init(&mlxsw_pci->cmd.lock); mlxsw_pci_init()
1403 init_waitqueue_head(&mlxsw_pci->cmd.wait); mlxsw_pci_init()
1405 mlxsw_pci->core = mlxsw_core; mlxsw_pci_init()
1411 err = mlxsw_pci_mbox_alloc(mlxsw_pci, &mlxsw_pci->cmd.in_mbox); mlxsw_pci_init()
1415 err = mlxsw_pci_mbox_alloc(mlxsw_pci, &mlxsw_pci->cmd.out_mbox); mlxsw_pci_init()
1423 mlxsw_pci->bus_info.fw_rev.major = mlxsw_pci_init()
1425 mlxsw_pci->bus_info.fw_rev.minor = mlxsw_pci_init()
1427 mlxsw_pci->bus_info.fw_rev.subminor = mlxsw_pci_init()
1441 mlxsw_pci->doorbell_offset = mlxsw_pci_init()
1445 err = mlxsw_pci_fw_area_init(mlxsw_pci, mbox, num_pages); mlxsw_pci_init()
1449 err = mlxsw_pci_boardinfo(mlxsw_pci, mbox); mlxsw_pci_init()
1453 err = mlxsw_pci_config_profile(mlxsw_pci, mbox, profile); mlxsw_pci_init()
1457 err = mlxsw_pci_aqs_init(mlxsw_pci, mbox); mlxsw_pci_init()
1461 err = request_irq(mlxsw_pci->msix_entry.vector, mlxsw_pci_init()
1463 mlxsw_pci_driver_name, mlxsw_pci); mlxsw_pci_init()
1472 mlxsw_pci_aqs_fini(mlxsw_pci); mlxsw_pci_init()
1476 mlxsw_pci_fw_area_fini(mlxsw_pci); mlxsw_pci_init()
1481 mlxsw_pci_mbox_free(mlxsw_pci, &mlxsw_pci->cmd.out_mbox); mlxsw_pci_init()
1483 mlxsw_pci_mbox_free(mlxsw_pci, &mlxsw_pci->cmd.in_mbox); mlxsw_pci_init()
1491 struct mlxsw_pci *mlxsw_pci = bus_priv; mlxsw_pci_fini() local
1493 free_irq(mlxsw_pci->msix_entry.vector, mlxsw_pci); mlxsw_pci_fini()
1494 mlxsw_pci_aqs_fini(mlxsw_pci); mlxsw_pci_fini()
1495 mlxsw_pci_fw_area_fini(mlxsw_pci); mlxsw_pci_fini()
1496 mlxsw_pci_mbox_free(mlxsw_pci, &mlxsw_pci->cmd.out_mbox); mlxsw_pci_fini()
1497 mlxsw_pci_mbox_free(mlxsw_pci, &mlxsw_pci->cmd.in_mbox); mlxsw_pci_fini()
1501 mlxsw_pci_sdq_pick(struct mlxsw_pci *mlxsw_pci, mlxsw_pci_sdq_pick() argument
1504 u8 sdqn = tx_info->local_port % mlxsw_pci_sdq_count(mlxsw_pci); mlxsw_pci_sdq_pick()
1506 return mlxsw_pci_sdq_get(mlxsw_pci, sdqn); mlxsw_pci_sdq_pick()
1512 struct mlxsw_pci *mlxsw_pci = bus_priv; mlxsw_pci_skb_transmit_busy() local
1513 struct mlxsw_pci_queue *q = mlxsw_pci_sdq_pick(mlxsw_pci, tx_info); mlxsw_pci_skb_transmit_busy()
1521 struct mlxsw_pci *mlxsw_pci = bus_priv; mlxsw_pci_skb_transmit() local
1534 q = mlxsw_pci_sdq_pick(mlxsw_pci, tx_info); mlxsw_pci_skb_transmit()
1549 err = mlxsw_pci_wqe_frag_map(mlxsw_pci, wqe, 0, skb->data, mlxsw_pci_skb_transmit()
1557 err = mlxsw_pci_wqe_frag_map(mlxsw_pci, wqe, i + 1, mlxsw_pci_skb_transmit()
1571 mlxsw_pci_queue_doorbell_producer_ring(mlxsw_pci, q); mlxsw_pci_skb_transmit()
1577 mlxsw_pci_wqe_frag_unmap(mlxsw_pci, wqe, i, DMA_TO_DEVICE); mlxsw_pci_skb_transmit()
1589 struct mlxsw_pci *mlxsw_pci = bus_priv; mlxsw_pci_cmd_exec() local
1590 dma_addr_t in_mapaddr = mlxsw_pci->cmd.in_mbox.mapaddr; mlxsw_pci_cmd_exec()
1591 dma_addr_t out_mapaddr = mlxsw_pci->cmd.out_mbox.mapaddr; mlxsw_pci_cmd_exec()
1592 bool evreq = mlxsw_pci->cmd.nopoll; mlxsw_pci_cmd_exec()
1594 bool *p_wait_done = &mlxsw_pci->cmd.wait_done; mlxsw_pci_cmd_exec()
1599 err = mutex_lock_interruptible(&mlxsw_pci->cmd.lock); mlxsw_pci_cmd_exec()
1604 memcpy(mlxsw_pci->cmd.in_mbox.buf, in_mbox, in_mbox_size); mlxsw_pci_cmd_exec()
1605 mlxsw_pci_write32(mlxsw_pci, CIR_IN_PARAM_HI, upper_32_bits(in_mapaddr)); mlxsw_pci_cmd_exec()
1606 mlxsw_pci_write32(mlxsw_pci, CIR_IN_PARAM_LO, lower_32_bits(in_mapaddr)); mlxsw_pci_cmd_exec()
1608 mlxsw_pci_write32(mlxsw_pci, CIR_OUT_PARAM_HI, upper_32_bits(out_mapaddr)); mlxsw_pci_cmd_exec()
1609 mlxsw_pci_write32(mlxsw_pci, CIR_OUT_PARAM_LO, lower_32_bits(out_mapaddr)); mlxsw_pci_cmd_exec()
1611 mlxsw_pci_write32(mlxsw_pci, CIR_IN_MODIFIER, in_mod); mlxsw_pci_cmd_exec()
1612 mlxsw_pci_write32(mlxsw_pci, CIR_TOKEN, 0); mlxsw_pci_cmd_exec()
1617 mlxsw_pci_write32(mlxsw_pci, CIR_CTRL, mlxsw_pci_cmd_exec()
1628 u32 ctrl = mlxsw_pci_read32(mlxsw_pci, CIR_CTRL); mlxsw_pci_cmd_exec()
1638 wait_event_timeout(mlxsw_pci->cmd.wait, *p_wait_done, timeout); mlxsw_pci_cmd_exec()
1639 *p_status = mlxsw_pci->cmd.comp.status; mlxsw_pci_cmd_exec()
1658 tmp = cpu_to_be32(mlxsw_pci_read32(mlxsw_pci, mlxsw_pci_cmd_exec()
1661 tmp = cpu_to_be32(mlxsw_pci_read32(mlxsw_pci, mlxsw_pci_cmd_exec()
1666 memcpy(out_mbox, mlxsw_pci->cmd.out_mbox.buf, out_mbox_size); mlxsw_pci_cmd_exec()
1669 mutex_unlock(&mlxsw_pci->cmd.lock); mlxsw_pci_cmd_exec()
1683 static int mlxsw_pci_sw_reset(struct mlxsw_pci *mlxsw_pci) mlxsw_pci_sw_reset() argument
1685 mlxsw_pci_write32(mlxsw_pci, SW_RESET, MLXSW_PCI_SW_RESET_RST_BIT); mlxsw_pci_sw_reset()
1695 struct mlxsw_pci *mlxsw_pci; mlxsw_pci_probe() local
1698 mlxsw_pci = kzalloc(sizeof(*mlxsw_pci), GFP_KERNEL); mlxsw_pci_probe()
1699 if (!mlxsw_pci) mlxsw_pci_probe()
1735 mlxsw_pci->hw_addr = ioremap(pci_resource_start(pdev, 0), mlxsw_pci_probe()
1737 if (!mlxsw_pci->hw_addr) { mlxsw_pci_probe()
1744 mlxsw_pci->pdev = pdev; mlxsw_pci_probe()
1745 pci_set_drvdata(pdev, mlxsw_pci); mlxsw_pci_probe()
1747 err = mlxsw_pci_sw_reset(mlxsw_pci); mlxsw_pci_probe()
1753 err = pci_enable_msix_exact(pdev, &mlxsw_pci->msix_entry, 1); mlxsw_pci_probe()
1759 mlxsw_pci->bus_info.device_kind = mlxsw_pci_device_kind_get(id); mlxsw_pci_probe()
1760 mlxsw_pci->bus_info.device_name = pci_name(mlxsw_pci->pdev); mlxsw_pci_probe()
1761 mlxsw_pci->bus_info.dev = &pdev->dev; mlxsw_pci_probe()
1763 mlxsw_pci->dbg_dir = debugfs_create_dir(mlxsw_pci->bus_info.device_name, mlxsw_pci_probe()
1765 if (!mlxsw_pci->dbg_dir) { mlxsw_pci_probe()
1771 err = mlxsw_core_bus_device_register(&mlxsw_pci->bus_info, mlxsw_pci_probe()
1772 &mlxsw_pci_bus, mlxsw_pci); mlxsw_pci_probe()
1781 debugfs_remove_recursive(mlxsw_pci->dbg_dir); mlxsw_pci_probe()
1783 pci_disable_msix(mlxsw_pci->pdev); mlxsw_pci_probe()
1786 iounmap(mlxsw_pci->hw_addr); mlxsw_pci_probe()
1794 kfree(mlxsw_pci); mlxsw_pci_probe()
1800 struct mlxsw_pci *mlxsw_pci = pci_get_drvdata(pdev); mlxsw_pci_remove() local
1802 mlxsw_core_bus_device_unregister(mlxsw_pci->core); mlxsw_pci_remove()
1803 debugfs_remove_recursive(mlxsw_pci->dbg_dir); mlxsw_pci_remove()
1804 pci_disable_msix(mlxsw_pci->pdev); mlxsw_pci_remove()
1805 iounmap(mlxsw_pci->hw_addr); mlxsw_pci_remove()
1806 pci_release_regions(mlxsw_pci->pdev); mlxsw_pci_remove()
1807 pci_disable_device(mlxsw_pci->pdev); mlxsw_pci_remove()
1808 kfree(mlxsw_pci); mlxsw_pci_remove()

Completed in 242 milliseconds