git: 2439ae948352 - main - mlx4, mlx5: Eliminate redundent NULL check for packet filter
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 28 May 2024 04:47:28 UTC
The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=2439ae948352766f6b993c5103a4c516376bec28 commit 2439ae948352766f6b993c5103a4c516376bec28 Author: Zhenlei Huang <zlei@FreeBSD.org> AuthorDate: 2024-05-28 04:46:04 +0000 Commit: Zhenlei Huang <zlei@FreeBSD.org> CommitDate: 2024-05-28 04:46:04 +0000 mlx4, mlx5: Eliminate redundent NULL check for packet filter mlx4 and mlx5 are Ethernet devices and ether_ifattach() does an unconditional bpfattach(). From commit 16d878cc99ef [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 2b9600b4497b [2], ifp->if_bpf can not be NULL even after the network interface has been detached. No functional change intended. 1. 16d878cc99ef Fix the following bpf(4) race condition which can result in a panic 2. 2b9600b4497b 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 --- sys/dev/mlx4/mlx4_en/mlx4_en_tx.c | 2 +- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c b/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c index 9a73c7571fd7..d45ccacd7499 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c @@ -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 */ diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index 1f2820abc30e..3f70e8a818ea 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -745,7 +745,7 @@ top: 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)) {