net/failsafe: fix FreeBSD build
The type pthread_t is not portable because it is freely defined.
On Linux, it is an unsigned long int which can be printed with %l.
On FreeBSD, it is a pointer which can be printed with %p.
That's why there was this error:
drivers/net/failsafe/failsafe_private.h:377:53: error:
format specifies type 'unsigned long' but the argument has
type 'pthread_t' (aka 'struct pthread *')
Fixes: 655fcd68c7
("net/failsafe: fix hotplug races")
Reported-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Tested-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Matan Azrad <matan@mellanox.com>
This commit is contained in:
parent
eae6e70cea
commit
3344fb8fa4
@ -318,6 +318,14 @@ extern int mac_from_arg;
|
|||||||
&((struct txq *)((s)->fs_dev->data->tx_queues[i]))->refcnt[(s)->sid] \
|
&((struct txq *)((s)->fs_dev->data->tx_queues[i]))->refcnt[(s)->sid] \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#ifdef RTE_EXEC_ENV_BSDAPP
|
||||||
|
#define FS_THREADID_TYPE void*
|
||||||
|
#define FS_THREADID_FMT "p"
|
||||||
|
#else
|
||||||
|
#define FS_THREADID_TYPE unsigned long
|
||||||
|
#define FS_THREADID_FMT "lu"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LOG__(level, m, ...) \
|
#define LOG__(level, m, ...) \
|
||||||
RTE_LOG(level, PMD, "net_failsafe: " m "%c", __VA_ARGS__)
|
RTE_LOG(level, PMD, "net_failsafe: " m "%c", __VA_ARGS__)
|
||||||
#define LOG_(level, ...) LOG__(level, __VA_ARGS__, '\n')
|
#define LOG_(level, ...) LOG__(level, __VA_ARGS__, '\n')
|
||||||
@ -374,7 +382,8 @@ fs_lock(struct rte_eth_dev *dev, unsigned int is_alarm)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DEBUG("Hot-plug mutex was locked by thread %lu%s", pthread_self(),
|
DEBUG("Hot-plug mutex was locked by thread %" FS_THREADID_FMT "%s",
|
||||||
|
(FS_THREADID_TYPE)pthread_self(),
|
||||||
PRIV(dev)->alarm_lock ? " by the hot-plug alarm" : "");
|
PRIV(dev)->alarm_lock ? " by the hot-plug alarm" : "");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -397,8 +406,8 @@ fs_unlock(struct rte_eth_dev *dev, unsigned int is_alarm)
|
|||||||
if (ret)
|
if (ret)
|
||||||
ERROR("Cannot unlock hot-plug mutex(%s)", strerror(ret));
|
ERROR("Cannot unlock hot-plug mutex(%s)", strerror(ret));
|
||||||
else
|
else
|
||||||
DEBUG("Hot-plug mutex was unlocked by thread %lu%s",
|
DEBUG("Hot-plug mutex was unlocked by thread %" FS_THREADID_FMT "%s",
|
||||||
pthread_self(),
|
(FS_THREADID_TYPE)pthread_self(),
|
||||||
prev_alarm_lock ? " by the hot-plug alarm" : "");
|
prev_alarm_lock ? " by the hot-plug alarm" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user