* [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2024-04-03 (ice, idpf)
@ 2024-04-03 20:19 Tony Nguyen
2024-04-03 20:19 ` [PATCH net 1/3] ice: Fix freeing uninitialized pointers Tony Nguyen
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Tony Nguyen @ 2024-04-03 20:19 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, netdev; +Cc: Tony Nguyen
This series contains updates to ice and idpf drivers.
Dan Carpenter initializes some pointer declarations to NULL as needed for
resource cleanup on ice driver.
Petr Oros corrects assignment of VLAN operators to fix Rx VLAN filtering
in legacy mode for ice.
Joshua calls eth_type_trans() on unknown packets to prevent possible
kernel panic on idpf.
The following are changes since commit 0a6380cb4c6b5c1d6dad226ba3130f9090f0ccea:
net: bcmgenet: Reset RBUF on first open
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 100GbE
Dan Carpenter (1):
ice: Fix freeing uninitialized pointers
Joshua Hay (1):
idpf: fix kernel panic on unknown packet types
Petr Oros (1):
ice: fix enabling RX VLAN filtering
drivers/net/ethernet/intel/ice/ice_common.c | 10 +++++-----
drivers/net/ethernet/intel/ice/ice_ethtool.c | 2 +-
.../ethernet/intel/ice/ice_vf_vsi_vlan_ops.c | 18 ++++++++----------
drivers/net/ethernet/intel/idpf/idpf_txrx.c | 4 ++--
4 files changed, 16 insertions(+), 18 deletions(-)
--
2.41.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net 1/3] ice: Fix freeing uninitialized pointers
2024-04-03 20:19 [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2024-04-03 (ice, idpf) Tony Nguyen
@ 2024-04-03 20:19 ` Tony Nguyen
2024-04-03 20:19 ` [PATCH net 2/3] ice: fix enabling RX VLAN filtering Tony Nguyen
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Tony Nguyen @ 2024-04-03 20:19 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, netdev
Cc: Dan Carpenter, anthony.l.nguyen, Jiri Pirko, Simon Horman
From: Dan Carpenter <dan.carpenter@linaro.org>
Automatically cleaned up pointers need to be initialized before exiting
their scope. In this case, they need to be initialized to NULL before
any return statement.
Fixes: 90f821d72e11 ("ice: avoid unnecessary devm_ usage")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/ice/ice_common.c | 10 +++++-----
drivers/net/ethernet/intel/ice/ice_ethtool.c | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index db4b2844e1f7..d9f6cc71d900 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -1002,8 +1002,8 @@ static void ice_get_itr_intrl_gran(struct ice_hw *hw)
*/
int ice_init_hw(struct ice_hw *hw)
{
- struct ice_aqc_get_phy_caps_data *pcaps __free(kfree);
- void *mac_buf __free(kfree);
+ struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL;
+ void *mac_buf __free(kfree) = NULL;
u16 mac_buf_len;
int status;
@@ -3272,7 +3272,7 @@ int ice_update_link_info(struct ice_port_info *pi)
return status;
if (li->link_info & ICE_AQ_MEDIA_AVAILABLE) {
- struct ice_aqc_get_phy_caps_data *pcaps __free(kfree);
+ struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL;
pcaps = kzalloc(sizeof(*pcaps), GFP_KERNEL);
if (!pcaps)
@@ -3420,7 +3420,7 @@ ice_cfg_phy_fc(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
int
ice_set_fc(struct ice_port_info *pi, u8 *aq_failures, bool ena_auto_link_update)
{
- struct ice_aqc_get_phy_caps_data *pcaps __free(kfree);
+ struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL;
struct ice_aqc_set_phy_cfg_data cfg = { 0 };
struct ice_hw *hw;
int status;
@@ -3561,7 +3561,7 @@ int
ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
enum ice_fec_mode fec)
{
- struct ice_aqc_get_phy_caps_data *pcaps __free(kfree);
+ struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) = NULL;
struct ice_hw *hw;
int status;
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 255a9c8151b4..78b833b3e1d7 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -941,11 +941,11 @@ static u64 ice_loopback_test(struct net_device *netdev)
struct ice_netdev_priv *np = netdev_priv(netdev);
struct ice_vsi *orig_vsi = np->vsi, *test_vsi;
struct ice_pf *pf = orig_vsi->back;
+ u8 *tx_frame __free(kfree) = NULL;
u8 broadcast[ETH_ALEN], ret = 0;
int num_frames, valid_frames;
struct ice_tx_ring *tx_ring;
struct ice_rx_ring *rx_ring;
- u8 *tx_frame __free(kfree);
int i;
netdev_info(netdev, "loopback test\n");
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net 2/3] ice: fix enabling RX VLAN filtering
2024-04-03 20:19 [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2024-04-03 (ice, idpf) Tony Nguyen
2024-04-03 20:19 ` [PATCH net 1/3] ice: Fix freeing uninitialized pointers Tony Nguyen
@ 2024-04-03 20:19 ` Tony Nguyen
2024-04-03 20:19 ` [PATCH net 3/3] idpf: fix kernel panic on unknown packet types Tony Nguyen
2024-04-04 16:40 ` [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2024-04-03 (ice, idpf) patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Tony Nguyen @ 2024-04-03 20:19 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, netdev
Cc: Petr Oros, anthony.l.nguyen, horms, Michal Swiatkowski,
Rafal Romanowski
From: Petr Oros <poros@redhat.com>
ice_port_vlan_on/off() was introduced in commit 2946204b3fa8 ("ice:
implement bridge port vlan"). But ice_port_vlan_on() incorrectly assigns
ena_rx_filtering to inner_vlan_ops in DVM mode.
This causes an error when rx_filtering cannot be enabled in legacy mode.
Reproducer:
echo 1 > /sys/class/net/$PF/device/sriov_numvfs
ip link set $PF vf 0 spoofchk off trust on vlan 3
dmesg:
ice 0000:41:00.0: failed to enable Rx VLAN filtering for VF 0 VSI 9 during VF rebuild, error -95
Fixes: 2946204b3fa8 ("ice: implement bridge port vlan")
Signed-off-by: Petr Oros <poros@redhat.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
.../ethernet/intel/ice/ice_vf_vsi_vlan_ops.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c b/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c
index 80dc4bcdd3a4..b3e1bdcb80f8 100644
--- a/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c
+++ b/drivers/net/ethernet/intel/ice/ice_vf_vsi_vlan_ops.c
@@ -26,24 +26,22 @@ static void ice_port_vlan_on(struct ice_vsi *vsi)
struct ice_vsi_vlan_ops *vlan_ops;
struct ice_pf *pf = vsi->back;
- if (ice_is_dvm_ena(&pf->hw)) {
- vlan_ops = &vsi->outer_vlan_ops;
-
- /* setup outer VLAN ops */
- vlan_ops->set_port_vlan = ice_vsi_set_outer_port_vlan;
- vlan_ops->clear_port_vlan = ice_vsi_clear_outer_port_vlan;
+ /* setup inner VLAN ops */
+ vlan_ops = &vsi->inner_vlan_ops;
- /* setup inner VLAN ops */
- vlan_ops = &vsi->inner_vlan_ops;
+ if (ice_is_dvm_ena(&pf->hw)) {
vlan_ops->add_vlan = noop_vlan_arg;
vlan_ops->del_vlan = noop_vlan_arg;
vlan_ops->ena_stripping = ice_vsi_ena_inner_stripping;
vlan_ops->dis_stripping = ice_vsi_dis_inner_stripping;
vlan_ops->ena_insertion = ice_vsi_ena_inner_insertion;
vlan_ops->dis_insertion = ice_vsi_dis_inner_insertion;
- } else {
- vlan_ops = &vsi->inner_vlan_ops;
+ /* setup outer VLAN ops */
+ vlan_ops = &vsi->outer_vlan_ops;
+ vlan_ops->set_port_vlan = ice_vsi_set_outer_port_vlan;
+ vlan_ops->clear_port_vlan = ice_vsi_clear_outer_port_vlan;
+ } else {
vlan_ops->set_port_vlan = ice_vsi_set_inner_port_vlan;
vlan_ops->clear_port_vlan = ice_vsi_clear_inner_port_vlan;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net 3/3] idpf: fix kernel panic on unknown packet types
2024-04-03 20:19 [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2024-04-03 (ice, idpf) Tony Nguyen
2024-04-03 20:19 ` [PATCH net 1/3] ice: Fix freeing uninitialized pointers Tony Nguyen
2024-04-03 20:19 ` [PATCH net 2/3] ice: fix enabling RX VLAN filtering Tony Nguyen
@ 2024-04-03 20:19 ` Tony Nguyen
2024-04-04 16:40 ` [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2024-04-03 (ice, idpf) patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Tony Nguyen @ 2024-04-03 20:19 UTC (permalink / raw)
To: davem, kuba, pabeni, edumazet, netdev
Cc: Joshua Hay, anthony.l.nguyen, willemb, Balazs Nemeth,
Jesse Brandeburg, Przemek Kitszel, Salvatore Daniele,
Pavan Kumar Linga, Krishneil Singh
From: Joshua Hay <joshua.a.hay@intel.com>
In the very rare case where a packet type is unknown to the driver,
idpf_rx_process_skb_fields would return early without calling
eth_type_trans to set the skb protocol / the network layer handler.
This is especially problematic if tcpdump is running when such a
packet is received, i.e. it would cause a kernel panic.
Instead, call eth_type_trans for every single packet, even when
the packet type is unknown.
Fixes: 3a8845af66ed ("idpf: add RX splitq napi poll support")
Reported-by: Balazs Nemeth <bnemeth@redhat.com>
Signed-off-by: Joshua Hay <joshua.a.hay@intel.com>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Tested-by: Salvatore Daniele <sdaniele@redhat.com>
Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/idpf/idpf_txrx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
index 6dd7a66bb897..f5bc4a278074 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
@@ -2941,6 +2941,8 @@ static int idpf_rx_process_skb_fields(struct idpf_queue *rxq,
rx_ptype = le16_get_bits(rx_desc->ptype_err_fflags0,
VIRTCHNL2_RX_FLEX_DESC_ADV_PTYPE_M);
+ skb->protocol = eth_type_trans(skb, rxq->vport->netdev);
+
decoded = rxq->vport->rx_ptype_lkup[rx_ptype];
/* If we don't know the ptype we can't do anything else with it. Just
* pass it up the stack as-is.
@@ -2951,8 +2953,6 @@ static int idpf_rx_process_skb_fields(struct idpf_queue *rxq,
/* process RSS/hash */
idpf_rx_hash(rxq, skb, rx_desc, &decoded);
- skb->protocol = eth_type_trans(skb, rxq->vport->netdev);
-
if (le16_get_bits(rx_desc->hdrlen_flags,
VIRTCHNL2_RX_FLEX_DESC_ADV_RSC_M))
return idpf_rx_rsc(rxq, skb, rx_desc, &decoded);
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2024-04-03 (ice, idpf)
2024-04-03 20:19 [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2024-04-03 (ice, idpf) Tony Nguyen
` (2 preceding siblings ...)
2024-04-03 20:19 ` [PATCH net 3/3] idpf: fix kernel panic on unknown packet types Tony Nguyen
@ 2024-04-04 16:40 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-04 16:40 UTC (permalink / raw)
To: Tony Nguyen; +Cc: davem, kuba, pabeni, edumazet, netdev
Hello:
This series was applied to netdev/net.git (main)
by Tony Nguyen <anthony.l.nguyen@intel.com>:
On Wed, 3 Apr 2024 13:19:25 -0700 you wrote:
> This series contains updates to ice and idpf drivers.
>
> Dan Carpenter initializes some pointer declarations to NULL as needed for
> resource cleanup on ice driver.
>
> Petr Oros corrects assignment of VLAN operators to fix Rx VLAN filtering
> in legacy mode for ice.
>
> [...]
Here is the summary with links:
- [net,1/3] ice: Fix freeing uninitialized pointers
https://git.kernel.org/netdev/net/c/90ca6956d383
- [net,2/3] ice: fix enabling RX VLAN filtering
https://git.kernel.org/netdev/net/c/8edfc7a40e33
- [net,3/3] idpf: fix kernel panic on unknown packet types
https://git.kernel.org/netdev/net/c/dd19e827d63a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-04-04 16:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-03 20:19 [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2024-04-03 (ice, idpf) Tony Nguyen
2024-04-03 20:19 ` [PATCH net 1/3] ice: Fix freeing uninitialized pointers Tony Nguyen
2024-04-03 20:19 ` [PATCH net 2/3] ice: fix enabling RX VLAN filtering Tony Nguyen
2024-04-03 20:19 ` [PATCH net 3/3] idpf: fix kernel panic on unknown packet types Tony Nguyen
2024-04-04 16:40 ` [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2024-04-03 (ice, idpf) patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).