net/sfc: improve Rx mode handling on VF
cover net/sfc: improve Rx mode handling on VF
VFs (as well as unpriviledged PFs) are not always allowed to enable promiscuous and all-multicast. Handle it properly and ensure consistency for settings applied and reported.
Base driver patches have warnings/errors from checkpatch.sh since coding style differs a bit.
Return of non-negative errno is OK as well, since driver does positive to negative errno conversion on return from callbacks.
Igor Romanov (6):
net/sfc/base: refactor filters cleanup in reconfigure net/sfc/base: refactor filters mark in reconfigure net/sfc/base: refactor unicast filters reconfiguration net/sfc/base: refactor mcast filters reconfiguration net/sfc/base: add API to get currently operating filters net/sfc: check actual all multicast unknown unicast filters
drivers/net/sfc/base/ef10_filter.c | 314 +++++++++++++++++++---------- drivers/net/sfc/base/efx.h | 6 + drivers/net/sfc/base/efx_impl.h | 2 + drivers/net/sfc/base/efx_mac.c | 15 ++ drivers/net/sfc/base/siena_mac.c | 2 + drivers/net/sfc/sfc.h | 1 + drivers/net/sfc/sfc_ethdev.c | 16 +- drivers/net/sfc/sfc_port.c | 62 +++++- drivers/net/sfc/sfc_rx.c | 4 +- 9 files changed, 310 insertions(+), 112 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/6 net/sfc/base: refactor filters cleanup in reconfigure
From: Igor Romanov <[email protected]>
Refactor the filters cleanup stage of the reconfigure function to make it clearer and allow for more convenient further changes.
--- drivers/net/sfc/base/ef10_filter.c | 44 ++++++++++++++++++------------ 1 file changed, 26 insertions(+), 18 deletions(-)
drivers/net/sfc/base/ef10_filter.c +26 -18
@@ -1756,6 +1756,31 @@ ef10_filter_get_workarounds( } +static void +ef10_filter_remove_all_existing_filters ( + __in efx_nic_t *enp) +{ +ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; +unsigned int i; + +for (i =0 ; i < table->eft_unicst_filter_count; i++) { +ef10_filter_delete_auto (enp, + table->eft_unicst_filter_indexes[i]); + } + table->eft_unicst_filter_count =0 ; + +for (i =0 ; i < table->eft_mulcst_filter_count; i++) { +ef10_filter_delete_auto (enp, + table->eft_mulcst_filter_indexes[i]); + } + table->eft_mulcst_filter_count =0 ; + +for (i =0 ; i < table->eft_encap_filter_count; i++) { +ef10_filter_delete_auto (enp, + table->eft_encap_filter_indexes[i]); + } + table->eft_encap_filter_count =0 ; +}/* * Reconfigure all filters.
@@ -1789,24 +1814,7 @@ ef10_filter_reconfigure(* filters must be removed (ignore errors in case the MC * has rebooted, which removes hardware filters). */ -for (i =0 ; i < table->eft_unicst_filter_count; i++) { -ef10_filter_delete_auto (enp, - table->eft_unicst_filter_indexes[i]); - } - table->eft_unicst_filter_count =0 ; - -for (i =0 ; i < table->eft_mulcst_filter_count; i++) { -ef10_filter_delete_auto (enp, - table->eft_mulcst_filter_indexes[i]); - } - table->eft_mulcst_filter_count =0 ; - -for (i =0 ; i < table->eft_encap_filter_count; i++) { -ef10_filter_delete_auto (enp, - table->eft_encap_filter_indexes[i]); - } - table->eft_encap_filter_count =0 ; - +ef10_filter_remove_all_existing_filters (enp);return (0 ); }
Signature · 1 line
2.17.1
PATCH 2/6 net/sfc/base: refactor filters mark in reconfigure
In reply to Andrew RybchenkoFrom: Igor Romanov <[email protected]>
Refactor the filters mark stage of the reconfigure function to make it clearer and allow for more convenient further changes.
--- drivers/net/sfc/base/ef10_filter.c | 34 +++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-)
drivers/net/sfc/base/ef10_filter.c +22 -12
@@ -1782,6 +1782,27 @@ ef10_filter_remove_all_existing_filters( table->eft_encap_filter_count =0 ; } +static void +ef10_filter_mark_old_filters ( + __in efx_nic_t *enp) +{ +ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; +unsigned int i; + +for (i =0 ; i < table->eft_unicst_filter_count; i++) { +ef10_filter_set_entry_auto_old (table, + table->eft_unicst_filter_indexes[i]); + } +for (i =0 ; i < table->eft_mulcst_filter_count; i++) { +ef10_filter_set_entry_auto_old (table, + table->eft_mulcst_filter_indexes[i]); + } +for (i =0 ; i < table->eft_encap_filter_count; i++) { +ef10_filter_set_entry_auto_old (table, + table->eft_encap_filter_indexes[i]); + } +} +/* * Reconfigure all filters. * If all_unicst and/or all mulcst filters cannot be applied then
@@ -1824,18 +1845,7 @@ ef10_filter_reconfigure( filter_flags =0 ;/* Mark old filters which may need to be removed */ -for (i =0 ; i < table->eft_unicst_filter_count; i++) { -ef10_filter_set_entry_auto_old (table, - table->eft_unicst_filter_indexes[i]); - } -for (i =0 ; i < table->eft_mulcst_filter_count; i++) { -ef10_filter_set_entry_auto_old (table, - table->eft_mulcst_filter_indexes[i]); - } -for (i =0 ; i < table->eft_encap_filter_count; i++) { -ef10_filter_set_entry_auto_old (table, - table->eft_encap_filter_indexes[i]); - } +ef10_filter_mark_old_filters (enp);/* * Insert or renew unicast filters.
Signature · 1 line
2.17.1
PATCH 3/6 net/sfc/base: refactor unicast filters reconfiguration
In reply to Andrew RybchenkoFrom: Igor Romanov <[email protected]>
Refactor the unicast filter reconfiguration stage of the reconfigure function to make it clearer and allow for more convenient further changes.
--- drivers/net/sfc/base/ef10_filter.c | 83 ++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 27 deletions(-)
drivers/net/sfc/base/ef10_filter.c +56 -27
@@ -1803,6 +1803,54 @@ ef10_filter_mark_old_filters( } } +static __checkReturn efx_rc_t +ef10_filter_insert_renew_unicst_filters ( + __in efx_nic_t *enp, + __in_ecount(6) uint8_t const *mac_addr, + __in boolean_t all_unicst, + __in efx_filter_flags_t filter_flags, + __out boolean_t *all_unicst_inserted) +{ +ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; +efx_rc_t rc; + +/* +* Firmware does not perform chaining on unicast filters. As traffic is +* therefore only delivered to the first matching filter, we should +* always insert the specific filter for our MAC address, to try and +* ensure we get that traffic. +* +* (If the filter for our MAC address has already been inserted by +* another function, we won't receive traffic sent to us, even if we +* insert a unicast mismatch filter. To prevent traffic stealing, this +* therefore relies on the privilege model only allowing functions to +* insert filters for their own MAC address unless explicitly given +* additional privileges by the user. This also means that, even on a +* priviliged function, inserting a unicast mismatch filter may not +* catch all traffic in multi PCI function scenarios.) +*/ + table->eft_unicst_filter_count =0 ; + rc =ef10_filter_insert_unicast (enp, mac_addr, filter_flags); + *all_unicst_inserted =B_FALSE ; +if (all_unicst || (rc !=0 )) { +efx_rc_t all_unicst_rc; + + all_unicst_rc =ef10_filter_insert_all_unicast (enp, + filter_flags); +if (all_unicst_rc ==0 ) { + *all_unicst_inserted =B_TRUE ; + }else if (rc !=0 ) + goto fail1; + } + +return (0 ); + +fail1: +EFSYS_PROBE1 (fail1, efx_rc_t, rc); + +return (rc); +} +/* * Reconfigure all filters. * If all_unicst and/or all mulcst filters cannot be applied then
@@ -1824,7 +1872,7 @@ ef10_filter_reconfigure(ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;efx_filter_flags_t filter_flags;unsigned int i; -efx_rc_t all_unicst_rc =0 ; +boolean_t all_unicst_inserted =B_FALSE ;efx_rc_t all_mulcst_rc =0 ;efx_rc_t rc;
@@ -1847,31 +1895,12 @@ ef10_filter_reconfigure(/* Mark old filters which may need to be removed */ ef10_filter_mark_old_filters (enp); -/* -* Insert or renew unicast filters. -* -* Firmware does not perform chaining on unicast filters. As traffic is -* therefore only delivered to the first matching filter, we should -* always insert the specific filter for our MAC address, to try and -* ensure we get that traffic. -* -* (If the filter for our MAC address has already been inserted by -* another function, we won't receive traffic sent to us, even if we -* insert a unicast mismatch filter. To prevent traffic stealing, this -* therefore relies on the privilege model only allowing functions to -* insert filters for their own MAC address unless explicitly given -* additional privileges by the user. This also means that, even on a -* priviliged function, inserting a unicast mismatch filter may not -* catch all traffic in multi PCI function scenarios.) -*/ - table->eft_unicst_filter_count =0 ; - rc =ef10_filter_insert_unicast (enp, mac_addr, filter_flags); -if (all_unicst || (rc !=0 )) { - all_unicst_rc =ef10_filter_insert_all_unicast (enp, - filter_flags); -if ((rc !=0 ) && (all_unicst_rc !=0 )) - goto fail1; - } +/* Insert or renew unicast filters */ + rc =ef10_filter_insert_renew_unicst_filters (enp, mac_addr, all_unicst, + filter_flags, + &all_unicst_inserted); +if (rc !=0 ) + goto fail1;/* * WORKAROUND_BUG26807 controls firmware support for chained multicast
@@ -1974,7 +2003,7 @@ ef10_filter_reconfigure(ef10_filter_remove_old (enp);/* report if any optional flags were rejected */ -if (((all_unicst !=B_FALSE ) && (all_unicst_rc !=0 )) || +if (((all_unicst !=B_FALSE ) && (all_unicst_inserted ==B_FALSE )) || ((all_mulcst !=B_FALSE ) && (all_mulcst_rc !=0 ))) { rc =ENOTSUP ; }
Signature · 1 line
2.17.1
PATCH 4/6 net/sfc/base: refactor mcast filters reconfiguration
In reply to Andrew RybchenkoFrom: Igor Romanov <[email protected]>
Refactor the multicast filter reconfiguration stage of the reconfigure function to make it clearer and allow for more convenient further changes.
--- drivers/net/sfc/base/ef10_filter.c | 143 +++++++++++++++++++---------- 1 file changed, 92 insertions(+), 51 deletions(-)
drivers/net/sfc/base/ef10_filter.c +92 -51
@@ -1851,6 +1851,89 @@ ef10_filter_insert_renew_unicst_filters(return (rc); } +static __checkReturn efx_rc_t +ef10_filter_insert_renew_mulcst_filters( + __in efx_nic_t *enp, + __in boolean_t mulcst, + __in boolean_t all_mulcst, + __in boolean_t brdcst, + __in_ecount(6*count) uint8_t const *addrs, + __in uint32_t count, + __in efx_filter_flags_t filter_flags, + __in boolean_t all_unicst_inserted, + __out boolean_t *all_mulcst_inserted) +{ + ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; +efx_nic_cfg_t *encp = &enp->en_nic_cfg; +efx_rc_t rc; + + *all_mulcst_inserted =B_FALSE ; + +if (all_mulcst ==B_TRUE ) { +efx_rc_t all_mulcst_rc; + +/* +* Insert the all multicast filter. If that fails, try to insert +* all of our multicast filters (but without rollback on +* failure). +*/ + all_mulcst_rc =ef10_filter_insert_all_multicast (enp, + filter_flags); +if (all_mulcst_rc ==0 ) { + *all_mulcst_inserted =B_TRUE ; + }else { + rc =ef10_filter_insert_multicast_list (enp,B_TRUE , + brdcst, addrs, count, filter_flags,B_FALSE ); +if (rc !=0 ) + goto fail1; + } + }else { +/* +* Insert filters for multicast addresses. +* If any insertion fails, then rollback and try to insert the +* all multicast filter instead. +* If that also fails, try to insert all of the multicast +* filters (but without rollback on failure). +*/ + rc =ef10_filter_insert_multicast_list (enp, mulcst, brdcst, + addrs, count, filter_flags,B_TRUE ); +if (rc !=0 ) { +if ((table->eft_using_all_mulcst ==B_FALSE ) && + (encp->enc_bug26807_workaround ==B_TRUE )) { +/* +* Multicast filter chaining is on, so remove +* old filters before inserting the multicast +* all filter to avoid duplicate delivery caused +* by packets matching multiple filters. +*/ +ef10_filter_remove_old (enp); + } + + rc =ef10_filter_insert_all_multicast (enp, + filter_flags); +if (rc ==0 ) { + *all_mulcst_inserted =B_TRUE ; + }else { + rc =ef10_filter_insert_multicast_list (enp, + mulcst, brdcst, + addrs, count, filter_flags,B_FALSE ); +if (rc !=0 ) + goto fail2; + } + } + } + +return (0 ); + +fail2: +EFSYS_PROBE1 (fail2, efx_rc_t, rc); + +fail1: +EFSYS_PROBE1 (fail1, efx_rc_t, rc); + +return (rc); +} +/* * Reconfigure all filters. * If all_unicst and/or all mulcst filters cannot be applied then
@@ -1873,7 +1956,7 @@ ef10_filter_reconfigure(efx_filter_flags_t filter_flags;unsigned int i;boolean_t all_unicst_inserted =B_FALSE ; -efx_rc_t all_mulcst_rc =0 ; +boolean_t all_mulcst_inserted =B_FALSE ;efx_rc_t rc;if (table->eft_default_rxq ==NULL ) {
@@ -1944,53 +2027,13 @@ ef10_filter_reconfigure( }/* Insert or renew multicast filters */ -if (all_mulcst ==B_TRUE ) { -/* -* Insert the all multicast filter. If that fails, try to insert -* all of our multicast filters (but without rollback on -* failure). -*/ - all_mulcst_rc =ef10_filter_insert_all_multicast (enp, - filter_flags); -if (all_mulcst_rc !=0 ) { - rc =ef10_filter_insert_multicast_list (enp,B_TRUE , - brdcst, addrs, count, filter_flags,B_FALSE ); -if (rc !=0 ) - goto fail3; - } - }else { -/* -* Insert filters for multicast addresses. -* If any insertion fails, then rollback and try to insert the -* all multicast filter instead. -* If that also fails, try to insert all of the multicast -* filters (but without rollback on failure). -*/ - rc =ef10_filter_insert_multicast_list (enp, mulcst, brdcst, - addrs, count, filter_flags,B_TRUE ); -if (rc !=0 ) { -if ((table->eft_using_all_mulcst ==B_FALSE ) && - (encp->enc_bug26807_workaround ==B_TRUE )) { -/* -* Multicast filter chaining is on, so remove -* old filters before inserting the multicast -* all filter to avoid duplicate delivery caused -* by packets matching multiple filters. -*/ -ef10_filter_remove_old (enp); - } - - rc =ef10_filter_insert_all_multicast (enp, - filter_flags); -if (rc !=0 ) { - rc =ef10_filter_insert_multicast_list (enp, - mulcst, brdcst, - addrs, count, filter_flags,B_FALSE ); -if (rc !=0 ) - goto fail4; - } - } - } + rc =ef10_filter_insert_renew_mulcst_filters (enp, mulcst, all_mulcst, + brdcst, addrs, count, + filter_flags, + all_unicst_inserted, + &all_mulcst_inserted); +if (rc !=0 ) + goto fail3;if (encp->enc_tunnel_encapsulations_supported !=0 ) {/* Try to insert filters for encapsulated packets. */
@@ -2004,14 +2047,12 @@ ef10_filter_reconfigure(/* report if any optional flags were rejected */ if (((all_unicst !=B_FALSE ) && (all_unicst_inserted ==B_FALSE )) || - ((all_mulcst !=B_FALSE ) && (all_mulcst_rc !=0 ))) { + ((all_mulcst !=B_FALSE ) && (all_mulcst_inserted ==B_FALSE ))) { rc =ENOTSUP ; }return (rc); -fail4: -EFSYS_PROBE (fail4); fail3:EFSYS_PROBE (fail3); fail2:
Signature · 1 line
2.17.1
PATCH 5/6 net/sfc/base: add API to get currently operating filters
In reply to Andrew RybchenkoFrom: Igor Romanov <[email protected]>
Unknown unicast filter creation may fail because of insufficient permissions on VF. This failure is handled internally in libefx MAC reconfiguration without any way for a user to know if it happened. Making the MAC reconfiguration forward error code of filter reconfiguration would be too destructive to the existing code that may rely on the function never returning that error.
Add an API for getting the status of current unknown unicast and all multicast filters since user must know that requested filters are actually applied.
--- drivers/net/sfc/base/ef10_filter.c | 22 ++++++++++++++++++++++ drivers/net/sfc/base/efx.h | 6 ++++++ drivers/net/sfc/base/efx_impl.h | 2 ++ drivers/net/sfc/base/efx_mac.c | 15 +++++++++++++++ drivers/net/sfc/base/siena_mac.c | 2 ++ 5 files changed, 47 insertions(+)
drivers/net/sfc/base/ef10_filter.c +22 -0
@@ -1761,6 +1761,7 @@ ef10_filter_remove_all_existing_filters( __in efx_nic_t *enp) {ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; +efx_port_t *epp = &(enp->en_port);unsigned int i;for (i =0 ; i < table->eft_unicst_filter_count; i++) {
@@ -1780,6 +1781,9 @@ ef10_filter_remove_all_existing_filters( table->eft_encap_filter_indexes[i]); } table->eft_encap_filter_count =0 ; + + epp->ep_all_unicst_inserted =B_FALSE ; + epp->ep_all_mulcst_inserted =B_FALSE ; } static void
@@ -1812,6 +1816,7 @@ ef10_filter_insert_renew_unicst_filters( __out boolean_t *all_unicst_inserted) {ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; +efx_port_t *epp = &(enp->en_port);efx_rc_t rc;/*
@@ -1839,6 +1844,7 @@ ef10_filter_insert_renew_unicst_filters( filter_flags);if (all_unicst_rc ==0 ) { *all_unicst_inserted =B_TRUE ; + epp->ep_all_unicst_inserted =B_TRUE ; }else if (rc !=0 ) goto fail1; }
@@ -1865,6 +1871,7 @@ ef10_filter_insert_renew_mulcst_filters( {ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;efx_nic_cfg_t *encp = &enp->en_nic_cfg; +efx_port_t *epp = &(enp->en_port);efx_rc_t rc; *all_mulcst_inserted =B_FALSE ;
@@ -1880,6 +1887,7 @@ ef10_filter_insert_renew_mulcst_filters( all_mulcst_rc =ef10_filter_insert_all_multicast (enp, filter_flags);if (all_mulcst_rc ==0 ) { + epp->ep_all_mulcst_inserted =B_TRUE ; *all_mulcst_inserted =B_TRUE ; }else { rc = ef10_filter_insert_multicast_list(enp, B_TRUE,
@@ -1907,11 +1915,16 @@ ef10_filter_insert_renew_mulcst_filters(* by packets matching multiple filters. */ ef10_filter_remove_old (enp); +if (all_unicst_inserted ==B_FALSE ) + epp->ep_all_unicst_inserted =B_FALSE ; +if (*all_mulcst_inserted ==B_FALSE ) + epp->ep_all_mulcst_inserted =B_FALSE ; } rc =ef10_filter_insert_all_multicast (enp, filter_flags);if (rc ==0 ) { + epp->ep_all_mulcst_inserted =B_TRUE ; *all_mulcst_inserted =B_TRUE ; }else { rc = ef10_filter_insert_multicast_list(enp,
@@ -1952,6 +1965,7 @@ ef10_filter_reconfigure( __in uint32_t count) {efx_nic_cfg_t *encp = &enp->en_nic_cfg; +efx_port_t *epp = &(enp->en_port);ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;efx_filter_flags_t filter_flags;unsigned int i;
@@ -2024,6 +2038,10 @@ ef10_filter_reconfigure(* multicast filters. */ ef10_filter_remove_old (enp); +if (all_unicst_inserted ==B_FALSE ) + epp->ep_all_unicst_inserted =B_FALSE ; + + epp->ep_all_mulcst_inserted =B_FALSE ; }/* Insert or renew multicast filters */
@@ -2044,6 +2062,10 @@ ef10_filter_reconfigure(/* Remove old filters which were not renewed */ ef10_filter_remove_old (enp); +if (all_unicst_inserted ==B_FALSE ) + epp->ep_all_unicst_inserted =B_FALSE ; +if (all_mulcst_inserted ==B_FALSE ) + epp->ep_all_mulcst_inserted =B_FALSE ;/* report if any optional flags were rejected */ if (((all_unicst != B_FALSE) && (all_unicst_inserted == B_FALSE)) ||
drivers/net/sfc/base/efx.h +6 -0
@@ -544,6 +544,12 @@ efx_mac_filter_set( __in boolean_t all_mulcst, __in boolean_t brdcst); +extern void +efx_mac_filter_get_all_ucast_mcast ( + __in efx_nic_t *enp, + __out boolean_t *all_unicst, + __out boolean_t *all_mulcst); + extern __checkReturn efx_rc_t efx_mac_multicast_list_set( __in efx_nic_t *enp,
drivers/net/sfc/base/efx_impl.h +2 -0
@@ -307,8 +307,10 @@ typedef struct efx_port_s {uint8_t ep_mac_addr[6 ];efx_link_mode_t ep_link_mode;boolean_t ep_all_unicst; +boolean_t ep_all_unicst_inserted;boolean_t ep_mulcst;boolean_t ep_all_mulcst; +boolean_t ep_all_mulcst_inserted;boolean_t ep_brdcst;unsigned int ep_fcntl;boolean_t ep_fcntl_autoneg;
drivers/net/sfc/base/efx_mac.c +15 -0
@@ -218,6 +218,21 @@ efx_mac_filter_set(return (rc); } +void +efx_mac_filter_get_all_ucast_mcast ( + __in efx_nic_t *enp, + __out boolean_t *all_unicst, + __out boolean_t *all_mulcst) +{ +efx_port_t *epp = &(enp->en_port); + + EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); + EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT); + + *all_unicst = epp->ep_all_unicst_inserted; + *all_mulcst = epp->ep_all_mulcst_inserted; +} + __checkReturn efx_rc_t efx_mac_drain( __in efx_nic_t *enp,
drivers/net/sfc/base/siena_mac.c +2 -0
@@ -107,6 +107,7 @@ siena_mac_reconfigure( rc = req.emr_rc; goto fail1; } + epp->ep_all_unicst_inserted = epp->ep_all_unicst;/* Push multicast hash */
@@ -158,6 +159,7 @@ siena_mac_reconfigure( rc = req.emr_rc; goto fail2; } + epp->ep_all_mulcst_inserted = epp->ep_all_mulcst;return (0 );
Signature · 1 line
2.17.1
PATCH 6/6 net/sfc: check actual all multicast unknown unicast filters
In reply to Andrew RybchenkoFrom: Igor Romanov <[email protected]>
Check that unknown unicast and unknown multicast filters are applied and return an error if they are not applied. The error is used in promiscuous and all multicast mode enable and disable callbacks.
--- drivers/net/sfc/sfc.h | 1 + drivers/net/sfc/sfc_ethdev.c | 16 +++++++--- drivers/net/sfc/sfc_port.c | 62 +++++++++++++++++++++++++++++++++--- drivers/net/sfc/sfc_rx.c | 4 +-- 4 files changed, 73 insertions(+), 10 deletions(-)
drivers/net/sfc/sfc.h +1 -0
@@ -407,6 +407,7 @@ void sfc_port_link_mode_to_info(efx_link_mode_t link_mode,int sfc_port_update_mac_stats (struct sfc_adapter *sa);int sfc_port_reset_mac_stats (struct sfc_adapter *sa);int sfc_set_rx_mode (struct sfc_adapter *sa); +int sfc_set_rx_mode_unchecked (struct sfc_adapter *sa);#ifdef __cplusplus
drivers/net/sfc/sfc_ethdev.c +12 -4
@@ -393,8 +393,16 @@ sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode, }else if ((sa->state ==SFC_ADAPTER_STARTED ) && ((rc =sfc_set_rx_mode (sa)) !=0 )) { *toggle = !(enabled); -sfc_warn (sa,"Failed to %s %s mode" , - ((enabled) ?"enable" :"disable" ), desc); +sfc_warn (sa,"Failed to %s %s mode, rc = %d" , + ((enabled) ?"enable" :"disable" ), desc, rc); + +/* +* For promiscuous and all-multicast filters a +* permission failure should be reported as an +* unsupported filter. +*/ +if (rc ==EPERM ) + rc =ENOTSUP ; } }
@@ -1060,12 +1068,12 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr)* has no effect on received traffic, therefore * we also need to update unicast filters */ - rc =sfc_set_rx_mode (sa); + rc =sfc_set_rx_mode_unchecked (sa);if (rc !=0 ) {sfc_err (sa,"cannot set filter (rc = %u)" , rc);/* Rollback the old address */ (void )efx_mac_addr_set (sa->nic, old_addr->addr_bytes); - (void )sfc_set_rx_mode (sa); + (void )sfc_set_rx_mode_unchecked (sa); } }else {sfc_warn (sa,"cannot set MAC address with filters installed" );
drivers/net/sfc/sfc_port.c +58 -4
81 lines not on this page · raw message
drivers/net/sfc/sfc_rx.c +2 -2
@@ -720,7 +720,7 @@ sfc_rx_default_rxq_set_filter(struct sfc_adapter *sa, struct sfc_rxq *rxq) port->promisc =B_FALSE ; sa->eth_dev->data->promiscuous =0 ; - rc =sfc_set_rx_mode (sa); + rc =sfc_set_rx_mode_unchecked (sa);if (rc !=0 )return rc;
@@ -734,7 +734,7 @@ sfc_rx_default_rxq_set_filter(struct sfc_adapter *sa, struct sfc_rxq *rxq) port->allmulti =B_FALSE ; sa->eth_dev->data->all_multicast =0 ; - rc =sfc_set_rx_mode (sa); + rc =sfc_set_rx_mode_unchecked (sa);if (rc !=0 )return rc;
Signature · 1 line
2.17.1
Quoted 10 lines · Andrew Rybchenko
VFs (as well as unpriviledged PFs) are not always allowed to enable promiscuous and all-multicast. Handle it properly and ensure consistency for settings applied and reported.
Base driver patches have warnings/errors from
checkpatch.shsince coding style differs a bit.Return of non-negative errno is OK as well, since driver does positive to negative errno conversion on return from callbacks.
Quoted 8 lines
Igor Romanov (6):
net/sfc/base: refactor filters cleanup in reconfigurenet/sfc/base: refactor filters mark in reconfigurenet/sfc/base: refactor unicast filters reconfigurationnet/sfc/base: refactor mcast filters reconfigurationnet/sfc/base: add API to get currently operating filters net/sfc: check actual all multicast unknown unicast filters
Series applied to dpdk-next-net/master, thanks.