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

Function fs_sub_device_alloc

dpdk/drivers/net/failsafe/failsafe.c:27–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25};
26
27static int
28fs_sub_device_alloc(struct rte_eth_dev *dev,
29 const char *params)
30{
31 uint8_t nb_subs;
32 int ret;
33 int i;
34 struct sub_device *sdev;
35 uint8_t sdev_iterator;
36
37 ret = failsafe_args_count_subdevice(dev, params);
38 if (ret)
39 return ret;
40 if (PRIV(dev)->subs_tail > FAILSAFE_MAX_ETHPORTS) {
41 ERROR("Cannot allocate more than %d ports",
42 FAILSAFE_MAX_ETHPORTS);
43 return -ENOSPC;
44 }
45 nb_subs = PRIV(dev)->subs_tail;
46 PRIV(dev)->subs = rte_zmalloc(NULL,
47 sizeof(struct sub_device) * nb_subs,
48 RTE_CACHE_LINE_SIZE);
49 if (PRIV(dev)->subs == NULL) {
50 ERROR("Could not allocate sub_devices");
51 return -ENOMEM;
52 }
53 /* Initiate static sub devices linked list. */
54 for (i = 1; i < nb_subs; i++)
55 PRIV(dev)->subs[i - 1].next = PRIV(dev)->subs + i;
56 PRIV(dev)->subs[i - 1].next = PRIV(dev)->subs;
57
58 FOREACH_SUBDEV(sdev, sdev_iterator, dev) {
59 sdev->sdev_port_id = RTE_MAX_ETHPORTS;
60 }
61 return 0;
62}
63
64static void fs_hotplug_alarm(void *arg);
65

Callers 1

fs_eth_dev_createFunction · 0.85

Calls 2

rte_zmallocFunction · 0.85

Tested by

no test coverage detected