* When a port is initialized by dpdk. This functions sets up * the port specific details. */
| 1755 | * the port specific details. |
| 1756 | */ |
| 1757 | int32_t |
| 1758 | bnxt_ulp_port_init(struct bnxt *bp) |
| 1759 | { |
| 1760 | struct bnxt_ulp_session_state *session; |
| 1761 | bool initialized; |
| 1762 | enum bnxt_ulp_device_id devid = BNXT_ULP_DEVICE_ID_LAST; |
| 1763 | uint32_t ulp_flags; |
| 1764 | int32_t rc = 0; |
| 1765 | |
| 1766 | if (!BNXT_TRUFLOW_EN(bp)) { |
| 1767 | BNXT_TF_DBG(DEBUG, |
| 1768 | "Skip ulp init for port: %d, TF is not enabled\n", |
| 1769 | bp->eth_dev->data->port_id); |
| 1770 | return rc; |
| 1771 | } |
| 1772 | |
| 1773 | if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) { |
| 1774 | BNXT_TF_DBG(DEBUG, |
| 1775 | "Skip ulp init for port: %d, not a TVF or PF\n", |
| 1776 | bp->eth_dev->data->port_id); |
| 1777 | return rc; |
| 1778 | } |
| 1779 | |
| 1780 | if (bp->ulp_ctx) { |
| 1781 | BNXT_TF_DBG(DEBUG, "ulp ctx already allocated\n"); |
| 1782 | return rc; |
| 1783 | } |
| 1784 | |
| 1785 | bp->ulp_ctx = rte_zmalloc("bnxt_ulp_ctx", |
| 1786 | sizeof(struct bnxt_ulp_context), 0); |
| 1787 | if (!bp->ulp_ctx) { |
| 1788 | BNXT_TF_DBG(ERR, "Failed to allocate ulp ctx\n"); |
| 1789 | return -ENOMEM; |
| 1790 | } |
| 1791 | |
| 1792 | /* |
| 1793 | * Multiple uplink ports can be associated with a single vswitch. |
| 1794 | * Make sure only the port that is started first will initialize |
| 1795 | * the TF session. |
| 1796 | */ |
| 1797 | session = ulp_session_init(bp, &initialized); |
| 1798 | if (!session) { |
| 1799 | BNXT_TF_DBG(ERR, "Failed to initialize the tf session\n"); |
| 1800 | rc = -EIO; |
| 1801 | goto jump_to_error; |
| 1802 | } |
| 1803 | |
| 1804 | if (initialized) { |
| 1805 | /* |
| 1806 | * If ULP is already initialized for a specific domain then |
| 1807 | * simply assign the ulp context to this rte_eth_dev. |
| 1808 | */ |
| 1809 | rc = ulp_ctx_attach(bp, session); |
| 1810 | if (rc) { |
| 1811 | BNXT_TF_DBG(ERR, "Failed to attach the ulp context\n"); |
| 1812 | goto jump_to_error; |
| 1813 | } |
| 1814 |
no test coverage detected