mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-28 08:02:54 +00:00
infiniband: Opt-in for net epoch
This is counterpart to e87c494015
, which did the same for ethernet.
Suggested by: hselasky
Reviewed by: hselasky, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D39405
This commit is contained in:
parent
03276e338a
commit
fc6c93b6a5
@ -415,9 +415,13 @@ infiniband_input(struct ifnet *ifp, struct mbuf *m)
|
||||
struct infiniband_header *ibh;
|
||||
struct epoch_tracker et;
|
||||
int isr;
|
||||
bool needs_epoch;
|
||||
|
||||
needs_epoch = (ifp->if_flags & IFF_KNOWSEPOCH) == 0;
|
||||
|
||||
CURVNET_SET_QUIET(ifp->if_vnet);
|
||||
NET_EPOCH_ENTER(et);
|
||||
if (__predict_false(needs_epoch))
|
||||
NET_EPOCH_ENTER(et);
|
||||
|
||||
if ((ifp->if_flags & IFF_UP) == 0) {
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
@ -507,7 +511,8 @@ infiniband_input(struct ifnet *ifp, struct mbuf *m)
|
||||
/* Allow monitor mode to claim this frame, after stats are updated. */
|
||||
netisr_dispatch(isr, m);
|
||||
done:
|
||||
NET_EPOCH_EXIT(et);
|
||||
if (__predict_false(needs_epoch))
|
||||
NET_EPOCH_EXIT(et);
|
||||
CURVNET_RESTORE();
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ void ipoib_reap_ah(struct work_struct *work);
|
||||
|
||||
void ipoib_mark_paths_invalid(struct ipoib_dev_priv *priv);
|
||||
void ipoib_flush_paths(struct ipoib_dev_priv *priv);
|
||||
struct ipoib_dev_priv *ipoib_intf_alloc(const char *format);
|
||||
struct ipoib_dev_priv *ipoib_intf_alloc(const char *format, struct ib_device *ca);
|
||||
|
||||
int ipoib_ib_dev_init(struct ipoib_dev_priv *priv, struct ib_device *ca,
|
||||
int port);
|
||||
|
@ -901,7 +901,7 @@ ipoib_priv_alloc(void)
|
||||
}
|
||||
|
||||
struct ipoib_dev_priv *
|
||||
ipoib_intf_alloc(const char *name)
|
||||
ipoib_intf_alloc(const char *name, struct ib_device *hca)
|
||||
{
|
||||
struct ipoib_dev_priv *priv;
|
||||
if_t dev;
|
||||
@ -922,6 +922,8 @@ ipoib_intf_alloc(const char *name)
|
||||
}
|
||||
if_initname(dev, name, priv->unit);
|
||||
if_setflags(dev, IFF_BROADCAST | IFF_MULTICAST);
|
||||
if (hca->attrs.device_cap_flags & IB_DEVICE_KNOWSEPOCH)
|
||||
if_setflagbits(dev, IFF_KNOWSEPOCH, 0);
|
||||
|
||||
infiniband_ifattach(priv->dev, NULL, priv->broadcastaddr);
|
||||
|
||||
@ -976,7 +978,7 @@ ipoib_add_port(const char *format, struct ib_device *hca, u8 port)
|
||||
struct ib_port_attr attr;
|
||||
int result = -ENOMEM;
|
||||
|
||||
priv = ipoib_intf_alloc(format);
|
||||
priv = ipoib_intf_alloc(format, hca);
|
||||
if (!priv)
|
||||
goto alloc_mem_failed;
|
||||
|
||||
|
@ -89,7 +89,7 @@ int ipoib_vlan_add(if_t pdev, unsigned short pkey)
|
||||
|
||||
snprintf(intf_name, sizeof intf_name, "%s.%04x",
|
||||
ppriv->dev->name, pkey);
|
||||
priv = ipoib_intf_alloc(intf_name);
|
||||
priv = ipoib_intf_alloc(intf_name, ppriv->ca);
|
||||
if (!priv) {
|
||||
result = -ENOMEM;
|
||||
goto err;
|
||||
|
@ -242,6 +242,7 @@ enum ib_device_cap_flags {
|
||||
IB_DEVICE_SG_GAPS_REG = (1ULL << 32),
|
||||
IB_DEVICE_VIRTUAL_FUNCTION = (1ULL << 33),
|
||||
IB_DEVICE_RAW_SCATTER_FCS = (1ULL << 34),
|
||||
IB_DEVICE_KNOWSEPOCH = (1ULL << 35),
|
||||
};
|
||||
|
||||
enum ib_atomic_cap {
|
||||
|
Loading…
Reference in New Issue
Block a user