aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c')
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c82
1 files changed, 78 insertions, 4 deletions
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
index 49508ec98b72..95d44538357f 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
@@ -452,9 +452,9 @@ static int xgbe_set_coalesce(struct net_device *netdev,
452 rx_usecs); 452 rx_usecs);
453 return -EINVAL; 453 return -EINVAL;
454 } 454 }
455 if (rx_frames > pdata->channel->rx_ring->rdesc_count) { 455 if (rx_frames > pdata->rx_desc_count) {
456 netdev_alert(netdev, "rx-frames is limited to %d frames\n", 456 netdev_alert(netdev, "rx-frames is limited to %d frames\n",
457 pdata->channel->rx_ring->rdesc_count); 457 pdata->rx_desc_count);
458 return -EINVAL; 458 return -EINVAL;
459 } 459 }
460 460
@@ -462,9 +462,9 @@ static int xgbe_set_coalesce(struct net_device *netdev,
462 tx_frames = ec->tx_max_coalesced_frames; 462 tx_frames = ec->tx_max_coalesced_frames;
463 463
464 /* Check the bounds of values for Tx */ 464 /* Check the bounds of values for Tx */
465 if (tx_frames > pdata->channel->tx_ring->rdesc_count) { 465 if (tx_frames > pdata->tx_desc_count) {
466 netdev_alert(netdev, "tx-frames is limited to %d frames\n", 466 netdev_alert(netdev, "tx-frames is limited to %d frames\n",
467 pdata->channel->tx_ring->rdesc_count); 467 pdata->tx_desc_count);
468 return -EINVAL; 468 return -EINVAL;
469 } 469 }
470 470
@@ -481,6 +481,75 @@ static int xgbe_set_coalesce(struct net_device *netdev,
481 return 0; 481 return 0;
482} 482}
483 483
484static int xgbe_get_rxnfc(struct net_device *netdev,
485 struct ethtool_rxnfc *rxnfc, u32 *rule_locs)
486{
487 struct xgbe_prv_data *pdata = netdev_priv(netdev);
488
489 switch (rxnfc->cmd) {
490 case ETHTOOL_GRXRINGS:
491 rxnfc->data = pdata->rx_ring_count;
492 break;
493 default:
494 return -EOPNOTSUPP;
495 }
496
497 return 0;
498}
499
500static u32 xgbe_get_rxfh_key_size(struct net_device *netdev)
501{
502 struct xgbe_prv_data *pdata = netdev_priv(netdev);
503
504 return sizeof(pdata->rss_key);
505}
506
507static u32 xgbe_get_rxfh_indir_size(struct net_device *netdev)
508{
509 struct xgbe_prv_data *pdata = netdev_priv(netdev);
510
511 return ARRAY_SIZE(pdata->rss_table);
512}
513
514static int xgbe_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
515{
516 struct xgbe_prv_data *pdata = netdev_priv(netdev);
517 unsigned int i;
518
519 if (indir) {
520 for (i = 0; i < ARRAY_SIZE(pdata->rss_table); i++)
521 indir[i] = XGMAC_GET_BITS(pdata->rss_table[i],
522 MAC_RSSDR, DMCH);
523 }
524
525 if (key)
526 memcpy(key, pdata->rss_key, sizeof(pdata->rss_key));
527
528 return 0;
529}
530
531static int xgbe_set_rxfh(struct net_device *netdev, const u32 *indir,
532 const u8 *key)
533{
534 struct xgbe_prv_data *pdata = netdev_priv(netdev);
535 struct xgbe_hw_if *hw_if = &pdata->hw_if;
536 unsigned int ret;
537
538 if (indir) {
539 ret = hw_if->set_rss_lookup_table(pdata, indir);
540 if (ret)
541 return ret;
542 }
543
544 if (key) {
545 ret = hw_if->set_rss_hash_key(pdata, key);
546 if (ret)
547 return ret;
548 }
549
550 return 0;
551}
552
484static int xgbe_get_ts_info(struct net_device *netdev, 553static int xgbe_get_ts_info(struct net_device *netdev,
485 struct ethtool_ts_info *ts_info) 554 struct ethtool_ts_info *ts_info)
486{ 555{
@@ -526,6 +595,11 @@ static const struct ethtool_ops xgbe_ethtool_ops = {
526 .get_strings = xgbe_get_strings, 595 .get_strings = xgbe_get_strings,
527 .get_ethtool_stats = xgbe_get_ethtool_stats, 596 .get_ethtool_stats = xgbe_get_ethtool_stats,
528 .get_sset_count = xgbe_get_sset_count, 597 .get_sset_count = xgbe_get_sset_count,
598 .get_rxnfc = xgbe_get_rxnfc,
599 .get_rxfh_key_size = xgbe_get_rxfh_key_size,
600 .get_rxfh_indir_size = xgbe_get_rxfh_indir_size,
601 .get_rxfh = xgbe_get_rxfh,
602 .set_rxfh = xgbe_set_rxfh,
529 .get_ts_info = xgbe_get_ts_info, 603 .get_ts_info = xgbe_get_ts_info,
530}; 604};
531 605