Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e5ee20e7 authored by Michał Mirosław's avatar Michał Mirosław Committed by David S. Miller
Browse files

net: bna: convert to hw_features



Note: looks like bnad->conf_mutex is duplicating rtnl_lock.

Signed-off-by: default avatarMichał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d1423c7a
Loading
Loading
Loading
Loading
+9 −13
Original line number Diff line number Diff line
@@ -501,7 +501,7 @@ bnad_poll_cq(struct bnad *bnad, struct bna_ccb *ccb, int budget)

		skb_put(skb, ntohs(cmpl->length));
		if (likely
		    (bnad->rx_csum &&
		    ((bnad->netdev->features & NETIF_F_RXCSUM) &&
		     (((flags & BNA_CQ_EF_IPV4) &&
		      (flags & BNA_CQ_EF_L3_CKSUM_OK)) ||
		      (flags & BNA_CQ_EF_IPV6)) &&
@@ -2903,23 +2903,20 @@ bnad_netdev_init(struct bnad *bnad, bool using_dac)
{
	struct net_device *netdev = bnad->netdev;

	netdev->features |= NETIF_F_IPV6_CSUM;
	netdev->features |= NETIF_F_TSO;
	netdev->features |= NETIF_F_TSO6;
	netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
		NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_TX;

	netdev->features |= NETIF_F_GRO;
	pr_warn("bna: GRO enabled, using kernel stack GRO\n");
	netdev->vlan_features = NETIF_F_SG | NETIF_F_HIGHDMA |
		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
		NETIF_F_TSO | NETIF_F_TSO6;

	netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
	netdev->features |= netdev->hw_features |
		NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER;

	if (using_dac)
		netdev->features |= NETIF_F_HIGHDMA;

	netdev->features |=
		NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
		NETIF_F_HW_VLAN_FILTER;

	netdev->vlan_features = netdev->features;
	netdev->mem_start = bnad->mmio_start;
	netdev->mem_end = bnad->mmio_start + bnad->mmio_len - 1;

@@ -2970,7 +2967,6 @@ bnad_init(struct bnad *bnad,

	bnad->txq_depth = BNAD_TXQ_DEPTH;
	bnad->rxq_depth = BNAD_RXQ_DEPTH;
	bnad->rx_csum = true;

	bnad->tx_coalescing_timeo = BFI_TX_COALESCING_TIMEO;
	bnad->rx_coalescing_timeo = BFI_RX_COALESCING_TIMEO;
+0 −2
Original line number Diff line number Diff line
@@ -237,8 +237,6 @@ struct bnad {
	struct bna_rx_config rx_config[BNAD_MAX_RXS];
	struct bna_tx_config tx_config[BNAD_MAX_TXS];

	u32		rx_csum;

	void __iomem		*bar0;	/* BAR0 address */

	struct bna bna;
+0 −63
Original line number Diff line number Diff line
@@ -806,61 +806,6 @@ bnad_set_pauseparam(struct net_device *netdev,
	return 0;
}

static u32
bnad_get_rx_csum(struct net_device *netdev)
{
	u32 rx_csum;
	struct bnad *bnad = netdev_priv(netdev);

	rx_csum = bnad->rx_csum;
	return rx_csum;
}

static int
bnad_set_rx_csum(struct net_device *netdev, u32 rx_csum)
{
	struct bnad *bnad = netdev_priv(netdev);

	mutex_lock(&bnad->conf_mutex);
	bnad->rx_csum = rx_csum;
	mutex_unlock(&bnad->conf_mutex);
	return 0;
}

static int
bnad_set_tx_csum(struct net_device *netdev, u32 tx_csum)
{
	struct bnad *bnad = netdev_priv(netdev);

	mutex_lock(&bnad->conf_mutex);
	if (tx_csum) {
		netdev->features |= NETIF_F_IP_CSUM;
		netdev->features |= NETIF_F_IPV6_CSUM;
	} else {
		netdev->features &= ~NETIF_F_IP_CSUM;
		netdev->features &= ~NETIF_F_IPV6_CSUM;
	}
	mutex_unlock(&bnad->conf_mutex);
	return 0;
}

static int
bnad_set_tso(struct net_device *netdev, u32 tso)
{
	struct bnad *bnad = netdev_priv(netdev);

	mutex_lock(&bnad->conf_mutex);
	if (tso) {
		netdev->features |= NETIF_F_TSO;
		netdev->features |= NETIF_F_TSO6;
	} else {
		netdev->features &= ~NETIF_F_TSO;
		netdev->features &= ~NETIF_F_TSO6;
	}
	mutex_unlock(&bnad->conf_mutex);
	return 0;
}

static void
bnad_get_strings(struct net_device *netdev, u32 stringset, u8 * string)
{
@@ -1256,14 +1201,6 @@ static struct ethtool_ops bnad_ethtool_ops = {
	.set_ringparam = bnad_set_ringparam,
	.get_pauseparam = bnad_get_pauseparam,
	.set_pauseparam = bnad_set_pauseparam,
	.get_rx_csum = bnad_get_rx_csum,
	.set_rx_csum = bnad_set_rx_csum,
	.get_tx_csum = ethtool_op_get_tx_csum,
	.set_tx_csum = bnad_set_tx_csum,
	.get_sg = ethtool_op_get_sg,
	.set_sg = ethtool_op_set_sg,
	.get_tso = ethtool_op_get_tso,
	.set_tso = bnad_set_tso,
	.get_strings = bnad_get_strings,
	.get_ethtool_stats = bnad_get_ethtool_stats,
	.get_sset_count = bnad_get_sset_count