mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
mlx4, mlx5: Eliminate redundent NULL check for packet filter
mlx4 and mlx5 are Ethernet devices and ether_ifattach() does an unconditional bpfattach(). From commit16d878cc99
[1] and on, we should not check ifp->if_bpf to tell us whether or not we have any bpf peers that might be interested in receiving packets. And since commit2b9600b449
[2], ifp->if_bpf can not be NULL even after the network interface has been detached. No functional change intended. 1.16d878cc99
Fix the following bpf(4) race condition which can result in a panic 2.2b9600b449
Add dead_bpf_if structure, that should be used as fake bpf_if during ifnet detach Reviewed by: kp, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45196
This commit is contained in:
parent
6c9170e0af
commit
2439ae9483
|
@ -688,7 +688,7 @@ int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **mbp)
|
||||||
dseg = &tx_desc->data;
|
dseg = &tx_desc->data;
|
||||||
|
|
||||||
/* send a copy of the frame to the BPF listener, if any */
|
/* send a copy of the frame to the BPF listener, if any */
|
||||||
if (ifp != NULL && if_getbpf(ifp) != NULL)
|
if (ifp != NULL)
|
||||||
ETHER_BPF_MTAP(ifp, mb);
|
ETHER_BPF_MTAP(ifp, mb);
|
||||||
|
|
||||||
/* get default flags */
|
/* get default flags */
|
||||||
|
|
|
@ -745,7 +745,7 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
|
||||||
mb = *mbp;
|
mb = *mbp;
|
||||||
|
|
||||||
/* Send a copy of the frame to the BPF listener, if any */
|
/* Send a copy of the frame to the BPF listener, if any */
|
||||||
if (ifp != NULL && if_getbpf(ifp) != NULL)
|
if (ifp != NULL)
|
||||||
ETHER_BPF_MTAP(ifp, mb);
|
ETHER_BPF_MTAP(ifp, mb);
|
||||||
|
|
||||||
if (mb->m_pkthdr.csum_flags & (CSUM_IP | CSUM_TSO)) {
|
if (mb->m_pkthdr.csum_flags & (CSUM_IP | CSUM_TSO)) {
|
||||||
|
|
Loading…
Reference in a new issue