mlx4, mlx5: Eliminate redundent NULL check for packet filter

mlx4 and mlx5 are Ethernet devices and ether_ifattach() does an
unconditional bpfattach(). From commit 16d878cc99 [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 commit
2b9600b449 [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:
Zhenlei Huang 2024-05-28 12:46:04 +08:00
parent 6c9170e0af
commit 2439ae9483
2 changed files with 2 additions and 2 deletions

View File

@ -688,7 +688,7 @@ int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **mbp)
dseg = &tx_desc->data;
/* 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);
/* get default flags */

View File

@ -745,7 +745,7 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
mb = *mbp;
/* 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);
if (mb->m_pkthdr.csum_flags & (CSUM_IP | CSUM_TSO)) {