From: Doug Berger <opendmb@gmail.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Doug Berger <opendmb@gmail.com>
Subject: [PATCH net-next 2/8] net: bcmgenet: enable NETIF_F_HW_CSUM feature
Date: Tue, 17 Dec 2019 13:02:23 -0800 [thread overview]
Message-ID: <1576616549-39097-3-git-send-email-opendmb@gmail.com> (raw)
In-Reply-To: <1576616549-39097-1-git-send-email-opendmb@gmail.com>
The GENET hardware should be capable of generating IP checksums
using the NETIF_F_HW_CSUM feature, so switch to using that feature
instead of the depricated NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM.
Signed-off-by: Doug Berger <opendmb@gmail.com>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 29 +++++++++++---------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index d9defb8b1e5f..cd07b3ad1d53 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -549,7 +549,7 @@ static int bcmgenet_set_tx_csum(struct net_device *dev,
tbuf_ctrl = bcmgenet_tbuf_ctrl_get(priv);
rbuf_ctrl = bcmgenet_rbuf_readl(priv, RBUF_CTRL);
- desc_64b_en = !!(wanted & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM));
+ desc_64b_en = !!(wanted & NETIF_F_HW_CSUM);
/* enable 64 bytes descriptor in both directions (RBUF and TBUF) */
if (desc_64b_en) {
@@ -574,7 +574,7 @@ static int bcmgenet_set_features(struct net_device *dev,
netdev_features_t wanted = dev->wanted_features;
int ret = 0;
- if (changed & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM))
+ if (changed & NETIF_F_HW_CSUM)
ret = bcmgenet_set_tx_csum(dev, wanted);
if (changed & (NETIF_F_RXCSUM))
ret = bcmgenet_set_rx_csum(dev, wanted);
@@ -1516,24 +1516,19 @@ static struct sk_buff *bcmgenet_put_tx_csum(struct net_device *dev,
ip_proto = ipv6_hdr(skb)->nexthdr;
break;
default:
- return skb;
+ /* don't use UDP flag */
+ ip_proto = 0;
+ break;
}
offset = skb_checksum_start_offset(skb) - sizeof(*status);
tx_csum_info = (offset << STATUS_TX_CSUM_START_SHIFT) |
- (offset + skb->csum_offset);
+ (offset + skb->csum_offset) |
+ STATUS_TX_CSUM_LV;
- /* Set the length valid bit for TCP and UDP and just set
- * the special UDP flag for IPv4, else just set to 0.
- */
- if (ip_proto == IPPROTO_TCP || ip_proto == IPPROTO_UDP) {
- tx_csum_info |= STATUS_TX_CSUM_LV;
- if (ip_proto == IPPROTO_UDP &&
- ip_ver == htons(ETH_P_IP))
- tx_csum_info |= STATUS_TX_CSUM_PROTO_UDP;
- } else {
- tx_csum_info = 0;
- }
+ /* Set the special UDP flag for UDP */
+ if (ip_proto == IPPROTO_UDP)
+ tx_csum_info |= STATUS_TX_CSUM_PROTO_UDP;
status->tx_csum_info = tx_csum_info;
}
@@ -3536,8 +3531,8 @@ static int bcmgenet_probe(struct platform_device *pdev)
priv->msg_enable = netif_msg_init(-1, GENET_MSG_DEFAULT);
/* Set hardware features */
- dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM |
- NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA | NETIF_F_RXCSUM;
+ dev->hw_features |= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM |
+ NETIF_F_RXCSUM;
/* Request the WOL interrupt and advertise suspend if available */
priv->wol_irq_disabled = true;
--
2.7.4
next prev parent reply other threads:[~2019-12-17 21:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-17 21:02 [PATCH net-next 0/8] net: bcmgenet: Turn on offloads by default Doug Berger
2019-12-17 21:02 ` [PATCH net-next 1/8] net: bcmgenet: enable NETIF_F_HIGHDMA flag Doug Berger
2019-12-17 22:51 ` Florian Fainelli
2019-12-17 21:02 ` Doug Berger [this message]
2019-12-17 21:02 ` [PATCH net-next 3/8] net: bcmgenet: use CHECKSUM_COMPLETE for NETIF_F_RXCSUM Doug Berger
2019-12-17 21:16 ` David Miller
2019-12-17 22:52 ` Florian Fainelli
2019-12-17 23:21 ` David Miller
2019-12-17 22:52 ` Florian Fainelli
2019-12-17 23:36 ` Doug Berger
2019-12-17 23:08 ` Jakub Kicinski
2019-12-25 23:39 ` kbuild test robot
2019-12-17 21:02 ` [PATCH net-next 4/8] net: bcmgenet: Refactor bcmgenet_set_features() Doug Berger
2019-12-17 23:02 ` Florian Fainelli
2019-12-17 21:02 ` [PATCH net-next 5/8] net: bcmgenet: Utilize bcmgenet_set_features() during resume/open Doug Berger
2019-12-17 23:01 ` Florian Fainelli
2019-12-17 21:02 ` [PATCH net-next 6/8] net: bcmgenet: Turn on offloads by default Doug Berger
2019-12-17 23:02 ` Florian Fainelli
2019-12-17 21:02 ` [PATCH net-next 7/8] net: bcmgenet: Be drop monitor friendly while re-allocating headroom Doug Berger
2019-12-17 23:00 ` Florian Fainelli
2019-12-17 21:02 ` [PATCH net-next 8/8] net: bcmgenet: Add software counters to track reallocations Doug Berger
2019-12-17 23:00 ` Florian Fainelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1576616549-39097-3-git-send-email-opendmb@gmail.com \
--to=opendmb@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).