mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-18 02:19:39 +00:00
axgbe: Fix setting promisc mode
Ethernet drivers should respect IFF_PROMISC rather than IFF_PPROMISC. The latter is for user-requested promisc mode, it implies the former but not vice versa. Some in-kernel components such as if_bridge(4) and bpf(4) will set promisc mode for interfaces on-demand. While here, update the debugging message to be not confusing. This was spotted while reviewing markj@ 's work D46524. Test from Franco shows that the interface seems to be unconditionally initialized to promisc mode regardless of this fix. That needs further investigation. Reviewed by: markj, Franco Fichtner <franco@opnsense.org> Tested by: Franco Fichtner <franco@opnsense.org> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D46794
This commit is contained in:
parent
eacad82f3a
commit
c7a2636889
@ -2363,11 +2363,11 @@ axgbe_if_promisc_set(if_ctx_t ctx, int flags)
|
||||
|
||||
axgbe_printf(1, "%s: MAC_PFR 0x%x drv_flags 0x%x if_flags 0x%x\n",
|
||||
__func__, XGMAC_IOREAD(pdata, MAC_PFR), if_getdrvflags(ifp),
|
||||
if_getflags(ifp));
|
||||
flags);
|
||||
|
||||
if (if_getflags(ifp) & IFF_PPROMISC) {
|
||||
if (flags & IFF_PROMISC) {
|
||||
|
||||
axgbe_printf(1, "User requested to enter promisc mode\n");
|
||||
axgbe_printf(1, "Requested to enter promisc mode\n");
|
||||
|
||||
if (XGMAC_IOREAD_BITS(pdata, MAC_PFR, PR) == 1) {
|
||||
axgbe_printf(1, "Already in promisc mode\n");
|
||||
@ -2376,10 +2376,11 @@ axgbe_if_promisc_set(if_ctx_t ctx, int flags)
|
||||
|
||||
axgbe_printf(1, "Entering promisc mode\n");
|
||||
XGMAC_IOWRITE_BITS(pdata, MAC_PFR, PR, 1);
|
||||
/* Disable VLAN filtering */
|
||||
XGMAC_IOWRITE_BITS(pdata, MAC_PFR, VTFE, 0);
|
||||
} else {
|
||||
|
||||
axgbe_printf(1, "User requested to leave promisc mode\n");
|
||||
axgbe_printf(1, "Requested to leave promisc mode\n");
|
||||
|
||||
if (XGMAC_IOREAD_BITS(pdata, MAC_PFR, PR) == 0) {
|
||||
axgbe_printf(1, "Already not in promisc mode\n");
|
||||
@ -2388,6 +2389,7 @@ axgbe_if_promisc_set(if_ctx_t ctx, int flags)
|
||||
|
||||
axgbe_printf(1, "Leaving promisc mode\n");
|
||||
XGMAC_IOWRITE_BITS(pdata, MAC_PFR, PR, 0);
|
||||
/* Enable VLAN filtering */
|
||||
XGMAC_IOWRITE_BITS(pdata, MAC_PFR, VTFE, 1);
|
||||
}
|
||||
|
||||
|
@ -970,7 +970,7 @@ xgbe_config_rx_mode(struct xgbe_prv_data *pdata)
|
||||
{
|
||||
unsigned int pr_mode, am_mode;
|
||||
|
||||
pr_mode = ((if_getflags(pdata->netdev) & IFF_PPROMISC) != 0);
|
||||
pr_mode = ((if_getflags(pdata->netdev) & IFF_PROMISC) != 0);
|
||||
am_mode = ((if_getflags(pdata->netdev) & IFF_ALLMULTI) != 0);
|
||||
|
||||
xgbe_set_promiscuous_mode(pdata, pr_mode);
|
||||
|
Loading…
Reference in New Issue
Block a user