From patchwork Mon Jun 4 18:58:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 925191 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="I5yMY+Qx"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4104392BlXz9s1R for ; Tue, 5 Jun 2018 04:58:44 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 2EE19895D5; Mon, 4 Jun 2018 18:58:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1e8GJxs2yx5A; Mon, 4 Jun 2018 18:58:42 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 78C8E895AF; Mon, 4 Jun 2018 18:58:42 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 6BB481C286F for ; Mon, 4 Jun 2018 18:58:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 6800B24527 for ; Mon, 4 Jun 2018 18:58:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JIoBSD6bRvMb for ; Mon, 4 Jun 2018 18:58:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by silver.osuosl.org (Postfix) with ESMTPS id B300D230FE for ; Mon, 4 Jun 2018 18:58:40 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w54ItwcP133158; Mon, 4 Jun 2018 18:58:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2017-10-26; bh=VChj+p5MioxYXJKesRax4q/CDb1yjk29WyheYrKhkIE=; b=I5yMY+Qx00DGt744vAiOKqnS9S9YcsfuWR5bZ8d+XXC9VPzCgTsUu/rRYI7/XwzWi4Ev Y3w0U8VsDzdj9lA4qnoyjdTV7YIK/8U+YXm797VSqzpQGLN4M7OD7HeQRUnFyQgIqLOE RxtJo3DnEnBEPhYKGOC8nSgMjk6eCyXCcpAEy+y1nKPtHi1kPkjXth1TDWKuGqZseies Z7KQjAOc8+l/IMov3h8CC1doK6Pq8VPiKCTYzBVN9hiGPSfvMbK4j6ubimSZkwmo1BPS iGtsq+jk0DRwH0A9vnwbVN614ppewwbgWNoevxUzwqQVLZNou71tHfdW0voJOIp8pROi eQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2jbvypcvdh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 04 Jun 2018 18:58:38 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w54IwbtF028945 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 4 Jun 2018 18:58:38 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w54Iwb6F007165; Mon, 4 Jun 2018 18:58:37 GMT Received: from slnelson-mint18.us.oracle.com (/10.39.237.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 04 Jun 2018 11:58:37 -0700 From: Shannon Nelson To: intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com, andre@tomt.net Date: Mon, 4 Jun 2018 11:58:30 -0700 Message-Id: <1528138710-31848-1-git-send-email-shannon.nelson@oracle.com> X-Mailer: git-send-email 2.7.4 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8914 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=592 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806040218 Subject: [Intel-wired-lan] [net-queue PATCH] ixgbe: check that ipsec is available on the chip X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Check the writability of the IPsec configuration registers before setting up the offload. Fixes: 49a94d74d948 ("ixgbe: add ipsec engine start and stop routines") Reported-by: Andre Tomt Cc: Alexander Duyck Signed-off-by: Shannon Nelson --- drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c index 344a1f2..003b53f 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c @@ -210,7 +210,10 @@ static void ixgbe_ipsec_stop_engine(struct ixgbe_adapter *adapter) struct ixgbe_hw *hw = &adapter->hw; u32 reg; - ixgbe_ipsec_stop_data(adapter); + /* stop data if it has been running */ + reg = IXGBE_READ_REG(hw, IXGBE_SECTXCTRL); + if (!(reg & IXGBE_SECTXCTRL_SECTX_DIS)) + ixgbe_ipsec_stop_data(adapter); /* disable Rx and Tx SA lookup */ IXGBE_WRITE_REG(hw, IXGBE_IPSTXIDX, 0); @@ -966,12 +969,27 @@ void ixgbe_ipsec_rx(struct ixgbe_ring *rx_ring, **/ void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter) { + struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_ipsec *ipsec; size_t size; + u32 reg1, reg2; if (adapter->hw.mac.type == ixgbe_mac_82598EB) return; + /* verify that the ipsec offload is available by checking + * the writability of the engine DISable bit - can we clear + * the bit? If not, don't set up ipsec. If yes, the put + * it back and continue the setup. + */ + reg1 = IXGBE_READ_REG(hw, IXGBE_SECTXCTRL); + reg2 = reg1 & ~IXGBE_SECTXCTRL_SECTX_DIS; + IXGBE_WRITE_REG(hw, IXGBE_SECTXCTRL, reg2); + reg2 = IXGBE_READ_REG(hw, IXGBE_SECTXCTRL); + if (reg2 & IXGBE_SECTXCTRL_SECTX_DIS) + return; + IXGBE_WRITE_REG(hw, IXGBE_SECTXCTRL, reg1); + ipsec = kzalloc(sizeof(*ipsec), GFP_KERNEL); if (!ipsec) goto err1;