Skip to content

Commit

Permalink
net: mucse: sync rnpgbe driver updates:
Browse files Browse the repository at this point in the history
1. optimz link status time
2. fix 'ethtool -C  rx-frame N' errors
3. set vlan-filter-on[fixed]
4. fix remove vlan error in sriov mode
5. rx-pause reg define error
6. rename mbx_ops_generic to rnpgbe_mbx_ops_generic
7. fix register hwmon error
8. fix mdix show if in autoneg off 1000M

Signed-off-by: Dong Yibo <[email protected]>
  • Loading branch information
xiaolong1305 authored and opsiff committed Nov 12, 2024
1 parent e22f3bd commit 9180296
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 32 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ethernet/mucse/rnpgbe/rnpgbe.h
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,8 @@ struct hwmon_attr {
struct hwmon_buff {
struct attribute_group group;
const struct attribute_group *groups[2];
struct attribute *attrs[RNP_MAX_SENSORS * 4 + 1];
struct hwmon_attr hwmon_list[RNP_MAX_SENSORS * 4];
struct attribute *attrs[RNPGBE_MAX_SENSORS * 4 + 1];
struct hwmon_attr hwmon_list[RNPGBE_MAX_SENSORS * 4];
unsigned int n_hwmon;
};
#endif /* RNPGBE_HWMON */
Expand Down Expand Up @@ -1173,7 +1173,7 @@ int rnp500_fw_update(struct rnpgbe_hw *hw, int partition, const u8 *fw_bin,
int rnpgbe_fw_update(struct rnpgbe_hw *hw, int partition, const u8 *fw_bin,
int bytes);
#define RNPM_FW_VERSION_NEW_ETHTOOL 0x00050010

void rnpgbe_service_event_schedule(struct rnpgbe_adapter *adapter);
static inline bool rnpgbe_fw_is_old_ethtool(struct rnpgbe_hw *hw)
{
return hw->fw_version >= RNPM_FW_VERSION_NEW_ETHTOOL ? false : true;
Expand Down
53 changes: 45 additions & 8 deletions drivers/net/ethernet/mucse/rnpgbe/rnpgbe_chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -2251,7 +2251,7 @@ rnpgbe_update_hw_status_hw_ops_n500(struct rnpgbe_hw *hw,
mac_rd32(mac, GMAC_MANAGEMENT_RX_UNDERSIZE);
hw_stats->jumbo_cnt += mac_rd32(mac, RNP500_MAC_GLEN_ERR_NUM);
hw_stats->tx_pause += mac_rd32(mac, GMAC_MANAGEMENT_TX_PAUSE);
hw_stats->rx_pause += mac_rd32(mac, GMAC_MANAGEMENT_RX_UNDERSIZE);
hw_stats->rx_pause += mac_rd32(mac, GMAC_MANAGEMENT_RX_PAUSE);
}

const struct rnpgbe_stats rnp500_gstrings_net_stats[] = {
Expand Down Expand Up @@ -2386,11 +2386,7 @@ static int rnp500_get_link_ksettings(struct net_device *netdev,
else
cmd->base.eth_tp_mdix = ETH_TP_MDI_INVALID;

if (hw->fake_autoneg)
cmd->base.eth_tp_mdix = ETH_TP_MDI_INVALID;
cmd->base.eth_tp_mdix_ctrl = hw->tp_mdix_ctrl;
if (hw->fake_autoneg)
cmd->base.eth_tp_mdix_ctrl = ETH_TP_MDI_INVALID;
} else {
if (supported_link & RNP_LINK_SPEED_1GB_FULL) {
ethtool_link_ksettings_add_link_mode(cmd, supported,
Expand Down Expand Up @@ -3358,7 +3354,9 @@ static const struct ethtool_ops rnp500_ethtool_ops = {
.get_ethtool_stats = rnp500_get_ethtool_stats,
.get_coalesce = rnpgbe_get_coalesce,
.set_coalesce = rnpgbe_set_coalesce,
.supported_coalesce_params = ETHTOOL_COALESCE_USECS,
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
ETHTOOL_COALESCE_MAX_FRAMES_IRQ |
ETHTOOL_COALESCE_MAX_FRAMES,
.get_rxnfc = rnpgbe_get_rxnfc,
.set_rxnfc = rnpgbe_set_rxnfc,
.get_eee = rnpgbe_get_eee,
Expand All @@ -3383,6 +3381,42 @@ void rnpgbe_set_ethtool_hw_ops_n500(struct net_device *netdev)
netdev->ethtool_ops = &rnp500_ethtool_ops;
}

/**
* rnpgbe_get_thermal_sensor_data_hw_ops_n500 - Gathers thermal sensor data
* @hw: pointer to hardware structure
* Returns the thermal sensor data structure
**/
static s32 rnpgbe_get_thermal_sensor_data_hw_ops_n500(struct rnpgbe_hw *hw)
{
int voltage = 0;
struct rnpgbe_thermal_sensor_data *data = &hw->thermal_sensor_data;

voltage = voltage;
data->sensor[0].temp = rnpgbe_mbx_get_temp(hw, &voltage);

return 0;
}

/**
* rnpgbe_init_thermal_sensor_thresh_hw_ops_n500 - Inits thermal sensor thresholds
* @hw: pointer to hardware structure
* Inits the thermal sensor thresholds according to the NVM map
* and save off the threshold and location values into mac.thermal_sensor_data
**/
static s32 rnpgbe_init_thermal_sensor_thresh_hw_ops_n500(struct rnpgbe_hw *hw)
{
u8 i;
struct rnpgbe_thermal_sensor_data *data = &hw->thermal_sensor_data;

for (i = 0; i < RNPGBE_MAX_SENSORS; i++) {
data->sensor[i].location = i + 1;
data->sensor[i].caution_thresh = 90;
data->sensor[i].max_op_thresh = 100;
}

return 0;
}

static struct rnpgbe_hw_operations hw_ops_n500 = {
.init_hw = &rnpgbe_init_hw_ops_n500,
.reset_hw = &rnpgbe_reset_hw_ops_n500,
Expand Down Expand Up @@ -3435,6 +3469,9 @@ static struct rnpgbe_hw_operations hw_ops_n500 = {
.set_rx_skip = &rnpgbe_set_rx_skip_hw_ops_n500,
.set_outer_vlan_type = &rnpgbe_set_outer_vlan_type_hw_ops_n500,
.setup_ethtool = &rnpgbe_set_ethtool_hw_ops_n500,
.get_thermal_sensor_data = &rnpgbe_get_thermal_sensor_data_hw_ops_n500,
.init_thermal_sensor_thresh =
&rnpgbe_init_thermal_sensor_thresh_hw_ops_n500,
.phy_read_reg = &rnpgbe_phy_read_reg_hw_ops_n500,
.phy_write_reg = &rnpgbe_phy_write_reg_hw_ops_n500,
.setup_wol = &rnpgbe_setup_wol_hw_ops_n500,
Expand Down Expand Up @@ -4113,7 +4150,7 @@ struct rnpgbe_info rnpgbe_n500_info = {
.get_invariants = &rnpgbe_get_invariants_n500,
.mac_ops = &mac_ops_n500,
.eeprom_ops = NULL,
.mbx_ops = &mbx_ops_generic,
.mbx_ops = &rnpgbe_mbx_ops_generic,
};

struct rnpgbe_info rnpgbe_n210_info = {
Expand All @@ -4125,5 +4162,5 @@ struct rnpgbe_info rnpgbe_n210_info = {
.get_invariants = &rnpgbe_get_invariants_n210,
.mac_ops = &mac_ops_n500,
.eeprom_ops = NULL,
.mbx_ops = &mbx_ops_generic,
.mbx_ops = &rnpgbe_mbx_ops_generic,
};
13 changes: 3 additions & 10 deletions drivers/net/ethernet/mucse/rnpgbe/rnpgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
char rnpgbe_driver_name[] = "rnpgbe";
static const char rnpgbe_driver_string[] =
"mucse 1 Gigabit PCI Express Network Driver";
#define DRV_VERSION "0.2.3-rc3"
static u32 driver_version = 0x00020303;
#define DRV_VERSION "0.2.3-rc10"
static u32 driver_version = 0x0002030a;
#include "version.h"

const char rnpgbe_driver_version[] = DRV_VERSION;
Expand Down Expand Up @@ -118,7 +118,7 @@ static int enable_hi_dma;
static void rnpgbe_service_timer(struct timer_list *t);
static void rnpgbe_setup_eee_mode(struct rnpgbe_adapter *adapter, bool status);

static void rnpgbe_service_event_schedule(struct rnpgbe_adapter *adapter)
void rnpgbe_service_event_schedule(struct rnpgbe_adapter *adapter)
{
if (!test_bit(__RNP_DOWN, &adapter->state) &&
!test_and_set_bit(__RNP_SERVICE_SCHED, &adapter->state))
Expand Down Expand Up @@ -3134,9 +3134,6 @@ static int rnpgbe_vlan_rx_kill_vid(struct net_device *netdev,
}
/* if no other tags use this vid */
if (true_remove) {
if ((adapter->flags2 &
RNP_FLAG2_VLAN_STAGS_ENABLED) &&
(vid != adapter->stags_vid))
hw->ops.set_vlan_filter(
hw, vid, false,
veb_setup);
Expand Down Expand Up @@ -7228,10 +7225,6 @@ static int rnpgbe_add_adpater(struct pci_dev *pdev, struct rnpgbe_info *ii,

netdev->hw_features |= netdev->features;

if (hw->feature_flags & RNP_NET_FEATURE_VLAN_FILTER)
netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
if (hw->feature_flags & RNP_NET_FEATURE_STAG_FILTER)
netdev->hw_features |= NETIF_F_HW_VLAN_STAG_FILTER;
if (hw->feature_flags & RNP_NET_FEATURE_VLAN_OFFLOAD) {
if (!hw->ncsi_en) {
netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ s32 rnpgbe_init_mbx_params_pf(struct rnpgbe_hw *hw)
return 0;
}

struct rnpgbe_mbx_operations mbx_ops_generic = {
struct rnpgbe_mbx_operations rnpgbe_mbx_ops_generic = {
.init_params = rnpgbe_init_mbx_params_pf,
.read = rnpgbe_read_mbx_pf,
.write = rnpgbe_write_mbx_pf,
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ s32 rnpgbe_check_for_msg(struct rnpgbe_hw *hw, enum MBX_ID);
s32 rnpgbe_check_for_ack(struct rnpgbe_hw *hw, enum MBX_ID);
s32 rnpgbe_check_for_rst(struct rnpgbe_hw *hw, enum MBX_ID);
s32 rnpgbe_init_mbx_params_pf(struct rnpgbe_hw *hw);
extern struct rnpgbe_mbx_operations mbx_ops_generic;
extern struct rnpgbe_mbx_operations rnpgbe_mbx_ops_generic;
int rnpgbe_fw_get_macaddr(struct rnpgbe_hw *hw, int pfvfnum, u8 *mac_addr,
int lane);
int rnpgbe_mbx_fw_reset_phy(struct rnpgbe_hw *hw);
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,7 @@ static inline int rnpgbe_mbx_fw_req_handler(struct rnpgbe_adapter *adapter,
adapter->flags |= RNP_FLAG_NEED_LINK_UPDATE;
break;
}
rnpgbe_service_event_schedule(adapter);

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ethernet/mucse/rnpgbe/rnpgbe_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static ssize_t rnpgbe_hwmon_show_location(struct device __always_unused *dev,
static ssize_t rnpgbe_hwmon_show_name(struct device __always_unused *dev,
struct device_attribute *attr, char *buf)
{
return snprintf(buf, PAGE_SIZE, "rnp\n");
return snprintf(buf, PAGE_SIZE, "rnpgbe\n");
}

static ssize_t rnpgbe_hwmon_show_temp(struct device __always_unused *dev,
Expand Down Expand Up @@ -1202,7 +1202,7 @@ int rnpgbe_sysfs_init(struct rnpgbe_adapter *adapter)

adapter->rnpgbe_hwmon_buff = rnpgbe_hwmon;

for (i = 0; i < RNP_MAX_SENSORS; i++) {
for (i = 0; i < RNPGBE_MAX_SENSORS; i++) {
/*
* Only create hwmon sysfs entries for sensors that have
* meaningful data for.
Expand Down Expand Up @@ -1230,7 +1230,7 @@ int rnpgbe_sysfs_init(struct rnpgbe_adapter *adapter)
rnpgbe_hwmon->group.attrs = rnpgbe_hwmon->attrs;

hwmon_dev = devm_hwmon_device_register_with_groups(
&adapter->pdev->dev, "rnp", rnpgbe_hwmon, rnpgbe_hwmon->groups);
&adapter->pdev->dev, "rnpgbe", rnpgbe_hwmon, rnpgbe_hwmon->groups);

if (IS_ERR(hwmon_dev)) {
rc = PTR_ERR(hwmon_dev);
Expand Down
12 changes: 6 additions & 6 deletions drivers/net/ethernet/mucse/rnpgbe/rnpgbe_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ static inline struct device *pci_dev_to_dev(struct pci_dev *pdev)
#define ADVERTISE_2500_HALF 0x0040 /* NOT used, just FYI */
#define ADVERTISE_2500_FULL 0x0080

#define RNP_MAX_SENSORS 1
#define RNPGBE_MAX_SENSORS 1
struct rnpgbe_thermal_diode_data {
u8 location;
u8 temp;
u8 caution_thresh;
u8 max_op_thresh;
unsigned int location;
unsigned int temp;
unsigned int caution_thresh;
unsigned int max_op_thresh;
};

struct rnpgbe_thermal_sensor_data {
struct rnpgbe_thermal_diode_data sensor[RNP_MAX_SENSORS];
struct rnpgbe_thermal_diode_data sensor[RNPGBE_MAX_SENSORS];
};

/* Proxy Status */
Expand Down

0 comments on commit 9180296

Please sign in to comment.