Message ID | 1515805815-2692-3-git-send-email-shannon.nelson@oracle.com |
---|---|
State | Accepted |
Delegated to: | Jeff Kirsher |
Headers | show |
Series | ixgbe: ipsec offload and sparc support | expand |
> -----Original Message----- > From: Intel-wired-lan [mailto:intel-wired-lan-bounces@osuosl.org] On > Behalf Of Shannon Nelson > Sent: Friday, January 12, 2018 5:10 PM > To: intel-wired-lan@lists.osuosl.org; Kirsher, Jeffrey T > <jeffrey.t.kirsher@intel.com> > Cc: steffen.klassert@secunet.com; sowmini.varadhan@oracle.com; > netdev@vger.kernel.org > Subject: [Intel-wired-lan] [PATCH 2/2] ixgbe: use compiler constants in Rx > path > > Rather than swapping runtime bytes to compare to constants, let the > compiler swap the constants and save a couple of runtuime cycles. > > Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com> > --- > drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c index c5ef09f..587fd8f 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c @@ -806,9 +806,9 @@ void ixgbe_ipsec_rx(struct ixgbe_ring *rx_ring, struct sk_buff *skb) { struct ixgbe_adapter *adapter = netdev_priv(rx_ring->netdev); - u16 pkt_info = le16_to_cpu(rx_desc->wb.lower.lo_dword.hs_rss.pkt_info); - u16 ipsec_pkt_types = IXGBE_RXDADV_PKTTYPE_IPSEC_AH | - IXGBE_RXDADV_PKTTYPE_IPSEC_ESP; + __le16 pkt_info = rx_desc->wb.lower.lo_dword.hs_rss.pkt_info; + __le16 ipsec_pkt_types = cpu_to_le16(IXGBE_RXDADV_PKTTYPE_IPSEC_AH | + IXGBE_RXDADV_PKTTYPE_IPSEC_ESP); struct ixgbe_ipsec *ipsec = adapter->ipsec; struct xfrm_offload *xo = NULL; struct xfrm_state *xs = NULL; @@ -825,11 +825,11 @@ void ixgbe_ipsec_rx(struct ixgbe_ring *rx_ring, iph = (struct iphdr *)(skb->data + ETH_HLEN); c_hdr = (u8 *)iph + iph->ihl * 4; switch (pkt_info & ipsec_pkt_types) { - case IXGBE_RXDADV_PKTTYPE_IPSEC_AH: + case cpu_to_le16(IXGBE_RXDADV_PKTTYPE_IPSEC_AH): spi = ((struct ip_auth_hdr *)c_hdr)->spi; proto = IPPROTO_AH; break; - case IXGBE_RXDADV_PKTTYPE_IPSEC_ESP: + case cpu_to_le16(IXGBE_RXDADV_PKTTYPE_IPSEC_ESP): spi = ((struct ip_esp_hdr *)c_hdr)->spi; proto = IPPROTO_ESP; break;
Rather than swapping runtime bytes to compare to constants, let the compiler swap the constants and save a couple of runtuime cycles. Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com> --- drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)