aboutsummaryrefslogtreecommitdiff
path: root/fs/affs
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2023-10-04 15:12:40 +0200
committerBorislav Petkov (AMD) <bp@alien8.de>2023-11-20 22:01:16 +0100
commitd27cb32e00eff60d8fa94de265a8d84c63ef059c (patch)
treedf50217445032d1bf6af4c88744647a3cf9aee42 /fs/affs
parent0576ded05b33dd460082b29d900e2f17a56c5a6b (diff)
EDAC/dmc520: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20231004131254.2673842-8-u.kleine-koenig@pengutronix.de
Diffstat (limited to 'fs/affs')
0 files changed, 0 insertions, 0 deletions
om_get_link_params(ena_dev, &feat_resp); if (rc) return rc; link = &feat_resp.u.link; link_ksettings->base.speed = link->speed; if (link->flags & ENA_ADMIN_GET_FEATURE_LINK_DESC_AUTONEG_MASK) { ethtool_link_ksettings_add_link_mode(link_ksettings, supported, Autoneg); ethtool_link_ksettings_add_link_mode(link_ksettings, supported, Autoneg); } link_ksettings->base.autoneg = (link->flags & ENA_ADMIN_GET_FEATURE_LINK_DESC_AUTONEG_MASK) ? AUTONEG_ENABLE : AUTONEG_DISABLE; link_ksettings->base.duplex = DUPLEX_FULL; return 0; } static int ena_get_coalesce(struct net_device *net_dev, struct ethtool_coalesce *coalesce) { struct ena_adapter *adapter = netdev_priv(net_dev); struct ena_com_dev *ena_dev = adapter->ena_dev; if (!ena_com_interrupt_moderation_supported(ena_dev)) { /* the devie doesn't support interrupt moderation */ return -EOPNOTSUPP; } coalesce->tx_coalesce_usecs = ena_com_get_nonadaptive_moderation_interval_tx(ena_dev) * ena_dev->intr_delay_resolution; coalesce->rx_coalesce_usecs = ena_com_get_nonadaptive_moderation_interval_rx(ena_dev) * ena_dev->intr_delay_resolution; coalesce->use_adaptive_rx_coalesce = ena_com_get_adaptive_moderation_enabled(ena_dev); return 0; } static void ena_update_tx_rings_intr_moderation(struct ena_adapter *adapter) { unsigned int val; int i; val = ena_com_get_nonadaptive_moderation_interval_tx(adapter->ena_dev); for (i = 0; i < adapter->num_io_queues; i++) adapter->tx_ring[i].smoothed_interval = val; } static void ena_update_rx_rings_intr_moderation(struct ena_adapter *adapter) { unsigned int val; int i; val = ena_com_get_nonadaptive_moderation_interval_rx(adapter->ena_dev); for (i = 0; i < adapter->num_io_queues; i++) adapter->rx_ring[i].smoothed_interval = val; } static int ena_set_coalesce(struct net_device *net_dev, struct ethtool_coalesce *coalesce) { struct ena_adapter *adapter = netdev_priv(net_dev); struct ena_com_dev *ena_dev = adapter->ena_dev; int rc; if (!ena_com_interrupt_moderation_supported(ena_dev)) { /* the devie doesn't support interrupt moderation */ return -EOPNOTSUPP; } rc = ena_com_update_nonadaptive_moderation_interval_tx(ena_dev, coalesce->tx_coalesce_usecs); if (rc) return rc; ena_update_tx_rings_intr_moderation(adapter); rc = ena_com_update_nonadaptive_moderation_interval_rx(ena_dev, coalesce->rx_coalesce_usecs); if (rc) return rc; ena_update_rx_rings_intr_moderation(adapter); if (coalesce->use_adaptive_rx_coalesce && !ena_com_get_adaptive_moderation_enabled(ena_dev)) ena_com_enable_adaptive_moderation(ena_dev); if (!coalesce->use_adaptive_rx_coalesce && ena_com_get_adaptive_moderation_enabled(ena_dev)) ena_com_disable_adaptive_moderation(ena_dev); return 0; } static u32 ena_get_msglevel(struct net_device *netdev) { struct ena_adapter *adapter = netdev_priv(netdev); return adapter->msg_enable; } static void ena_set_msglevel(struct net_device *netdev, u32 value) { struct ena_adapter *adapter = netdev_priv(netdev); adapter->msg_enable = value; } static void ena_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { struct ena_adapter *adapter = netdev_priv(dev); strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver)); strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version)); strlcpy(info->bus_info, pci_name(adapter->pdev), sizeof(info->bus_info)); } static void ena_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) { struct ena_adapter *adapter = netdev_priv(netdev); ring->tx_max_pending = adapter->max_tx_ring_size; ring->rx_max_pending = adapter->max_rx_ring_size; ring->tx_pending = adapter->tx_ring[0].ring_size; ring->rx_pending = adapter->rx_ring[0].ring_size; } static int ena_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) { struct ena_adapter *adapter = netdev_priv(netdev); u32 new_tx_size, new_rx_size; new_tx_size = ring->tx_pending < ENA_MIN_RING_SIZE ? ENA_MIN_RING_SIZE : ring->tx_pending; new_tx_size = rounddown_pow_of_two(new_tx_size); new_rx_size = ring->rx_pending < ENA_MIN_RING_SIZE ? ENA_MIN_RING_SIZE : ring->rx_pending; new_rx_size = rounddown_pow_of_two(new_rx_size); if (new_tx_size == adapter->requested_tx_ring_size && new_rx_size == adapter->requested_rx_ring_size) return 0; return ena_update_queue_sizes(adapter, new_tx_size, new_rx_size); } static u32 ena_flow_hash_to_flow_type(u16 hash_fields) { u32 data = 0; if (hash_fields & ENA_ADMIN_RSS_L2_DA) data |= RXH_L2DA; if (hash_fields & ENA_ADMIN_RSS_L3_DA) data |= RXH_IP_DST; if (hash_fields & ENA_ADMIN_RSS_L3_SA) data |= RXH_IP_SRC; if (hash_fields & ENA_ADMIN_RSS_L4_DP) data |= RXH_L4_B_2_3; if (hash_fields & ENA_ADMIN_RSS_L4_SP) data |= RXH_L4_B_0_1; return data; } static u16 ena_flow_data_to_flow_hash(u32 hash_fields) { u16 data = 0; if (hash_fields & RXH_L2DA) data |= ENA_ADMIN_RSS_L2_DA; if (hash_fields & RXH_IP_DST) data |= ENA_ADMIN_RSS_L3_DA; if (hash_fields & RXH_IP_SRC) data |= ENA_ADMIN_RSS_L3_SA; if (hash_fields & RXH_L4_B_2_3) data |= ENA_ADMIN_RSS_L4_DP; if (hash_fields & RXH_L4_B_0_1) data |= ENA_ADMIN_RSS_L4_SP; return data; } static int ena_get_rss_hash(struct ena_com_dev *ena_dev, struct ethtool_rxnfc *cmd) { enum ena_admin_flow_hash_proto proto; u16 hash_fields; int rc; cmd->data = 0; switch (cmd->flow_type) { case TCP_V4_FLOW: proto = ENA_ADMIN_RSS_TCP4; break; case UDP_V4_FLOW: proto = ENA_ADMIN_RSS_UDP4; break; case TCP_V6_FLOW: proto = ENA_ADMIN_RSS_TCP6; break; case UDP_V6_FLOW: proto = ENA_ADMIN_RSS_UDP6; break; case IPV4_FLOW: proto = ENA_ADMIN_RSS_IP4; break; case IPV6_FLOW: proto = ENA_ADMIN_RSS_IP6; break; case ETHER_FLOW: proto = ENA_ADMIN_RSS_NOT_IP; break; case AH_V4_FLOW: case ESP_V4_FLOW: case AH_V6_FLOW: case ESP_V6_FLOW: case SCTP_V4_FLOW: case AH_ESP_V4_FLOW: return -EOPNOTSUPP; default: return -EINVAL; } rc = ena_com_get_hash_ctrl(ena_dev, proto, &hash_fields); if (rc) return rc; cmd->data = ena_flow_hash_to_flow_type(hash_fields); return 0; } static int ena_set_rss_hash(struct ena_com_dev *ena_dev, struct ethtool_rxnfc *cmd) { enum ena_admin_flow_hash_proto proto; u16 hash_fields; switch (cmd->flow_type) { case TCP_V4_FLOW: proto = ENA_ADMIN_RSS_TCP4; break; case UDP_V4_FLOW: proto = ENA_ADMIN_RSS_UDP4; break; case TCP_V6_FLOW: proto = ENA_ADMIN_RSS_TCP6; break; case UDP_V6_FLOW: proto = ENA_ADMIN_RSS_UDP6; break; case IPV4_FLOW: proto = ENA_ADMIN_RSS_IP4; break; case IPV6_FLOW: proto = ENA_ADMIN_RSS_IP6; break; case ETHER_FLOW: proto = ENA_ADMIN_RSS_NOT_IP; break; case AH_V4_FLOW: case ESP_V4_FLOW: case AH_V6_FLOW: case ESP_V6_FLOW: case SCTP_V4_FLOW: case AH_ESP_V4_FLOW: return -EOPNOTSUPP; default: return -EINVAL; } hash_fields = ena_flow_data_to_flow_hash(cmd->data); return ena_com_fill_hash_ctrl(ena_dev, proto, hash_fields); } static int ena_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *info) { struct ena_adapter *adapter = netdev_priv(netdev); int rc = 0; switch (info->cmd) { case ETHTOOL_SRXFH: rc = ena_set_rss_hash(adapter->ena_dev, info); break; case ETHTOOL_SRXCLSRLDEL: case ETHTOOL_SRXCLSRLINS: default: netif_err(adapter, drv, netdev, "Command parameter %d is not supported\n", info->cmd); rc = -EOPNOTSUPP; } return rc; } static int ena_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *info, u32 *rules) { struct ena_adapter *adapter = netdev_priv(netdev); int rc = 0; switch (info->cmd) { case ETHTOOL_GRXRINGS: info->data = adapter->num_io_queues; rc = 0; break; case ETHTOOL_GRXFH: rc = ena_get_rss_hash(adapter->ena_dev, info); break; case ETHTOOL_GRXCLSRLCNT: case ETHTOOL_GRXCLSRULE: case ETHTOOL_GRXCLSRLALL: default: netif_err(adapter, drv, netdev, "Command parameter %d is not supported\n", info->cmd); rc = -EOPNOTSUPP; } return rc; } static u32 ena_get_rxfh_indir_size(struct net_device *netdev) { return ENA_RX_RSS_TAB