MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ngbe_set_pcie_master

Function ngbe_set_pcie_master

dpdk/drivers/net/ngbe/base/ngbe_hw.c:1072–1103  ·  view source on GitHub ↗

* ngbe_set_pcie_master - Disable or Enable PCI-express master access * @hw: pointer to hardware structure * * Disables PCI-Express master access and verifies there are no pending * requests. NGBE_ERR_MASTER_REQUESTS_PENDING is returned if master disable * bit hasn't caused the master requests to be disabled, else 0 * is returned signifying master requests disabled. **/

Source from the content-addressed store, hash-verified

1070 * is returned signifying master requests disabled.
1071 **/
1072s32 ngbe_set_pcie_master(struct ngbe_hw *hw, bool enable)
1073{
1074 struct rte_pci_device *pci_dev = (struct rte_pci_device *)hw->back;
1075 s32 status = 0;
1076 u32 i;
1077
1078 if (rte_pci_set_bus_master(pci_dev, enable) < 0) {
1079 DEBUGOUT("Cannot configure PCI bus master");
1080 return -1;
1081 }
1082
1083 if (enable)
1084 goto out;
1085
1086 /* Exit if master requests are blocked */
1087 if (!(rd32(hw, NGBE_BMEPEND)) ||
1088 NGBE_REMOVED(hw->hw_addr))
1089 goto out;
1090
1091 /* Poll for master request bit to clear */
1092 for (i = 0; i < NGBE_PCI_MASTER_DISABLE_TIMEOUT; i++) {
1093 usec_delay(100);
1094 if (!(rd32(hw, NGBE_BMEPEND)))
1095 goto out;
1096 }
1097
1098 DEBUGOUT("PCIe transaction pending bit also did not clear.");
1099 status = NGBE_ERR_MASTER_REQUESTS_PENDING;
1100
1101out:
1102 return status;
1103}
1104
1105/**
1106 * ngbe_acquire_swfw_sync - Acquire SWFW semaphore

Callers 4

ngbe_dev_startFunction · 0.85
ngbe_dev_stopFunction · 0.85
ngbe_dev_closeFunction · 0.85
ngbe_stop_hwFunction · 0.85

Calls 2

rte_pci_set_bus_masterFunction · 0.85
rd32Function · 0.70

Tested by

no test coverage detected