infiniband: Convert BPF handling for IfAPI
Summary: All callers of infiniband_bpf_mtap() call it through the wrapper macro, which checks the if_bpf member explicitly. Since this is getting hidden, move this check into the internal function and remove the wrapper macro. Reviewed by: hselasky Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D39024
This commit is contained in:
parent
19aba210e1
commit
adf62e8363
@ -128,6 +128,9 @@ infiniband_bpf_mtap(struct ifnet *ifp, struct mbuf *mb)
|
|||||||
struct infiniband_header *ibh;
|
struct infiniband_header *ibh;
|
||||||
struct ether_header eh;
|
struct ether_header eh;
|
||||||
|
|
||||||
|
if (!bpf_peers_present(ifp->if_bpf))
|
||||||
|
return;
|
||||||
|
|
||||||
if (mb->m_len < sizeof(*ibh))
|
if (mb->m_len < sizeof(*ibh))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -439,7 +442,7 @@ infiniband_input(struct ifnet *ifp, struct mbuf *m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Let BPF have it before we strip the header. */
|
/* Let BPF have it before we strip the header. */
|
||||||
INFINIBAND_BPF_MTAP(ifp, m);
|
infiniband_bpf_mtap(ifp, m);
|
||||||
|
|
||||||
/* Allow monitor mode to claim this frame, after stats are updated. */
|
/* Allow monitor mode to claim this frame, after stats are updated. */
|
||||||
if (ifp->if_flags & IFF_MONITOR) {
|
if (ifp->if_flags & IFF_MONITOR) {
|
||||||
|
@ -2154,7 +2154,7 @@ lagg_transmit_infiniband(struct ifnet *ifp, struct mbuf *m)
|
|||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
INFINIBAND_BPF_MTAP(ifp, m);
|
infiniband_bpf_mtap(ifp, m);
|
||||||
|
|
||||||
error = lagg_proto_start(sc, m);
|
error = lagg_proto_start(sc, m);
|
||||||
NET_EPOCH_EXIT(et);
|
NET_EPOCH_EXIT(et);
|
||||||
@ -2222,7 +2222,7 @@ lagg_input_infiniband(struct ifnet *ifp, struct mbuf *m)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
INFINIBAND_BPF_MTAP(scifp, m);
|
infiniband_bpf_mtap(scifp, m);
|
||||||
|
|
||||||
m = lagg_proto_input(sc, lp, m);
|
m = lagg_proto_input(sc, lp, m);
|
||||||
if (m != NULL && (scifp->if_flags & IFF_MONITOR) != 0) {
|
if (m != NULL && (scifp->if_flags & IFF_MONITOR) != 0) {
|
||||||
|
@ -41,14 +41,6 @@
|
|||||||
#define INFINIBAND_IS_MULTICAST(addr) \
|
#define INFINIBAND_IS_MULTICAST(addr) \
|
||||||
((addr)[4] == 0xff)
|
((addr)[4] == 0xff)
|
||||||
|
|
||||||
#define INFINIBAND_BPF_MTAP(_ifp, _m) \
|
|
||||||
do { \
|
|
||||||
if (bpf_peers_present((_ifp)->if_bpf)) { \
|
|
||||||
M_ASSERTVALID(_m); \
|
|
||||||
infiniband_bpf_mtap(_ifp, _m); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
struct infiniband_header {
|
struct infiniband_header {
|
||||||
uint8_t ib_hwaddr[INFINIBAND_ADDR_LEN];
|
uint8_t ib_hwaddr[INFINIBAND_ADDR_LEN];
|
||||||
uint16_t ib_protocol; /* big endian */
|
uint16_t ib_protocol; /* big endian */
|
||||||
|
@ -747,7 +747,7 @@ ipoib_start_locked(struct ifnet *dev, struct ipoib_dev_priv *priv)
|
|||||||
IFQ_DRV_DEQUEUE(&dev->if_snd, mb);
|
IFQ_DRV_DEQUEUE(&dev->if_snd, mb);
|
||||||
if (mb == NULL)
|
if (mb == NULL)
|
||||||
break;
|
break;
|
||||||
INFINIBAND_BPF_MTAP(dev, mb);
|
infiniband_bpf_mtap(dev, mb);
|
||||||
ipoib_send_one(priv, mb);
|
ipoib_send_one(priv, mb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user