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

Function ionic_dev_start

dpdk/drivers/net/ionic/ionic_ethdev.c:856–941  ·  view source on GitHub ↗

* Configure device link speed and setup link. * It returns 0 on success. */

Source from the content-addressed store, hash-verified

854 * It returns 0 on success.
855 */
856static int
857ionic_dev_start(struct rte_eth_dev *eth_dev)
858{
859 struct rte_eth_conf *dev_conf = &eth_dev->data->dev_conf;
860 struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
861 struct ionic_adapter *adapter = lif->adapter;
862 struct ionic_dev *idev = &adapter->idev;
863 uint32_t speed = 0, allowed_speeds;
864 uint8_t an_enable;
865 int err;
866
867 IONIC_PRINT_CALL();
868
869 allowed_speeds =
870 RTE_ETH_LINK_SPEED_FIXED |
871 RTE_ETH_LINK_SPEED_10G |
872 RTE_ETH_LINK_SPEED_25G |
873 RTE_ETH_LINK_SPEED_40G |
874 RTE_ETH_LINK_SPEED_50G |
875 RTE_ETH_LINK_SPEED_100G;
876
877 if (dev_conf->link_speeds & ~allowed_speeds) {
878 IONIC_PRINT(ERR, "Invalid link setting");
879 return -EINVAL;
880 }
881
882 if (dev_conf->lpbk_mode)
883 IONIC_PRINT(WARNING, "Loopback mode not supported");
884
885 /* Re-set features in case SG flag was added in rx_queue_setup() */
886 err = ionic_lif_set_features(lif);
887 if (err) {
888 IONIC_PRINT(ERR, "Cannot set LIF features: %d", err);
889 return err;
890 }
891
892 lif->frame_size = eth_dev->data->mtu + IONIC_ETH_OVERHEAD;
893
894 err = ionic_lif_change_mtu(lif, eth_dev->data->mtu);
895 if (err) {
896 IONIC_PRINT(ERR, "Cannot set LIF frame size %u: %d",
897 lif->frame_size, err);
898 return err;
899 }
900
901 err = ionic_lif_start(lif);
902 if (err) {
903 IONIC_PRINT(ERR, "Cannot start LIF: %d", err);
904 return err;
905 }
906
907 /* Configure link */
908 an_enable = (dev_conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) == 0;
909
910 ionic_dev_cmd_port_autoneg(idev, an_enable);
911 err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
912 if (err)
913 IONIC_PRINT(WARNING, "Failed to %s autonegotiation",

Callers

nothing calls this directly

Calls 8

ionic_lif_set_featuresFunction · 0.85
ionic_lif_change_mtuFunction · 0.85
ionic_lif_startFunction · 0.85
ionic_dev_cmd_wait_checkFunction · 0.85
ionic_parse_link_speedsFunction · 0.85
ionic_dev_cmd_port_speedFunction · 0.85
ionic_dev_link_updateFunction · 0.85

Tested by

no test coverage detected