Date: Mon, 28 Jul 2025 21:01:39 +0200 From: Kristof Provost <kp@FreeBSD.org> To: Warner Losh <imp@bsdimp.com> Cc: Warner Losh <imp@freebsd.org>, Eric Joyner <eric.joyner@intel.com>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 430f1acc451c - main - ice(4): Add MAC filter and VLAN resource limits to VFs Message-ID: <F0A45EE7-B379-4CED-A8E9-089ECC14A302@FreeBSD.org> In-Reply-To: <CANCZdfqMQ5pktZp_o8sAUEcLH=8WKaqmofmYx6EZpMNJcc=2Rg@mail.gmail.com> References: <202507181916.56IJGLMK001122@gitrepo.freebsd.org> <A6ABB965-BD49-492D-B3AA-0EA973C344D6@FreeBSD.org> <CANCZdfqMQ5pktZp_o8sAUEcLH=8WKaqmofmYx6EZpMNJcc=2Rg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--=_MailMate_9A18F802-6A99-4690-A7E7-6E332B7DEDC3_= Content-Type: text/plain; charset=UTF-8; format=flowed; markup=markdown Content-Transfer-Encoding: quoted-printable That=E2=80=99s confirmed, that has indeed fixed the arm64 LINT build erro= rs. Thanks des. We=E2=80=99re still failing riscv and i386, but those are different error= s. The riscv one is new (or I haven=E2=80=99t seen it before, anyway): --- all_subdir_usr.bin --- ld: error: undefined symbol: llvm::DisableABIBreakingChecks >>> referenced by ClangScanDeps.cpp >>> = ClangScanDeps.pieo:(llvm::VerifyDisableABIBreakingChecks) c++: error: linker command failed with exit code 1 (use -v to see = invocation) i386 has been failing for a while: --- all_subdir_sbin/recoverdisk --- /usr/src/sbin/recoverdisk/recoverdisk.c:830:38: error: comparison of = integers of different signs: 'unsigned int' and 'time_t' (aka 'int') = [-Werror,-Wsign-compare] --- all_subdir_usr.bin --- --- uuencode.o --- cc -target i386-unknown-freebsd15.0 = --sysroot=3D/usr/obj/usr/src/i386.i386/tmp = -B/usr/obj/usr/src/i386.i386/tmp/usr/bin -O2 -pipe -fno-common -g = -gz=3Dzlib -MD -MF.depend.uuencode.o -MTuu encode.o -std=3Dgnu17 -Wno-format-zero-length -fstack-protector-strong = -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter = -Wstrict-prototypes -Wmissing-prototypes -Wpoi nter-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow = -Wunused-parameter -Wcast-align -Wchar-subscripts -Wnested-externs = -Wold-style-definition -Wno-pointer-sign -Wdate-t ime -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body = -Wno-string-plus-int -Wno-unused-const-variable = -Wno-error=3Dunused-but-set-parameter -Wno-error=3Dcast-function-type-mis= ma tch -Qunused-arguments -c /usr/src/usr.bin/bintrans/uuencode.c -o = uuencode.o --- all_subdir_sbin --- 830 | if (unsaved && (t_save + snapshot) < t_now) { | ~~~~~~~~~~~~~~~~~ ^ ~~~~~ 1 error generated. *** [recoverdisk.o] Error code 1 =E2=80=94 Kristof On 28 Jul 2025, at 19:45, Warner Losh wrote: > I think DES may have just fixed this. Can you confirm? > > Warner > > On Mon, Jul 28, 2025 at 3:23=E2=80=AFAM Kristof Provost <kp@freebsd.org= > = > wrote: >> >> I=E2=80=99m not sure if it=E2=80=99s this specific commit or another o= ne in the = >> recent dev/ice updates, but the arm64 LINT-FDT, LINT-ACPI and LINT = >> builds all fail. >> >> This is from arm64-LINT: >> >> ld: error: undefined symbol: ice_iov_attach >> >>> referenced by if_ice_iflib.c:859 = >> (/usr/src/sys/dev/ice/if_ice_iflib.c:859) >> >>> if_ice_iflib.o:(ice_if_attach_post) >> >> ld: error: undefined symbol: ice_iov_detach >> >>> referenced by if_ice_iflib.c:989 = >> (/usr/src/sys/dev/ice/if_ice_iflib.c:989) >> >>> if_ice_iflib.o:(ice_if_detach) >> >>> referenced by if_ice_iflib.c:2323 = >> (/usr/src/sys/dev/ice/if_ice_iflib.c:2323) >> >>> if_ice_iflib.o:(ice_if_update_admin_status) >> >>> referenced by if_ice_iflib.c:2376 = >> (/usr/src/sys/dev/ice/if_ice_iflib.c:2376) >> >>> if_ice_iflib.o:(ice_transition_safe_mode) >> >> ld: error: undefined symbol: ice_iov_add_vf >> >>> referenced by if_ice_iflib.c:3464 = >> (/usr/src/sys/dev/ice/if_ice_iflib.c:3464) >> >>> if_ice_iflib.o:(ice_if_iov_vf_add) >> >> ld: error: undefined symbol: ice_iov_init >> >>> referenced by if_ice_iflib.c:3429 = >> (/usr/src/sys/dev/ice/if_ice_iflib.c:3429) >> >>> if_ice_iflib.o:(ice_if_iov_init) >> >> ld: error: undefined symbol: ice_iov_uninit >> >>> referenced by if_ice_iflib.c:3445 = >> (/usr/src/sys/dev/ice/if_ice_iflib.c:3445) >> >>> if_ice_iflib.o:(ice_if_iov_uninit) >> >> ld: error: undefined symbol: ice_iov_handle_vflr >> >>> referenced by if_ice_iflib.c:3480 = >> (/usr/src/sys/dev/ice/if_ice_iflib.c:3480) >> >>> if_ice_iflib.o:(ice_if_vflr_handle) >> >> ld: error: undefined symbol: ice_vc_notify_all_vfs_link_state >> >>> referenced by if_ice_iflib.c:757 = >> (/usr/src/sys/dev/ice/if_ice_iflib.c:757) >> >>> if_ice_iflib.o:(ice_update_link_status) >> >> ld: error: undefined symbol: ice_vc_handle_vf_msg >> >>> referenced by ice_lib.c:2285 = >> (/usr/src/sys/dev/ice/ice_lib.c:2285) >> >>> ice_lib.o:(ice_process_ctrlq) >> *** [kernel.full] Error code 1 >> >> =E2=80=94 >> Kristof >> >> On 18 Jul 2025, at 21:16, Warner Losh wrote: >>> The branch main has been updated by imp: >>> >>> URL: = >>> https://cgit.FreeBSD.org/src/commit/?id=3D430f1acc451c7084d1d5aa7df7e= 7ecccea1a8b51 >>> >>> commit 430f1acc451c7084d1d5aa7df7e7ecccea1a8b51 >>> Author: Eric Joyner <eric.joyner@intel.com> >>> AuthorDate: 2024-10-17 22:19:09 +0000 >>> Commit: Warner Losh <imp@FreeBSD.org> >>> CommitDate: 2025-07-18 19:16:17 +0000 >>> >>> ice(4): Add MAC filter and VLAN resource limits to VFs >>> >>> Adds two new parameters to iovctl config for VLAN filter limits = >>> and MAC >>> filter limits and gives them defaults of 64 and 16, = >>> respectively. >>> >>> These are intended to limit the number of resources that a VF = >>> can >>> consume so that any one VF cannot starve an other VFs or the PF = >>> of >>> filters. >>> >>> Signed-off-by: Eric Joyner <eric.joyner@intel.com> >>> Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com> >>> Reviewed by: imp >>> Pull Request: https://github.com/freebsd/freebsd-src/pull/1573 >>> --- >>> sys/dev/ice/ice_iov.c | 45 = >>> ++++++++++++++++++++++++++++++++++++++++++--- >>> sys/dev/ice/ice_iov.h | 8 ++++++++ >>> 2 files changed, 50 insertions(+), 3 deletions(-) >>> >>> diff --git a/sys/dev/ice/ice_iov.c b/sys/dev/ice/ice_iov.c >>> index fc37a0e7679c..e06c7eb56f7a 100644 >>> --- a/sys/dev/ice/ice_iov.c >>> +++ b/sys/dev/ice/ice_iov.c >>> @@ -117,6 +117,10 @@ ice_iov_attach(struct ice_softc *sc) >>> IOV_SCHEMA_HASDEFAULT, ICE_DEFAULT_VF_QUEUES); >>> pci_iov_schema_add_uint16(vf_schema, "mirror-src-vsi", >>> IOV_SCHEMA_HASDEFAULT, ICE_INVALID_MIRROR_VSI); >>> + pci_iov_schema_add_uint16(vf_schema, "max-vlan-allowed", >>> + IOV_SCHEMA_HASDEFAULT, ICE_DEFAULT_VF_VLAN_LIMIT); >>> + pci_iov_schema_add_uint16(vf_schema, "max-mac-filters", >>> + IOV_SCHEMA_HASDEFAULT, ICE_DEFAULT_VF_FILTER_LIMIT); >>> >>> error =3D pci_iov_attach(dev, pf_schema, vf_schema); >>> if (error !=3D 0) { >>> @@ -360,6 +364,9 @@ ice_iov_add_vf(struct ice_softc *sc, uint16_t = >>> vfnum, const nvlist_t *params) >>> >>> vsi->mirror_src_vsi =3D nvlist_get_number(params, = >>> "mirror-src-vsi"); >>> >>> + vf->vlan_limit =3D nvlist_get_number(params, = >>> "max-vlan-allowed"); >>> + vf->mac_filter_limit =3D nvlist_get_number(params, = >>> "max-mac-filters"); >>> + >>> vf->vf_flags |=3D VF_FLAG_VLAN_CAP; >>> >>> /* Create and setup VSI in HW */ >>> @@ -735,10 +742,17 @@ ice_vc_add_eth_addr_msg(struct ice_softc *sc, = >>> struct ice_vf *vf, u8 *msg_buf) >>> enum virtchnl_status_code v_status =3D VIRTCHNL_STATUS_SUCCESS;= >>> struct virtchnl_ether_addr_list *addr_list; >>> struct ice_hw *hw =3D &sc->hw; >>> + u16 added_addr_cnt =3D 0; >>> int error =3D 0; >>> >>> addr_list =3D (struct virtchnl_ether_addr_list *)msg_buf; >>> >>> + if (addr_list->num_elements > >>> + (vf->mac_filter_limit - vf->mac_filter_cnt)) { >>> + v_status =3D VIRTCHNL_STATUS_ERR_NO_MEMORY; >>> + goto done; >>> + } >>> + >>> for (int i =3D 0; i < addr_list->num_elements; i++) { >>> u8 *addr =3D addr_list->list[i].addr; >>> >>> @@ -767,10 +781,15 @@ ice_vc_add_eth_addr_msg(struct ice_softc *sc, = >>> struct ice_vf *vf, u8 *msg_buf) >>> "%s: VF-%d: Error adding MAC addr for VSI = >>> %d\n", >>> __func__, vf->vf_num, vf->vsi->idx); >>> v_status =3D VIRTCHNL_STATUS_ERR_PARAM; >>> - goto done; >>> + continue; >>> } >>> + /* Don't count VF's MAC against its MAC filter limit = >>> */ >>> + if (memcmp(addr, vf->mac, ETHER_ADDR_LEN)) >>> + added_addr_cnt++; >>> } >>> >>> + vf->mac_filter_cnt +=3D added_addr_cnt; >>> + >>> done: >>> ice_aq_send_msg_to_vf(hw, vf->vf_num, = >>> VIRTCHNL_OP_ADD_ETH_ADDR, >>> v_status, NULL, 0, NULL); >>> @@ -791,6 +810,7 @@ ice_vc_del_eth_addr_msg(struct ice_softc *sc, = >>> struct ice_vf *vf, u8 *msg_buf) >>> enum virtchnl_status_code v_status =3D VIRTCHNL_STATUS_SUCCESS;= >>> struct virtchnl_ether_addr_list *addr_list; >>> struct ice_hw *hw =3D &sc->hw; >>> + u16 deleted_addr_cnt =3D 0; >>> int error =3D 0; >>> >>> addr_list =3D (struct virtchnl_ether_addr_list *)msg_buf; >>> @@ -802,11 +822,18 @@ ice_vc_del_eth_addr_msg(struct ice_softc *sc, = >>> struct ice_vf *vf, u8 *msg_buf) >>> "%s: VF-%d: Error removing MAC addr for = >>> VSI %d\n", >>> __func__, vf->vf_num, vf->vsi->idx); >>> v_status =3D VIRTCHNL_STATUS_ERR_PARAM; >>> - goto done; >>> + continue; >>> } >>> + /* Don't count VF's MAC against its MAC filter limit = >>> */ >>> + if (memcmp(addr_list->list[i].addr, vf->mac, = >>> ETHER_ADDR_LEN)) >>> + deleted_addr_cnt++; >>> } >>> >>> -done: >>> + if (deleted_addr_cnt >=3D vf->mac_filter_cnt) >>> + vf->mac_filter_cnt =3D 0; >>> + else >>> + vf->mac_filter_cnt -=3D deleted_addr_cnt; >>> + >>> ice_aq_send_msg_to_vf(hw, vf->vf_num, = >>> VIRTCHNL_OP_DEL_ETH_ADDR, >>> v_status, NULL, 0, NULL); >>> } >>> @@ -838,6 +865,11 @@ ice_vc_add_vlan_msg(struct ice_softc *sc, = >>> struct ice_vf *vf, u8 *msg_buf) >>> goto done; >>> } >>> >>> + if (vlan_list->num_elements > (vf->vlan_limit - vf->vlan_cnt)) = >>> { >>> + v_status =3D VIRTCHNL_STATUS_ERR_NO_MEMORY; >>> + goto done; >>> + } >>> + >>> status =3D ice_add_vlan_hw_filters(vsi, vlan_list->vlan_id, >>> vlan_list->num_elements); >>> if (status) { >>> @@ -849,6 +881,8 @@ ice_vc_add_vlan_msg(struct ice_softc *sc, struct = >>> ice_vf *vf, u8 *msg_buf) >>> goto done; >>> } >>> >>> + vf->vlan_cnt +=3D vlan_list->num_elements; >>> + >>> done: >>> ice_aq_send_msg_to_vf(hw, vf->vf_num, VIRTCHNL_OP_ADD_VLAN, >>> v_status, NULL, 0, NULL); >>> @@ -892,6 +926,11 @@ ice_vc_del_vlan_msg(struct ice_softc *sc, = >>> struct ice_vf *vf, u8 *msg_buf) >>> goto done; >>> } >>> >>> + if (vlan_list->num_elements >=3D vf->vlan_cnt) >>> + vf->vlan_cnt =3D 0; >>> + else >>> + vf->vlan_cnt -=3D vlan_list->num_elements; >>> + >>> done: >>> ice_aq_send_msg_to_vf(hw, vf->vf_num, VIRTCHNL_OP_DEL_VLAN, >>> v_status, NULL, 0, NULL); >>> diff --git a/sys/dev/ice/ice_iov.h b/sys/dev/ice/ice_iov.h >>> index c2ac5fcd5c94..c4fb3e932e3f 100644 >>> --- a/sys/dev/ice/ice_iov.h >>> +++ b/sys/dev/ice/ice_iov.h >>> @@ -85,6 +85,11 @@ struct ice_vf { >>> u16 vf_num; >>> struct virtchnl_version_info version; >>> >>> + u16 mac_filter_limit; >>> + u16 mac_filter_cnt; >>> + u16 vlan_limit; >>> + u16 vlan_cnt; >>> + >>> u16 num_irq_vectors; >>> u16 *vf_imap; >>> struct ice_irq_vector *tx_irqvs; >>> @@ -101,6 +106,9 @@ struct ice_vf { >>> #define ICE_VIRTCHNL_VALID_PROMISC_FLAGS = >>> (FLAG_VF_UNICAST_PROMISC | \ >>> FLAG_VF_MULTICAST_PROM= ISC) >>> >>> +#define ICE_DEFAULT_VF_VLAN_LIMIT 64 >>> +#define ICE_DEFAULT_VF_FILTER_LIMIT 16 >>> + >>> int ice_iov_attach(struct ice_softc *sc); >>> int ice_iov_detach(struct ice_softc *sc); --=_MailMate_9A18F802-6A99-4690-A7E7-6E332B7DEDC3_= Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <!DOCTYPE html> <html> <head> <meta http-equiv=3D"Content-Type" content=3D"text/xhtml; charset=3Dutf-8"= > </head> <body><div style=3D"font-family: sans-serif;"><div class=3D"markdown" sty= le=3D"white-space: normal;"> <p dir=3D"auto">That=E2=80=99s confirmed, that has indeed fixed the arm64= LINT build errors.<br> Thanks des.</p> <p dir=3D"auto">We=E2=80=99re still failing riscv and i386, but those are= different errors.</p> <p dir=3D"auto">The riscv one is new (or I haven=E2=80=99t seen it before= , anyway):</p> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">--= - all_subdir_usr.bin --- ld: error: undefined symbol: llvm::DisableABIBreakingChecks >>> referenced by ClangScanDeps.cpp >>> ClangScanDeps.pieo:(llvm::VerifyDisableABIBrea= kingChecks) c++: error: linker command failed with exit code 1 (use -v to see invocat= ion) </code></pre> <p dir=3D"auto">i386 has been failing for a while:</p> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">--= - all_subdir_sbin/recoverdisk --- /usr/src/sbin/recoverdisk/recoverdisk.c:830:38: error: comparison of inte= gers of different signs: 'unsigned int' and 'time_t' (aka 'int') [-Werror= ,-Wsign-compare] --- all_subdir_usr.bin --- --- uuencode.o --- cc -target i386-unknown-freebsd15.0 --sysroot=3D/usr/obj/usr/src/i386.i38= 6/tmp -B/usr/obj/usr/src/i386.i386/tmp/usr/bin -O2 -pipe -fno-common -= g -gz=3Dzlib -MD -MF.depend.uuencode.o -MTuu encode.o -std=3Dgnu17 -Wno-format-zero-length -fstack-protector-strong -W= system-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Ws= trict-prototypes -Wmissing-prototypes -Wpoi nter-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -W= unused-parameter -Wcast-align -Wchar-subscripts -Wnested-externs -Wold-st= yle-definition -Wno-pointer-sign -Wdate-t ime -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-= string-plus-int -Wno-unused-const-variable -Wno-error=3Dunused-but-set-pa= rameter -Wno-error=3Dcast-function-type-misma tch -Qunused-arguments -c /usr/src/usr.bin/bintrans/uuencode.c -o uu= encode.o --- all_subdir_sbin --- 830 | if (unsaved && (t_save + snapshot) < t= _now) { | ~~~~~~~~~~~~~~~~~ ^ ~~~~~ 1 error generated. *** [recoverdisk.o] Error code 1 </code></pre> <p dir=3D"auto">=E2=80=94<br> Kristof</p> <p dir=3D"auto">On 28 Jul 2025, at 19:45, Warner Losh wrote:</p> <blockquote style=3D"margin: 0 0 5px; padding-left: 5px; border-left: 2px= solid #136BCE; color: #136BCE;"> <p dir=3D"auto">I think DES may have just fixed this. Can you confirm?</p= > <p dir=3D"auto">Warner</p> <p dir=3D"auto">On Mon, Jul 28, 2025 at 3:23=E2=80=AFAM Kristof Provost <= a href=3D"mailto:kp@freebsd.org">kp@freebsd.org</a> wrote:</p> <blockquote style=3D"margin: 0 0 5px; padding-left: 5px; border-left: 2px= solid #136BCE; border-left-color: #4B89CF; color: #4B89CF;"> <p dir=3D"auto">I=E2=80=99m not sure if it=E2=80=99s this specific commit= or another one in the recent dev/ice updates, but the arm64 LINT-FDT, LI= NT-ACPI and LINT builds all fail.</p> <p dir=3D"auto">This is from arm64-LINT:</p> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = ld: error: undefined symbol: ice_iov_attach >>> referenced by if_ice_iflib.c:859 (/usr/src/sys/dev/ice/i= f_ice_iflib.c:859) >>> if_ice_iflib.o:(ice_if_attach_post) ld: error: undefined symbol: ice_iov_detach >>> referenced by if_ice_iflib.c:989 (/usr/src/sys/dev/ice/i= f_ice_iflib.c:989) >>> if_ice_iflib.o:(ice_if_detach) >>> referenced by if_ice_iflib.c:2323 (/usr/src/sys/dev/ice/= if_ice_iflib.c:2323) >>> if_ice_iflib.o:(ice_if_update_admin_status= ) >>> referenced by if_ice_iflib.c:2376 (/usr/src/sys/dev/ice/= if_ice_iflib.c:2376) >>> if_ice_iflib.o:(ice_transition_safe_mode) ld: error: undefined symbol: ice_iov_add_vf >>> referenced by if_ice_iflib.c:3464 (/usr/src/sys/dev/ice/= if_ice_iflib.c:3464) >>> if_ice_iflib.o:(ice_if_iov_vf_add) ld: error: undefined symbol: ice_iov_init >>> referenced by if_ice_iflib.c:3429 (/usr/src/sys/dev/ice/= if_ice_iflib.c:3429) >>> if_ice_iflib.o:(ice_if_iov_init) ld: error: undefined symbol: ice_iov_uninit >>> referenced by if_ice_iflib.c:3445 (/usr/src/sys/dev/ice/= if_ice_iflib.c:3445) >>> if_ice_iflib.o:(ice_if_iov_uninit) ld: error: undefined symbol: ice_iov_handle_vflr >>> referenced by if_ice_iflib.c:3480 (/usr/src/sys/dev/ice/= if_ice_iflib.c:3480) >>> if_ice_iflib.o:(ice_if_vflr_handle) ld: error: undefined symbol: ice_vc_notify_all_vfs_link_state >>> referenced by if_ice_iflib.c:757 (/usr/src/sys/dev/ice/i= f_ice_iflib.c:757) >>> if_ice_iflib.o:(ice_update_link_status) ld: error: undefined symbol: ice_vc_handle_vf_msg >>> referenced by ice_lib.c:2285 (/usr/src/sys/dev/ice/ice_l= ib.c:2285) >>> ice_lib.o:(ice_process_ctrlq) *** [kernel.full] Error code 1 </code></pre> <p dir=3D"auto">=E2=80=94<br> Kristof</p> <p dir=3D"auto">On 18 Jul 2025, at 21:16, Warner Losh wrote:</p> <blockquote style=3D"margin: 0 0 5px; padding-left: 5px; border-left: 2px= solid #136BCE; border-left-color: #4B89CF; color: #4B89CF;"> <p dir=3D"auto">The branch main has been updated by imp:</p> <p dir=3D"auto">URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D= 430f1acc451c7084d1d5aa7df7e7ecccea1a8b51">https://cgit.FreeBSD.org/src/co= mmit/?id=3D430f1acc451c7084d1d5aa7df7e7ecccea1a8b51</a></p> <p dir=3D"auto">commit 430f1acc451c7084d1d5aa7df7e7ecccea1a8b51<br> Author: Eric Joyner <a href=3D"mailto:eric.joyner@intel.com">eric.joy= ner@intel.com</a><br> AuthorDate: 2024-10-17 22:19:09 +0000<br> Commit: Warner Losh <a href=3D"mailto:imp@FreeBSD.org">imp@FreeBSD.or= g</a><br> CommitDate: 2025-07-18 19:16:17 +0000</p> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">ic= e(4): Add MAC filter and VLAN resource limits to VFs Adds two new parameters to iovctl config for VLAN filter limits and MAC filter limits and gives them defaults of 64 and 16, respectively. These are intended to limit the number of resources that a VF can consume so that any one VF cannot starve an other VFs or the PF of filters. Signed-off-by: Eric Joyner <eric.joyner@intel.com> Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1573 </code></pre> <hr> <p dir=3D"auto">sys/dev/ice/ice_iov.c | 45 ++++++++++++++++++++++++++++++= ++++++++++++---<br> sys/dev/ice/ice_iov.h | 8 ++++++++<br> 2 files changed, 50 insertions(+), 3 deletions(-)</p> <p dir=3D"auto">diff --git a/sys/dev/ice/ice_iov.c b/sys/dev/ice/ice_iov.= c<br> index fc37a0e7679c..e06c7eb56f7a 100644<br> --- a/sys/dev/ice/ice_iov.c<br> +++ b/sys/dev/ice/ice_iov.c<br> @@ -117,6 +117,10 @@ ice_iov_attach(struct ice_softc *sc)<br> IOV_SCHEMA_HASDEFAULT, ICE_DEFAULT_VF_QUEUES);<br> pci_iov_schema_add_uint16(vf_schema, "mirror-src-vsi",<br> IOV_SCHEMA_HASDEFAULT, ICE_INVALID_MIRROR_VSI);</p> <ul> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">pc= i_iov_schema_add_uint16(vf_schema, "max-vlan-allowed", </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = IOV_SCHEMA_HASDEFAULT, ICE_DEFAULT_VF_VLAN_LIMIT); </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">pc= i_iov_schema_add_uint16(vf_schema, "max-mac-filters", </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = IOV_SCHEMA_HASDEFAULT, ICE_DEFAULT_VF_FILTER_LIMIT); error =3D pci_iov_attach(dev, pf_schema, vf_schema); if (error !=3D 0) { </code></pre> </li> </ul> <p dir=3D"auto">@@ -360,6 +364,9 @@ ice_iov_add_vf(struct ice_softc *sc, = uint16_t vfnum, const nvlist_t *params)</p> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = vsi->mirror_src_vsi =3D nvlist_get_number(params, "mirror-src-vsi= "); </code></pre> <ul> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">vf= ->vlan_limit =3D nvlist_get_number(params, "max-vlan-allowed"= ;); </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">vf= ->mac_filter_limit =3D nvlist_get_number(params, "max-mac-filters= "); </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">vf= ->vf_flags |=3D VF_FLAG_VLAN_CAP; /* Create and setup VSI in HW */ </code></pre> </li> </ul> <p dir=3D"auto">@@ -735,10 +742,17 @@ ice_vc_add_eth_addr_msg(struct ice_= softc *sc, struct ice_vf *vf, u8 *msg_buf)<br> enum virtchnl_status_code v_status =3D VIRTCHNL_STATUS_SUCCESS;<br> struct virtchnl_ether_addr_list *addr_list;<br> struct ice_hw *hw =3D &sc->hw;</p> <ul> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">u1= 6 added_addr_cnt =3D 0; int error =3D 0; addr_list =3D (struct virtchnl_ether_addr_list *)msg_buf; </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">if= (addr_list->num_elements > </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = (vf->mac_filter_limit - vf->mac_filter_cnt)) { </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = v_status =3D VIRTCHNL_STATUS_ERR_NO_MEMORY; </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = goto done; </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">} </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">fo= r (int i =3D 0; i < addr_list->num_elements; i++) { u8 *addr =3D addr_list->list[i].addr; </code></pre> </li> </ul> <p dir=3D"auto">@@ -767,10 +781,15 @@ ice_vc_add_eth_addr_msg(struct ice_= softc *sc, struct ice_vf *vf, u8 *msg_buf)<br> "%s: VF-%d: Error adding MAC addr for VSI %d\n",<br> <strong>func</strong>, vf->vf_num, vf->vsi->idx);<br> v_status =3D VIRTCHNL_STATUS_ERR_PARAM;</p> <ul> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = goto done; </code></pre> </li> </ul> <ul> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = continue; } </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = /* Don't count VF's MAC against its MAC filter limit */ </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = if (memcmp(addr, vf->mac, ETHER_ADDR_LEN)) </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = added_addr_cnt++; } </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">vf= ->mac_filter_cnt +=3D added_addr_cnt; </code></pre> </li> <li></li> </ul> <p dir=3D"auto">done:<br> ice_aq_send_msg_to_vf(hw, vf->vf_num, VIRTCHNL_OP_ADD_ETH_ADDR,<br> v_status, NULL, 0, NULL);<br> @@ -791,6 +810,7 @@ ice_vc_del_eth_addr_msg(struct ice_softc *sc, struct = ice_vf *vf, u8 *msg_buf)<br> enum virtchnl_status_code v_status =3D VIRTCHNL_STATUS_SUCCESS;<br> struct virtchnl_ether_addr_list *addr_list;<br> struct ice_hw *hw =3D &sc->hw;</p> <ul> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">u1= 6 deleted_addr_cnt =3D 0; int error =3D 0; addr_list =3D (struct virtchnl_ether_addr_list *)msg_buf; </code></pre> </li> </ul> <p dir=3D"auto">@@ -802,11 +822,18 @@ ice_vc_del_eth_addr_msg(struct ice_= softc *sc, struct ice_vf *vf, u8 *msg_buf)<br> "%s: VF-%d: Error removing MAC addr for VSI %d\n",<br> <strong>func</strong>, vf->vf_num, vf->vsi->idx);<br> v_status =3D VIRTCHNL_STATUS_ERR_PARAM;</p> <ul> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = goto done; </code></pre> </li> </ul> <ul> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = continue; } </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = /* Don't count VF's MAC against its MAC filter limit */ </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = if (memcmp(addr_list->list[i].addr, vf->mac, ETHER_ADDR_LEN))= </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = deleted_addr_cnt++; } </code></pre> </li> </ul> <p dir=3D"auto">-done:</p> <ul> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">if= (deleted_addr_cnt >=3D vf->mac_filter_cnt) </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = vf->mac_filter_cnt =3D 0; </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">el= se </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = vf->mac_filter_cnt -=3D deleted_addr_cnt; </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">ic= e_aq_send_msg_to_vf(hw, vf->vf_num, VIRTCHNL_OP_DEL_ETH_ADDR, v_status, NULL, 0, NULL); </code></pre> </li> </ul> <p dir=3D"auto">}<br> @@ -838,6 +865,11 @@ ice_vc_add_vlan_msg(struct ice_softc *sc, struct ice= _vf *vf, u8 *msg_buf)<br> goto done;<br> }</p> <ul> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">if= (vlan_list->num_elements > (vf->vlan_limit - vf->vlan_cnt)) = { </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = v_status =3D VIRTCHNL_STATUS_ERR_NO_MEMORY; </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = goto done; </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">} </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">st= atus =3D ice_add_vlan_hw_filters(vsi, vlan_list->vlan_id, vlan_list->num_elements); if (status) { </code></pre> </li> </ul> <p dir=3D"auto">@@ -849,6 +881,8 @@ ice_vc_add_vlan_msg(struct ice_softc = *sc, struct ice_vf *vf, u8 *msg_buf)<br> goto done;<br> }</p> <ul> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">vf= ->vlan_cnt +=3D vlan_list->num_elements; </code></pre> </li> <li></li> </ul> <p dir=3D"auto">done:<br> ice_aq_send_msg_to_vf(hw, vf->vf_num, VIRTCHNL_OP_ADD_VLAN,<br> v_status, NULL, 0, NULL);<br> @@ -892,6 +926,11 @@ ice_vc_del_vlan_msg(struct ice_softc *sc, struct ice= _vf *vf, u8 *msg_buf)<br> goto done;<br> }</p> <ul> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">if= (vlan_list->num_elements >=3D vf->vlan_cnt) </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = vf->vlan_cnt =3D 0; </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">el= se </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;"> = vf->vlan_cnt -=3D vlan_list->num_elements; </code></pre> </li> <li></li> </ul> <p dir=3D"auto">done:<br> ice_aq_send_msg_to_vf(hw, vf->vf_num, VIRTCHNL_OP_DEL_VLAN,<br> v_status, NULL, 0, NULL);<br> diff --git a/sys/dev/ice/ice_iov.h b/sys/dev/ice/ice_iov.h<br> index c2ac5fcd5c94..c4fb3e932e3f 100644<br> --- a/sys/dev/ice/ice_iov.h<br> +++ b/sys/dev/ice/ice_iov.h<br> @@ -85,6 +85,11 @@ struct ice_vf {<br> u16 vf_num;<br> struct virtchnl_version_info version;</p> <ul> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">u1= 6 mac_filter_limit; </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">u1= 6 mac_filter_cnt; </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">u1= 6 vlan_limit; </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">u1= 6 vlan_cnt; </code></pre> </li> <li> <pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border= : thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #= E4E4E4;"><code style=3D"padding: 0 0.25em; background-color: #E4E4E4;">u1= 6 num_irq_vectors; u16 *vf_imap; struct ice_irq_vector *tx_irqvs; </code></pre> </li> </ul> <p dir=3D"auto">@@ -101,6 +106,9 @@ struct ice_vf {<br> #define ICE_VIRTCHNL_VALID_PROMISC_FLAGS (FLAG_VF_UNICAST_PROMISC | <= br> FLAG_VF_MULTICAST_PROMISC)</p> <p dir=3D"auto">+#define ICE_DEFAULT_VF_VLAN_LIMIT 64<= br> +#define ICE_DEFAULT_VF_FILTER_LIMIT 16<br> +<br> int ice_iov_attach(struct ice_softc *sc);<br> int ice_iov_detach(struct ice_softc *sc);</p> </blockquote> </blockquote> </blockquote> </div> </div> </body> </html> --=_MailMate_9A18F802-6A99-4690-A7E7-6E332B7DEDC3_=--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F0A45EE7-B379-4CED-A8E9-089ECC14A302>