Re: CALL FOR TEST axgbe promisc mode

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Sat, 12 Oct 2024 14:02:32 UTC

> On Oct 8, 2024, at 8:25 PM, Mark Johnston <markj@freebsd.org> wrote:
> 
> On Mon, Oct 07, 2024 at 10:52:19PM +0800, Zhenlei Huang wrote:
>> 
>> 
>>> On Oct 2, 2024, at 3:42 PM, Mark Johnston <markj@freebsd.org> wrote:
>>> 
>>> On Tue, Oct 01, 2024 at 12:46:07PM +0000, Franco Fichtner wrote:
>>>> Hi,
>>>> 
>>>>> On 1. Oct 2024, at 02:47, Zhenlei Huang <zlei@FreeBSD.org> wrote:
>>>>> 
>>>>> The test plan is simple, either of the following should suffice:
>>>>> 
>>>>> • Do traffic sniffing on axgbe interface. The interface will enter promisc mode and should see packets not for us.
>>>> 
>>>> I tested this with and without the patch and it's inconclusive:
>>>> 
>>>> 1. tcpdump sees foreign packets with and without patch
>>>> 2. tcpdump -p sees foreign packets with and without patch
>>> 
>>> That's somewhat surprising.
>> 
>> Maybe the firmware / hardware happens to been ( wrongly ) set to promisc mode already ?
> 
> Maybe, or the driver is missing some initialization step.
> 
>>>> This oddly enough matches my expectation that nobody raised issues about
>>>> promisc not working so far, but it leaves the question if we are/I am testing the
>>>> right thing?
>>> 
>>> I think you are.  BPF uses ifpromisc() to enable promiscuous mode, and
>>> tcpdump uses that interface rather than setting IFF_PPROMISC directly,
>>> and without the patch I expect that that's a bit broken.
>>> 
>>> There is perhaps an unrelated driver bug there.  I wonder what flags get
>>> printed by ifconfig before and during your experiments.  It'd also be
>>> useful to try enabling debug logging (sysctl
>>> dev.ax.0.axgbe_debug_level=1, I think) to see if axgbe_if_promisc_set()
>>> is getting executed as expected.
>> 
>> Probably I should firstly check D46794 in. Any idea ?
> 
> I have no objection, but it would be good to understand this better.

Committed as c7a2636889a6.

> 
>>>> Cheers,
>>>> Franco
>>>> 
>>>> ax0: <AMD 10 Gigabit Ethernet Driver> mem 0x80160000-0x8017ffff,0x80140000-0x8015ffff,0x80188000-0x80189fff at device 0.4 on pci6
>>>> ax0: Using 512 TX descriptors and 512 RX descriptors
>>>> ax0: Using 4 RX queues 4 TX queues
>>>> ax0: Using MSI-X interrupts with 8 vectors
>>>> ax0: Ethernet address: XX:XX:XX:XX:XX:XX
>>>> ax0: xgbe_config_sph_mode: SPH disabled in channel 0
>>>> ax0: xgbe_config_sph_mode: SPH disabled in channel 1
>>>> ax0: xgbe_config_sph_mode: SPH disabled in channel 2
>>>> ax0: xgbe_config_sph_mode: SPH disabled in channel 3
>>>> ax0: RSS Enabled
>>>> ax0: Receive checksum offload Enabled
>>>> ax0: VLAN filtering Enabled
>>>> ax0: VLAN Stripping Enabled
>>>> ax0: Checking GPIO expander validity
>>>> ax0: GPIO configuration valid
>>>> ax0: SFP detected:
>>>> ax0:   vendor: FS               ax0:   part number:    SFP-10G-T        ax0:   revision level: A    ax0:   serial number:  XXXXXXXXXXX      ax0: netmap queues/slots: TX 4/512, RX 4/512
>>>> ax0: Link is UP - 10Gbps/Full - flow control off
>>>> ax0: link state changed to UP
>>>> ax0: xgbe_config_sph_mode: SPH disabled in channel 0
>>>> ax0: xgbe_config_sph_mode: SPH disabled in channel 1
>>>> ax0: xgbe_config_sph_mode: SPH disabled in channel 2
>>>> ax0: xgbe_config_sph_mode: SPH disabled in channel 3
>>>> ax0: RSS Enabled
>>>> ax0: Receive checksum offload Disabled
>>>> ax0: VLAN filtering Disabled
>>>> ax0: VLAN Stripping Disabled
>>>> ax0: promiscuous mode enabled
>>>> ax0: promiscuous mode disabled