mirror of
https://github.com/AuxXxilium/synology-igc.git
synced 2024-11-23 23:11:07 +07:00
support ethtool ops
Signed-off-by: Jim Ma <majinjing3@gmail.com>
This commit is contained in:
parent
1f2cffea9a
commit
39325a3bce
2
Makefile
2
Makefile
@ -9,4 +9,4 @@ obj-m = igc.o
|
||||
|
||||
# TODO enable ethtool api
|
||||
igc-objs := igc_main.o igc_mac.o igc_i225.o igc_base.o igc_nvm.o igc_phy.o \
|
||||
igc_diag.o igc_ptp.o igc_dump.o igc_tsn.o
|
||||
igc_diag.o igc_ethtool.o igc_ptp.o igc_dump.o igc_tsn.o
|
||||
|
22
backport.h
22
backport.h
@ -178,4 +178,26 @@ pci_release_mem_regions(struct pci_dev *pdev)
|
||||
{
|
||||
return pci_release_selected_regions(pdev,
|
||||
pci_select_bars(pdev, IORESOURCE_MEM));
|
||||
}
|
||||
|
||||
static inline bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
|
||||
const unsigned long *src)
|
||||
{
|
||||
bool retval = true;
|
||||
|
||||
/* TODO: following test will soon always be true */
|
||||
if (__ETHTOOL_LINK_MODE_MASK_NBITS > 32) {
|
||||
__ETHTOOL_DECLARE_LINK_MODE_MASK(ext);
|
||||
|
||||
bitmap_zero(ext, __ETHTOOL_LINK_MODE_MASK_NBITS);
|
||||
bitmap_fill(ext, 32);
|
||||
bitmap_complement(ext, ext, __ETHTOOL_LINK_MODE_MASK_NBITS);
|
||||
if (bitmap_intersects(ext, src,
|
||||
__ETHTOOL_LINK_MODE_MASK_NBITS)) {
|
||||
/* src mask goes beyond bit 31 */
|
||||
retval = false;
|
||||
}
|
||||
}
|
||||
*legacy_u32 = src[0];
|
||||
return retval;
|
||||
}
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "igc.h"
|
||||
#include "igc_diag.h"
|
||||
#include "backport.h"
|
||||
#include "backport_overflow.h"
|
||||
|
||||
/* forward declaration */
|
||||
@ -1043,11 +1044,9 @@ static int igc_ethtool_get_rss_hash_opts(struct igc_adapter *adapter,
|
||||
switch (cmd->flow_type) {
|
||||
case TCP_V4_FLOW:
|
||||
cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
fallthrough;
|
||||
case UDP_V4_FLOW:
|
||||
if (adapter->flags & IGC_FLAG_RSS_FIELD_IPV4_UDP)
|
||||
cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
fallthrough;
|
||||
case SCTP_V4_FLOW:
|
||||
case AH_ESP_V4_FLOW:
|
||||
case AH_V4_FLOW:
|
||||
@ -1057,11 +1056,9 @@ static int igc_ethtool_get_rss_hash_opts(struct igc_adapter *adapter,
|
||||
break;
|
||||
case TCP_V6_FLOW:
|
||||
cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
fallthrough;
|
||||
case UDP_V6_FLOW:
|
||||
if (adapter->flags & IGC_FLAG_RSS_FIELD_IPV6_UDP)
|
||||
cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
fallthrough;
|
||||
case SCTP_V6_FLOW:
|
||||
case AH_ESP_V6_FLOW:
|
||||
case AH_V6_FLOW:
|
||||
@ -1924,7 +1921,6 @@ static void igc_ethtool_diag_test(struct net_device *netdev,
|
||||
}
|
||||
|
||||
static const struct ethtool_ops igc_ethtool_ops = {
|
||||
.supported_coalesce_params = ETHTOOL_COALESCE_USECS,
|
||||
.get_drvinfo = igc_ethtool_get_drvinfo,
|
||||
.get_regs_len = igc_ethtool_get_regs_len,
|
||||
.get_regs = igc_ethtool_get_regs,
|
||||
|
28
igc_main.c
28
igc_main.c
@ -632,29 +632,6 @@ static void igc_configure_tx(struct igc_adapter *adapter)
|
||||
igc_configure_tx_ring(adapter, adapter->tx_ring[i]);
|
||||
}
|
||||
|
||||
// FIXME copy from igc_ethtool.c, remove this function after enable ethtool api
|
||||
void igc_write_rss_indir_tbl(struct igc_adapter *adapter)
|
||||
{
|
||||
struct igc_hw *hw = &adapter->hw;
|
||||
u32 reg = IGC_RETA(0);
|
||||
u32 shift = 0;
|
||||
int i = 0;
|
||||
|
||||
while (i < IGC_RETA_SIZE) {
|
||||
u32 val = 0;
|
||||
int j;
|
||||
|
||||
for (j = 3; j >= 0; j--) {
|
||||
val <<= 8;
|
||||
val |= adapter->rss_indir_tbl[i + j];
|
||||
}
|
||||
|
||||
wr32(reg, val << shift);
|
||||
reg += 4;
|
||||
i += 4;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* igc_setup_mrqc - configure the multiple receive queue control registers
|
||||
* @adapter: Board private structure
|
||||
@ -3918,7 +3895,7 @@ static int igc_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
* Returns the address of the device statistics structure.
|
||||
* The statistics are updated here and also from the timer callback.
|
||||
*/
|
||||
static void igc_get_stats64(struct net_device *netdev,
|
||||
static struct rtnl_link_stats64 *igc_get_stats64(struct net_device *netdev,
|
||||
struct rtnl_link_stats64 *stats)
|
||||
{
|
||||
struct igc_adapter *adapter = netdev_priv(netdev);
|
||||
@ -3928,6 +3905,7 @@ static void igc_get_stats64(struct net_device *netdev,
|
||||
igc_update_stats(adapter);
|
||||
memcpy(stats, &adapter->stats64, sizeof(*stats));
|
||||
spin_unlock(&adapter->stats64_lock);
|
||||
return stats;
|
||||
}
|
||||
|
||||
static netdev_features_t igc_fix_features(struct net_device *netdev,
|
||||
@ -5061,7 +5039,7 @@ static int igc_probe(struct pci_dev *pdev,
|
||||
hw->hw_addr = adapter->io_addr;
|
||||
|
||||
netdev->netdev_ops = &igc_netdev_ops;
|
||||
// igc_ethtool_set_ops(netdev);
|
||||
igc_ethtool_set_ops(netdev);
|
||||
netdev->watchdog_timeo = 5 * HZ;
|
||||
|
||||
netdev->mem_start = pci_resource_start(pdev, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user