mirror of https://gitee.com/openkylin/linux.git
net: spider_net: convert to hw_features
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
911cb193f3
commit
6de240b7f7
|
@ -994,15 +994,13 @@ spider_net_pass_skb_up(struct spider_net_descr *descr,
|
||||||
skb->protocol = eth_type_trans(skb, netdev);
|
skb->protocol = eth_type_trans(skb, netdev);
|
||||||
|
|
||||||
/* checksum offload */
|
/* checksum offload */
|
||||||
if (card->options.rx_csum) {
|
skb_checksum_none_assert(skb);
|
||||||
|
if (netdev->features & NETIF_F_RXCSUM) {
|
||||||
if ( ( (data_status & SPIDER_NET_DATA_STATUS_CKSUM_MASK) ==
|
if ( ( (data_status & SPIDER_NET_DATA_STATUS_CKSUM_MASK) ==
|
||||||
SPIDER_NET_DATA_STATUS_CKSUM_MASK) &&
|
SPIDER_NET_DATA_STATUS_CKSUM_MASK) &&
|
||||||
!(data_error & SPIDER_NET_DATA_ERR_CKSUM_MASK))
|
!(data_error & SPIDER_NET_DATA_ERR_CKSUM_MASK))
|
||||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||||
else
|
}
|
||||||
skb_checksum_none_assert(skb);
|
|
||||||
} else
|
|
||||||
skb_checksum_none_assert(skb);
|
|
||||||
|
|
||||||
if (data_status & SPIDER_NET_VLAN_PACKET) {
|
if (data_status & SPIDER_NET_VLAN_PACKET) {
|
||||||
/* further enhancements: HW-accel VLAN
|
/* further enhancements: HW-accel VLAN
|
||||||
|
@ -2322,14 +2320,15 @@ spider_net_setup_netdev(struct spider_net_card *card)
|
||||||
card->aneg_timer.function = spider_net_link_phy;
|
card->aneg_timer.function = spider_net_link_phy;
|
||||||
card->aneg_timer.data = (unsigned long) card;
|
card->aneg_timer.data = (unsigned long) card;
|
||||||
|
|
||||||
card->options.rx_csum = SPIDER_NET_RX_CSUM_DEFAULT;
|
|
||||||
|
|
||||||
netif_napi_add(netdev, &card->napi,
|
netif_napi_add(netdev, &card->napi,
|
||||||
spider_net_poll, SPIDER_NET_NAPI_WEIGHT);
|
spider_net_poll, SPIDER_NET_NAPI_WEIGHT);
|
||||||
|
|
||||||
spider_net_setup_netdev_ops(netdev);
|
spider_net_setup_netdev_ops(netdev);
|
||||||
|
|
||||||
netdev->features = NETIF_F_IP_CSUM | NETIF_F_LLTX;
|
netdev->hw_features = NETIF_F_RXCSUM | NETIF_F_IP_CSUM;
|
||||||
|
if (SPIDER_NET_RX_CSUM_DEFAULT)
|
||||||
|
netdev->features |= NETIF_F_RXCSUM;
|
||||||
|
netdev->features |= NETIF_F_IP_CSUM | NETIF_F_LLTX;
|
||||||
/* some time: NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
|
/* some time: NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
|
||||||
* NETIF_F_HW_VLAN_FILTER */
|
* NETIF_F_HW_VLAN_FILTER */
|
||||||
|
|
||||||
|
|
|
@ -429,12 +429,6 @@ struct spider_net_descr_chain {
|
||||||
* 701b8000 would be correct, but every packets gets that flag */
|
* 701b8000 would be correct, but every packets gets that flag */
|
||||||
#define SPIDER_NET_DESTROY_RX_FLAGS 0x700b8000
|
#define SPIDER_NET_DESTROY_RX_FLAGS 0x700b8000
|
||||||
|
|
||||||
/* this will be bigger some time */
|
|
||||||
struct spider_net_options {
|
|
||||||
int rx_csum; /* for rx: if 0 ip_summed=NONE,
|
|
||||||
if 1 and hw has verified, ip_summed=UNNECESSARY */
|
|
||||||
};
|
|
||||||
|
|
||||||
#define SPIDER_NET_DEFAULT_MSG ( NETIF_MSG_DRV | \
|
#define SPIDER_NET_DEFAULT_MSG ( NETIF_MSG_DRV | \
|
||||||
NETIF_MSG_PROBE | \
|
NETIF_MSG_PROBE | \
|
||||||
NETIF_MSG_LINK | \
|
NETIF_MSG_LINK | \
|
||||||
|
@ -487,7 +481,6 @@ struct spider_net_card {
|
||||||
/* for ethtool */
|
/* for ethtool */
|
||||||
int msg_enable;
|
int msg_enable;
|
||||||
struct spider_net_extra_stats spider_stats;
|
struct spider_net_extra_stats spider_stats;
|
||||||
struct spider_net_options options;
|
|
||||||
|
|
||||||
/* Must be last item in struct */
|
/* Must be last item in struct */
|
||||||
struct spider_net_descr darray[0];
|
struct spider_net_descr darray[0];
|
||||||
|
|
|
@ -115,24 +115,6 @@ spider_net_ethtool_nway_reset(struct net_device *netdev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32
|
|
||||||
spider_net_ethtool_get_rx_csum(struct net_device *netdev)
|
|
||||||
{
|
|
||||||
struct spider_net_card *card = netdev_priv(netdev);
|
|
||||||
|
|
||||||
return card->options.rx_csum;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
spider_net_ethtool_set_rx_csum(struct net_device *netdev, u32 n)
|
|
||||||
{
|
|
||||||
struct spider_net_card *card = netdev_priv(netdev);
|
|
||||||
|
|
||||||
card->options.rx_csum = n;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spider_net_ethtool_get_ringparam(struct net_device *netdev,
|
spider_net_ethtool_get_ringparam(struct net_device *netdev,
|
||||||
struct ethtool_ringparam *ering)
|
struct ethtool_ringparam *ering)
|
||||||
|
@ -189,9 +171,6 @@ const struct ethtool_ops spider_net_ethtool_ops = {
|
||||||
.set_msglevel = spider_net_ethtool_set_msglevel,
|
.set_msglevel = spider_net_ethtool_set_msglevel,
|
||||||
.get_link = ethtool_op_get_link,
|
.get_link = ethtool_op_get_link,
|
||||||
.nway_reset = spider_net_ethtool_nway_reset,
|
.nway_reset = spider_net_ethtool_nway_reset,
|
||||||
.get_rx_csum = spider_net_ethtool_get_rx_csum,
|
|
||||||
.set_rx_csum = spider_net_ethtool_set_rx_csum,
|
|
||||||
.set_tx_csum = ethtool_op_set_tx_csum,
|
|
||||||
.get_ringparam = spider_net_ethtool_get_ringparam,
|
.get_ringparam = spider_net_ethtool_get_ringparam,
|
||||||
.get_strings = spider_net_get_strings,
|
.get_strings = spider_net_get_strings,
|
||||||
.get_sset_count = spider_net_get_sset_count,
|
.get_sset_count = spider_net_get_sset_count,
|
||||||
|
|
Loading…
Reference in New Issue