From nobody Wed Nov 3 19:59:52 2021 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CFE8E184A085 for ; Wed, 3 Nov 2021 19:59:53 +0000 (UTC) (envelope-from misho@elwix.org) Received: from mail.elwix.net (ns.aitbg.com [95.87.254.42]) by mx1.freebsd.org (Postfix) with ESMTP id 4HkyKj2Gqpz3Hqy for ; Wed, 3 Nov 2021 19:59:53 +0000 (UTC) (envelope-from misho@elwix.org) Received: from terran.aitnet.org (unknown [87.246.28.119]) by mail.elwix.net (Postfix) with ESMTPSA id 84198DB00 for ; Wed, 3 Nov 2021 21:55:49 +0200 (EET) Date: Wed, 3 Nov 2021 21:59:52 +0200 From: Michael Pounov To: freebsd-net@freebsd.org Subject: Broadcom bnxt driver issue with promisc mode Message-Id: <20211103215952.fefc8cf8eb96ebaf22bb4935@elwix.org> Organization: ELWIX X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd13.0) List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@freebsd.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart=_Wed__3_Nov_2021_21_59_52_+0200_k/o+IP0oGOyOxn+J" X-Rspamd-Queue-Id: 4HkyKj2Gqpz3Hqy X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of misho@elwix.org has no SPF policy when checking 95.87.254.42) smtp.mailfrom=misho@elwix.org X-Spamd-Result: default: False [2.75 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.35)[-0.348]; FROM_HAS_DN(0.00)[]; MV_CASE(0.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-diff]; HAS_ATTACHMENT(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-net@freebsd.org]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1]; HAS_ORG_HEADER(0.00)[]; TO_DN_NONE(0.00)[]; NEURAL_SPAM_SHORT(0.59)[0.593]; NEURAL_SPAM_LONG(1.00)[1.000]; DMARC_NA(0.00)[elwix.org]; R_SPF_NA(0.00)[no SPF record]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+]; ASN(0.00)[asn:43561, ipnet:95.87.192.0/18, country:BG]; RCVD_COUNT_TWO(0.00)[2]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[87.246.28.119:received] X-ThisMailContainsUnwantedMimeParts: N This is a multi-part message in MIME format. --Multipart=_Wed__3_Nov_2021_21_59_52_+0200_k/o+IP0oGOyOxn+J Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hello After survey about solution for Broadcom bnxt driver issue with promiscous mode. I am not found any normal solution with that situation. Only workaround to using promiscous mode to have normal operations with these cards. This isn't normal by me! I look and do some debug on bnxt driver. Issue came from hardware filter in ASIC. On init driver and its ring buffers default states of filter are all block. Also I saw that we have not ability to append configured VLANs on the host into broadcom vlan tag list to be allowed for further processing from network stack. Then my solution is simple and effective in such situation. I append to filter mask bit for passing further for processing all tagged vlans and native/primary vlan too. This is enough to have normal packet processing for bnxt driver. We have such BCM57414 NetXtreme-E 10Gb/25Gb RDMA Ethernet Controller. I tested patch on them. Patch is make on FreeBSD 14.0-CURRENT #3 main-n244973-c02a28754bc-dirty: Tue Nov 2 20:53:08 EET 2021 If you are thinking it is ok. You can feel free to merge it to FreeBSD existing driver. P.S. I found other small issues, but they are not show stoppers now for us. Br Michael Pounov CloudSigma AG ELWIX.ORG -- Michael Pounov --Multipart=_Wed__3_Nov_2021_21_59_52_+0200_k/o+IP0oGOyOxn+J Content-Type: text/x-diff; name="fix_bnxt_promisc.patch" Content-Disposition: attachment; filename="fix_bnxt_promisc.patch" Content-Transfer-Encoding: 7bit diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c index 7811f4fdebf..f4a53cd4d93 100644 --- a/sys/dev/bnxt/if_bnxt.c +++ b/sys/dev/bnxt/if_bnxt.c @@ -588,7 +588,8 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, softc->vnic_info.def_ring_grp = (uint16_t)HWRM_NA_SIGNATURE; softc->vnic_info.cos_rule = (uint16_t)HWRM_NA_SIGNATURE; softc->vnic_info.lb_rule = (uint16_t)HWRM_NA_SIGNATURE; - softc->vnic_info.rx_mask = HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST; + softc->vnic_info.rx_mask = HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST | + HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ANYVLAN_NONVLAN; softc->vnic_info.mc_list_count = 0; softc->vnic_info.flags = BNXT_VNIC_FLAG_DEFAULT; rc = iflib_dma_alloc(ctx, BNXT_MAX_MC_ADDRS * ETHER_ADDR_LEN, @@ -1392,8 +1393,7 @@ bnxt_promisc_set(if_ctx_t ctx, int flags) HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ANYVLAN_NONVLAN; else softc->vnic_info.rx_mask &= - ~(HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS | - HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ANYVLAN_NONVLAN); + ~(HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS); rc = bnxt_hwrm_cfa_l2_set_rx_mask(softc, &softc->vnic_info); --Multipart=_Wed__3_Nov_2021_21_59_52_+0200_k/o+IP0oGOyOxn+J--