}
ETH(sdev) = &rte_eth_devices[pid];
SUB_ID(sdev) = i;
- sdev->fs_dev = dev;
+ sdev->fs_port_id = dev->data->port_id;
sdev->dev = ETH(sdev)->device;
sdev->state = DEV_PROBED;
}
break;
}
sdev->remove = 0;
- failsafe_hotplug_alarm_install(sdev->fs_dev);
+ failsafe_hotplug_alarm_install(fs_dev(sdev));
}
static void
WARN("Using latest snapshot taken before %"PRIu64" seconds.\n",
(rte_rdtsc() - timestamp) / rte_get_tsc_hz());
}
- failsafe_stats_increment(&PRIV(sdev->fs_dev)->stats_accumulator,
- err ? &sdev->stats_snapshot.stats : &stats);
+ failsafe_stats_increment
+ (&PRIV(fs_dev(sdev))->stats_accumulator,
+ err ? &sdev->stats_snapshot.stats : &stats);
memset(&sdev->stats_snapshot, 0, sizeof(sdev->stats_snapshot));
}
{
struct sub_device *sdev = cb_arg;
- fs_lock(sdev->fs_dev, 0);
+ fs_lock(fs_dev(sdev), 0);
/* Switch as soon as possible tx_dev. */
- fs_switch_dev(sdev->fs_dev, sdev);
+ fs_switch_dev(fs_dev(sdev), sdev);
/* Use safe bursts in any case. */
- failsafe_set_burst_fn(sdev->fs_dev, 1);
+ failsafe_set_burst_fn(fs_dev(sdev), 1);
/*
* Async removal, the sub-PMD will try to unregister
* the callback at the source of the current thread context.
*/
sdev->remove = 1;
- fs_unlock(sdev->fs_dev, 0);
+ fs_unlock(fs_dev(sdev), 0);
return 0;
}
int rc;
int ret = 0;
+ fsdev = fs_dev(sdev);
if (sdev == NULL || (ETH(sdev) == NULL) ||
- sdev->fs_dev == NULL || (PRIV(sdev->fs_dev) == NULL)) {
+ fsdev == NULL || (PRIV(fsdev) == NULL)) {
ERROR("Called with invalid arguments");
return -EINVAL;
}
dev = ETH(sdev);
- fsdev = sdev->fs_dev;
- epfd = PRIV(sdev->fs_dev)->rxp.efd;
+ epfd = PRIV(fsdev)->rxp.efd;
pid = PORT_ID(sdev);
if (epfd <= 0) {
const struct rte_intr_conf *const intr_conf =
Ð(sdev)->data->dev_conf.intr_conf;
- fsdev = sdev->fs_dev;
+ fsdev = fs_dev(sdev);
rxq = (struct rxq **)fsdev->data->rx_queues;
if (intr_conf->rxq == 0)
return 0;
struct rte_eth_dev *fsdev;
struct rxq *fsrxq;
- fsdev = sdev->fs_dev;
+ fsdev = fs_dev(sdev);
for (qid = 0; qid < ETH(sdev)->data->nb_rx_queues; qid++) {
if (qid < fsdev->data->nb_rx_queues) {
fsrxq = fsdev->data->rx_queues[qid];
/* Others are retrieved through a file descriptor */
char *fd_str;
/* fail-safe device backreference */
- struct rte_eth_dev *fs_dev;
+ uint16_t fs_port_id; /* shared between processes */
/* flag calling for recollection */
volatile unsigned int remove:1;
/* flow isolation state */
*/
#define FS_ATOMIC_RX(s, i) \
rte_atomic64_read( \
- &((struct rxq *)((s)->fs_dev->data->rx_queues[i]))->refcnt[(s)->sid] \
- )
+ &((struct rxq *) \
+ (fs_dev(s)->data->rx_queues[i]))->refcnt[(s)->sid])
/**
* s: (struct sub_device *)
* i: uint16_t qid
*/
#define FS_ATOMIC_TX(s, i) \
rte_atomic64_read( \
- &((struct txq *)((s)->fs_dev->data->tx_queues[i]))->refcnt[(s)->sid] \
- )
+ &((struct txq *) \
+ (fs_dev(s)->data->tx_queues[i]))->refcnt[(s)->sid])
#ifdef RTE_EXEC_ENV_FREEBSD
#define FS_THREADID_TYPE void*
return &subs[sid];
}
+static inline struct rte_eth_dev *
+fs_dev(struct sub_device *sdev) {
+ return &rte_eth_devices[sdev->fs_port_id];
+}
+
/*
* Lock hot-plug mutex.
* is_alarm means that the caller is, for sure, the hot-plug alarm mechanism.