aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c')
-rw-r--r--drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c64
1 files changed, 23 insertions, 41 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
index 285c893ab135..a1cb461ac45f 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
@@ -159,11 +159,6 @@ struct hnae_handle *hns_ae_get_handle(struct hnae_ae_dev *dev,
159 ae_handle->qs[i]->tx_ring.q = ae_handle->qs[i]; 159 ae_handle->qs[i]->tx_ring.q = ae_handle->qs[i];
160 160
161 ring_pair_cb->used_by_vf = 1; 161 ring_pair_cb->used_by_vf = 1;
162 if (port_idx < DSAF_SERVICE_PORT_NUM_PER_DSAF)
163 ring_pair_cb->port_id_in_dsa = port_idx;
164 else
165 ring_pair_cb->port_id_in_dsa = 0;
166
167 ring_pair_cb++; 162 ring_pair_cb++;
168 } 163 }
169 164
@@ -453,59 +448,46 @@ static int hns_ae_set_pauseparam(struct hnae_handle *handle,
453static void hns_ae_get_coalesce_usecs(struct hnae_handle *handle, 448static void hns_ae_get_coalesce_usecs(struct hnae_handle *handle,
454 u32 *tx_usecs, u32 *rx_usecs) 449 u32 *tx_usecs, u32 *rx_usecs)
455{ 450{
456 int port; 451 struct ring_pair_cb *ring_pair =
457 452 container_of(handle->qs[0], struct ring_pair_cb, q);
458 port = hns_ae_map_eport_to_dport(handle->eport_id);
459 453
460 *tx_usecs = hns_rcb_get_coalesce_usecs( 454 *tx_usecs = hns_rcb_get_coalesce_usecs(ring_pair->rcb_common,
461 hns_ae_get_dsaf_dev(handle->dev), 455 ring_pair->port_id_in_comm);
462 hns_dsaf_get_comm_idx_by_port(port)); 456 *rx_usecs = hns_rcb_get_coalesce_usecs(ring_pair->rcb_common,
463 *rx_usecs = hns_rcb_get_coalesce_usecs( 457 ring_pair->port_id_in_comm);
464 hns_ae_get_dsaf_dev(handle->dev),
465 hns_dsaf_get_comm_idx_by_port(port));
466} 458}
467 459
468static void hns_ae_get_rx_max_coalesced_frames(struct hnae_handle *handle, 460static void hns_ae_get_rx_max_coalesced_frames(struct hnae_handle *handle,
469 u32 *tx_frames, u32 *rx_frames) 461 u32 *tx_frames, u32 *rx_frames)
470{ 462{
471 int port; 463 struct ring_pair_cb *ring_pair =
464 container_of(handle->qs[0], struct ring_pair_cb, q);
472 465
473 assert(handle); 466 *tx_frames = hns_rcb_get_coalesced_frames(ring_pair->rcb_common,
474 467 ring_pair->port_id_in_comm);
475 port = hns_ae_map_eport_to_dport(handle->eport_id); 468 *rx_frames = hns_rcb_get_coalesced_frames(ring_pair->rcb_common,
476 469 ring_pair->port_id_in_comm);
477 *tx_frames = hns_rcb_get_coalesced_frames(
478 hns_ae_get_dsaf_dev(handle->dev), port);
479 *rx_frames = hns_rcb_get_coalesced_frames(
480 hns_ae_get_dsaf_dev(handle->dev), port);
481} 470}
482 471
483static void hns_ae_set_coalesce_usecs(struct hnae_handle *handle, 472static int hns_ae_set_coalesce_usecs(struct hnae_handle *handle,
484 u32 timeout) 473 u32 timeout)
485{ 474{
486 int port; 475 struct ring_pair_cb *ring_pair =
476 container_of(handle->qs[0], struct ring_pair_cb, q);
487 477
488 assert(handle); 478 return hns_rcb_set_coalesce_usecs(
489 479 ring_pair->rcb_common, ring_pair->port_id_in_comm, timeout);
490 port = hns_ae_map_eport_to_dport(handle->eport_id);
491
492 hns_rcb_set_coalesce_usecs(hns_ae_get_dsaf_dev(handle->dev),
493 port, timeout);
494} 480}
495 481
496static int hns_ae_set_coalesce_frames(struct hnae_handle *handle, 482static int hns_ae_set_coalesce_frames(struct hnae_handle *handle,
497 u32 coalesce_frames) 483 u32 coalesce_frames)
498{ 484{
499 int port; 485 struct ring_pair_cb *ring_pair =
500 int ret; 486 container_of(handle->qs[0], struct ring_pair_cb, q);
501 487
502 assert(handle); 488 return hns_rcb_set_coalesced_frames(
503 489 ring_pair->rcb_common,
504 port = hns_ae_map_eport_to_dport(handle->eport_id); 490 ring_pair->port_id_in_comm, coalesce_frames);
505
506 ret = hns_rcb_set_coalesced_frames(hns_ae_get_dsaf_dev(handle->dev),
507 port, coalesce_frames);
508 return ret;
509} 491}
510 492
511void hns_ae_update_stats(struct hnae_handle *handle, 493void hns_ae_update_stats(struct hnae_handle *handle,