Skip to content

Commit

Permalink
Merge branch 'hns-next'
Browse files Browse the repository at this point in the history
Yisen Zhuang says:

====================
net: hns: fix some bugs in hns driver

This series includes some bugs fixed. All these patches needs to be
applied after the patchset about ACPI support, so this series is
floated to net-next list.

The patches are:
 > from Daode, fixes about pfc pause frame, getting coaslesce, led
control logic, TSO on|off and tcam table configuration.

 > from Jun He, fix the potential leak to port unavailable

 > from Kejian, fix bug of loopback and failing to test ping6

 > from Qianqian, fix the several typo in hns driver

For more details, please see individual patches.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jun 21, 2016
2 parents 4906ce4 + 6fe2746 commit 527f227
Show file tree
Hide file tree
Showing 11 changed files with 291 additions and 155 deletions.
1 change: 0 additions & 1 deletion drivers/net/ethernet/hisilicon/hns/hnae.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ int hnae_ae_register(struct hnae_ae_dev *hdev, struct module *owner)

if (!hdev->ops || !hdev->ops->get_handle ||
!hdev->ops->toggle_ring_irq ||
!hdev->ops->toggle_queue_status ||
!hdev->ops->get_status || !hdev->ops->adjust_link)
return -EINVAL;

Expand Down
6 changes: 5 additions & 1 deletion drivers/net/ethernet/hisilicon/hns/hnae.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ struct hnae_ae_ops {
int (*get_info)(struct hnae_handle *handle,
u8 *auto_neg, u16 *speed, u8 *duplex);
void (*toggle_ring_irq)(struct hnae_ring *ring, u32 val);
void (*toggle_queue_status)(struct hnae_queue *queue, u32 val);
void (*adjust_link)(struct hnae_handle *handle, int speed, int duplex);
int (*set_loopback)(struct hnae_handle *handle,
enum hnae_loop loop_mode, int en);
Expand All @@ -473,6 +472,11 @@ struct hnae_ae_ops {
int (*set_coalesce_usecs)(struct hnae_handle *handle, u32 timeout);
int (*set_coalesce_frames)(struct hnae_handle *handle,
u32 coalesce_frames);
void (*get_coalesce_range)(struct hnae_handle *handle,
u32 *tx_frames_low, u32 *rx_frames_low,
u32 *tx_frames_high, u32 *rx_frames_high,
u32 *tx_usecs_low, u32 *rx_usecs_low,
u32 *tx_usecs_high, u32 *rx_usecs_high);
void (*set_promisc_mode)(struct hnae_handle *handle, u32 en);
int (*get_mac_addr)(struct hnae_handle *handle, void **p);
int (*set_mac_addr)(struct hnae_handle *handle, void *p);
Expand Down
53 changes: 38 additions & 15 deletions drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,21 @@ static void hns_ae_set_tso_stats(struct hnae_handle *handle, int enable)
static int hns_ae_start(struct hnae_handle *handle)
{
int ret;
int k;
struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle);

ret = hns_mac_vm_config_bc_en(mac_cb, 0, true);
if (ret)
return ret;

for (k = 0; k < handle->q_num; k++) {
if (AE_IS_VER1(mac_cb->dsaf_dev->dsaf_ver))
hns_rcb_int_clr_hw(handle->qs[k],
RCB_INT_FLAG_TX | RCB_INT_FLAG_RX);
else
hns_rcbv2_int_clr_hw(handle->qs[k],
RCB_INT_FLAG_TX | RCB_INT_FLAG_RX);
}
hns_ae_ring_enable_all(handle, 1);
msleep(100);

Expand Down Expand Up @@ -313,18 +322,6 @@ static void hns_aev2_toggle_ring_irq(struct hnae_ring *ring, u32 mask)
hns_rcbv2_int_ctrl_hw(ring->q, flag, mask);
}

static void hns_ae_toggle_queue_status(struct hnae_queue *queue, u32 val)
{
struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(queue->dev);

if (AE_IS_VER1(dsaf_dev->dsaf_ver))
hns_rcb_int_clr_hw(queue, RCB_INT_FLAG_TX | RCB_INT_FLAG_RX);
else
hns_rcbv2_int_clr_hw(queue, RCB_INT_FLAG_TX | RCB_INT_FLAG_RX);

hns_rcb_start(queue, val);
}

static int hns_ae_get_link_status(struct hnae_handle *handle)
{
u32 link_status;
Expand Down Expand Up @@ -465,6 +462,30 @@ static int hns_ae_set_coalesce_frames(struct hnae_handle *handle,
ring_pair->port_id_in_comm, coalesce_frames);
}

static void hns_ae_get_coalesce_range(struct hnae_handle *handle,
u32 *tx_frames_low, u32 *rx_frames_low,
u32 *tx_frames_high, u32 *rx_frames_high,
u32 *tx_usecs_low, u32 *rx_usecs_low,
u32 *tx_usecs_high, u32 *rx_usecs_high)
{
struct dsaf_device *dsaf_dev;

dsaf_dev = hns_ae_get_dsaf_dev(handle->dev);

*tx_frames_low = HNS_RCB_MIN_COALESCED_FRAMES;
*rx_frames_low = HNS_RCB_MIN_COALESCED_FRAMES;
*tx_frames_high =
(dsaf_dev->desc_num - 1 > HNS_RCB_MAX_COALESCED_FRAMES) ?
HNS_RCB_MAX_COALESCED_FRAMES : dsaf_dev->desc_num - 1;
*rx_frames_high =
(dsaf_dev->desc_num - 1 > HNS_RCB_MAX_COALESCED_FRAMES) ?
HNS_RCB_MAX_COALESCED_FRAMES : dsaf_dev->desc_num - 1;
*tx_usecs_low = 0;
*rx_usecs_low = 0;
*tx_usecs_high = HNS_RCB_MAX_COALESCED_USECS;
*rx_usecs_high = HNS_RCB_MAX_COALESCED_USECS;
}

void hns_ae_update_stats(struct hnae_handle *handle,
struct net_device_stats *net_stats)
{
Expand Down Expand Up @@ -587,6 +608,7 @@ void hns_ae_get_strings(struct hnae_handle *handle,
int idx;
struct hns_mac_cb *mac_cb;
struct hns_ppe_cb *ppe_cb;
struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev);
u8 *p = data;
struct hnae_vf_cb *vf_cb;

Expand All @@ -609,13 +631,14 @@ void hns_ae_get_strings(struct hnae_handle *handle,
p += ETH_GSTRING_LEN * hns_mac_get_sset_count(mac_cb, stringset);

if (mac_cb->mac_type == HNAE_PORT_SERVICE)
hns_dsaf_get_strings(stringset, p, port);
hns_dsaf_get_strings(stringset, p, port, dsaf_dev);
}

int hns_ae_get_sset_count(struct hnae_handle *handle, int stringset)
{
u32 sset_count = 0;
struct hns_mac_cb *mac_cb;
struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev);

assert(handle);

Expand All @@ -626,7 +649,7 @@ int hns_ae_get_sset_count(struct hnae_handle *handle, int stringset)
sset_count += hns_mac_get_sset_count(mac_cb, stringset);

if (mac_cb->mac_type == HNAE_PORT_SERVICE)
sset_count += hns_dsaf_get_sset_count(stringset);
sset_count += hns_dsaf_get_sset_count(dsaf_dev, stringset);

return sset_count;
}
Expand Down Expand Up @@ -782,7 +805,6 @@ static struct hnae_ae_ops hns_dsaf_ops = {
.stop = hns_ae_stop,
.reset = hns_ae_reset,
.toggle_ring_irq = hns_ae_toggle_ring_irq,
.toggle_queue_status = hns_ae_toggle_queue_status,
.get_status = hns_ae_get_link_status,
.get_info = hns_ae_get_mac_info,
.adjust_link = hns_ae_adjust_link,
Expand All @@ -796,6 +818,7 @@ static struct hnae_ae_ops hns_dsaf_ops = {
.get_rx_max_coalesced_frames = hns_ae_get_rx_max_coalesced_frames,
.set_coalesce_usecs = hns_ae_set_coalesce_usecs,
.set_coalesce_frames = hns_ae_set_coalesce_frames,
.get_coalesce_range = hns_ae_get_coalesce_range,
.set_promisc_mode = hns_ae_set_promisc_mode,
.set_mac_addr = hns_ae_set_mac_address,
.set_mc_addr = hns_ae_set_multicast_one,
Expand Down
Loading

0 comments on commit 527f227

Please sign in to comment.