forked from Minki/linux
net: add Hisilicon Network Subsystem basic ethernet support
This is to add basic ethernet support for HNS. It is one of the way to use the HNS acceleration engine. But most of the decoding/encoding capability of the AE cannot be used in this way. This submit contains the basic feature as a ethernet driver. More will be added later. Signed-off-by: huangdaode <huangdaode@hisilicon.com> Signed-off-by: Kenneth Lee <liguozhu@huawei.com> Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
511e6bc071
commit
b5996f11ea
@ -55,4 +55,12 @@ config HNS_DSAF
|
||||
acceleration engine support. The engine is used in Hisilicon hip05,
|
||||
Hi1610 and further ICT SoC
|
||||
|
||||
config HNS_ENET
|
||||
tristate "Hisilicon HNS Ethernet Device Support"
|
||||
select PHYLIB
|
||||
select HNS
|
||||
---help---
|
||||
This selects the general ethernet driver for HNS. This module make
|
||||
use of any HNS AE driver, such as HNS_DSAF
|
||||
|
||||
endif # NET_VENDOR_HISILICON
|
||||
|
@ -7,3 +7,6 @@ obj-$(CONFIG_HNS) += hnae.o
|
||||
obj-$(CONFIG_HNS_DSAF) += hns_dsaf.o
|
||||
hns_dsaf-objs = hns_ae_adapt.o hns_dsaf_gmac.o hns_dsaf_mac.o hns_dsaf_misc.o \
|
||||
hns_dsaf_main.o hns_dsaf_ppe.o hns_dsaf_rcb.o hns_dsaf_xgmac.o
|
||||
|
||||
obj-$(CONFIG_HNS_ENET) += hns_enet_drv.o
|
||||
hns_enet_drv-objs = hns_enet.o hns_ethtool.o
|
||||
|
1646
drivers/net/ethernet/hisilicon/hns/hns_enet.c
Normal file
1646
drivers/net/ethernet/hisilicon/hns/hns_enet.c
Normal file
File diff suppressed because it is too large
Load Diff
84
drivers/net/ethernet/hisilicon/hns/hns_enet.h
Normal file
84
drivers/net/ethernet/hisilicon/hns/hns_enet.h
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Hisilicon Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef __HNS_ENET_H
|
||||
#define __HNS_ENET_H
|
||||
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/of_net.h>
|
||||
#include <linux/of_mdio.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#include "hnae.h"
|
||||
|
||||
enum hns_nic_state {
|
||||
NIC_STATE_TESTING = 0,
|
||||
NIC_STATE_RESETTING,
|
||||
NIC_STATE_REINITING,
|
||||
NIC_STATE_DOWN,
|
||||
NIC_STATE_DISABLED,
|
||||
NIC_STATE_REMOVING,
|
||||
NIC_STATE_SERVICE_INITED,
|
||||
NIC_STATE_SERVICE_SCHED,
|
||||
NIC_STATE2_RESET_REQUESTED,
|
||||
NIC_STATE_MAX
|
||||
};
|
||||
|
||||
struct hns_nic_ring_data {
|
||||
struct hnae_ring *ring;
|
||||
struct napi_struct napi;
|
||||
int queue_index;
|
||||
int (*poll_one)(struct hns_nic_ring_data *, int, void *);
|
||||
void (*ex_process)(struct hns_nic_ring_data *, struct sk_buff *);
|
||||
void (*fini_process)(struct hns_nic_ring_data *);
|
||||
};
|
||||
|
||||
struct hns_nic_priv {
|
||||
const char *ae_name;
|
||||
u32 enet_ver;
|
||||
u32 port_id;
|
||||
int phy_mode;
|
||||
int phy_led_val;
|
||||
struct phy_device *phy;
|
||||
struct net_device *netdev;
|
||||
struct device *dev;
|
||||
struct hnae_handle *ae_handle;
|
||||
|
||||
/* the cb for nic to manage the ring buffer, the first half of the
|
||||
* array is for tx_ring and vice versa for the second half
|
||||
*/
|
||||
struct hns_nic_ring_data *ring_data;
|
||||
|
||||
/* The most recently read link state */
|
||||
int link;
|
||||
u64 tx_timeout_count;
|
||||
|
||||
unsigned long state;
|
||||
|
||||
struct timer_list service_timer;
|
||||
|
||||
struct work_struct service_task;
|
||||
|
||||
struct notifier_block notifier_block;
|
||||
};
|
||||
|
||||
#define tx_ring_data(priv, idx) ((priv)->ring_data[idx])
|
||||
#define rx_ring_data(priv, idx) \
|
||||
((priv)->ring_data[(priv)->ae_handle->q_num + (idx)])
|
||||
|
||||
void hns_ethtool_set_ops(struct net_device *ndev);
|
||||
void hns_nic_net_reset(struct net_device *ndev);
|
||||
void hns_nic_net_reinit(struct net_device *netdev);
|
||||
int hns_nic_init_phy(struct net_device *ndev, struct hnae_handle *h);
|
||||
int hns_nic_net_xmit_hw(struct net_device *ndev,
|
||||
struct sk_buff *skb,
|
||||
struct hns_nic_ring_data *ring_data);
|
||||
|
||||
#endif /**__HNS_ENET_H */
|
1230
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
Normal file
1230
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user