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

Function bnxt_ulp_port_init

dpdk/drivers/net/bnxt/tf_ulp/bnxt_ulp.c:1757–1882  ·  view source on GitHub ↗

* When a port is initialized by dpdk. This functions sets up * the port specific details. */

Source from the content-addressed store, hash-verified

1755 * the port specific details.
1756 */
1757int32_t
1758bnxt_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

Callers 1

bnxt_dev_start_opFunction · 0.85

Calls 13

rte_zmallocFunction · 0.85
ulp_session_initFunction · 0.85
ulp_ctx_attachFunction · 0.85
bnxt_ulp_initFunction · 0.85
ulp_port_db_port_updateFunction · 0.85
bnxt_ulp_create_df_rulesFunction · 0.85
bnxt_ulp_devid_getFunction · 0.85
ulp_cust_vxlan_allocFunction · 0.85

Tested by

no test coverage detected