Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Oct 2024 22:02:32 +0800
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        Mark Johnston <markj@freebsd.org>
Cc:        Franco Fichtner <franco@opnsense.org>, FreeBSD Net <freebsd-net@freebsd.org>
Subject:   Re: CALL FOR TEST axgbe promisc mode
Message-ID:  <183955FE-665B-4A5D-ADE7-A2FC29469DDC@FreeBSD.org>
In-Reply-To: <ZwUku6gGJTMzJBG5@nuc>
References:  <31932BD6-8427-4E68-8496-81AADCE9E290@FreeBSD.org> <54063277-FDC6-4B69-914E-08044E09346F@opnsense.org> <Zvz5VjK9V0lsxPQ8@nuc> <C7FA3A6C-DE02-40ED-BB3A-927B56D316A8@FreeBSD.org> <ZwUku6gGJTMzJBG5@nuc>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]


> 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




[-- Attachment #2 --]
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 8, 2024, at 8:25 PM, Mark Johnston &lt;<a href="mailto:markj@freebsd.org" class="">markj@freebsd.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta charset="UTF-8" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">On Mon, Oct 07, 2024 at 10:52:19PM +0800, Zhenlei Huang wrote:</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class=""><br class=""><blockquote type="cite" class="">On Oct 2, 2024, at 3:42 PM, Mark Johnston &lt;<a href="mailto:markj@freebsd.org" class="">markj@freebsd.org</a>&gt; wrote:<br class=""><br class="">On Tue, Oct 01, 2024 at 12:46:07PM +0000, Franco Fichtner wrote:<br class=""><blockquote type="cite" class="">Hi,<br class=""><br class=""><blockquote type="cite" class="">On 1. Oct 2024, at 02:47, Zhenlei Huang &lt;<a href="mailto:zlei@FreeBSD.org" class="">zlei@FreeBSD.org</a>&gt; wrote:<br class=""><br class="">The test plan is simple, either of the following should suffice:<br class=""><br class="">• Do traffic sniffing on axgbe interface. The interface will enter promisc mode and should see packets not for us.<br class=""></blockquote><br class="">I tested this with and without the patch and it's inconclusive:<br class=""><br class="">1. tcpdump sees foreign packets with and without patch<br class="">2. tcpdump -p sees foreign packets with and without patch<br class=""></blockquote><br class="">That's somewhat surprising.<br class=""></blockquote><br class="">Maybe the firmware / hardware happens to been ( wrongly ) set to promisc mode already ?<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Maybe, or the driver is missing some initialization step.</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">This oddly enough matches my expectation that nobody raised issues about<br class="">promisc not working so far, but it leaves the question if we are/I am testing the<br class="">right thing?<br class=""></blockquote><br class="">I think you are. &nbsp;BPF uses ifpromisc() to enable promiscuous mode, and<br class="">tcpdump uses that interface rather than setting IFF_PPROMISC directly,<br class="">and without the patch I expect that that's a bit broken.<br class=""><br class="">There is perhaps an unrelated driver bug there. &nbsp;I wonder what flags get<br class="">printed by ifconfig before and during your experiments. &nbsp;It'd also be<br class="">useful to try enabling debug logging (sysctl<br class="">dev.ax.0.axgbe_debug_level=1, I think) to see if axgbe_if_promisc_set()<br class="">is getting executed as expected.<br class=""></blockquote><br class="">Probably I should firstly check D46794 in. Any idea ?<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">I have no objection, but it would be good to understand this better.</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""></div></blockquote><div><br class=""></div><div>Committed as&nbsp;c7a2636889a6.</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Menlo-Regular; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">Cheers,<br class="">Franco<br class=""><br class="">ax0: &lt;AMD 10 Gigabit Ethernet Driver&gt; mem 0x80160000-0x8017ffff,0x80140000-0x8015ffff,0x80188000-0x80189fff at device 0.4 on pci6<br class="">ax0: Using 512 TX descriptors and 512 RX descriptors<br class="">ax0: Using 4 RX queues 4 TX queues<br class="">ax0: Using MSI-X interrupts with 8 vectors<br class="">ax0: Ethernet address: XX:XX:XX:XX:XX:XX<br class="">ax0: xgbe_config_sph_mode: SPH disabled in channel 0<br class="">ax0: xgbe_config_sph_mode: SPH disabled in channel 1<br class="">ax0: xgbe_config_sph_mode: SPH disabled in channel 2<br class="">ax0: xgbe_config_sph_mode: SPH disabled in channel 3<br class="">ax0: RSS Enabled<br class="">ax0: Receive checksum offload Enabled<br class="">ax0: VLAN filtering Enabled<br class="">ax0: VLAN Stripping Enabled<br class="">ax0: Checking GPIO expander validity<br class="">ax0: GPIO configuration valid<br class="">ax0: SFP detected:<br class="">ax0: &nbsp;&nbsp;vendor: FS &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ax0: &nbsp;&nbsp;part number: &nbsp;&nbsp;&nbsp;SFP-10G-T &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ax0: &nbsp;&nbsp;revision level: A &nbsp;&nbsp;&nbsp;ax0: &nbsp;&nbsp;serial number: &nbsp;XXXXXXXXXXX &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ax0: netmap queues/slots: TX 4/512, RX 4/512<br class="">ax0: Link is UP - 10Gbps/Full - flow control off<br class="">ax0: link state changed to UP<br class="">ax0: xgbe_config_sph_mode: SPH disabled in channel 0<br class="">ax0: xgbe_config_sph_mode: SPH disabled in channel 1<br class="">ax0: xgbe_config_sph_mode: SPH disabled in channel 2<br class="">ax0: xgbe_config_sph_mode: SPH disabled in channel 3<br class="">ax0: RSS Enabled<br class="">ax0: Receive checksum offload Disabled<br class="">ax0: VLAN filtering Disabled<br class="">ax0: VLAN Stripping Disabled<br class="">ax0: promiscuous mode enabled<br class="">ax0: promiscuous mode disabled</blockquote></blockquote></blockquote></div></blockquote></div><br class=""><div class="">
<div><br class=""></div>

</div>
<br class=""></body></html>

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?183955FE-665B-4A5D-ADE7-A2FC29469DDC>