From mboxrd@z Thu Jan 1 00:00:00 1970 From: Felix Manlunas Subject: [PATCH V2 net-next 2/6] liquidio: Moved common function list_delete_head to octeon_network.h Date: Fri, 27 Apr 2018 23:32:45 -0700 Message-ID: <20180428063245.GA3258@felix-thinkpad.cavium.com> References: <20180428063204.GA3229@felix-thinkpad.cavium.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, raghu.vatsavayi@cavium.com, derek.chickles@cavium.com, satananda.burla@cavium.com, felix.manlunas@cavium.com, intiyaz.basha@cavium.com To: davem@davemloft.net Return-path: Received: from mail-dm3nam03on0041.outbound.protection.outlook.com ([104.47.41.41]:23924 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932841AbeD1Gcv (ORCPT ); Sat, 28 Apr 2018 02:32:51 -0400 Content-Disposition: inline In-Reply-To: <20180428063204.GA3229@felix-thinkpad.cavium.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Intiyaz Basha Moved common function list_delete_head to octeon_network.h and renamed it to lio_list_delete_head Signed-off-by: Intiyaz Basha Acked-by: Derek Chickles Signed-off-by: Felix Manlunas --- drivers/net/ethernet/cavium/liquidio/lio_main.c | 23 ++------------------ drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 25 +++------------------- .../net/ethernet/cavium/liquidio/octeon_network.h | 19 ++++++++++++++++ 3 files changed, 24 insertions(+), 43 deletions(-) diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c index e78b3d8..8b3ab98 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c @@ -542,25 +542,6 @@ static inline int check_txq_status(struct lio *lio) } /** - * Remove the node at the head of the list. The list would be empty at - * the end of this call if there are no more nodes in the list. - */ -static inline struct list_head *list_delete_head(struct list_head *root) -{ - struct list_head *node; - - if ((root->prev == root) && (root->next == root)) - node = NULL; - else - node = root->next; - - if (node) - list_del(node); - - return node; -} - -/** * \brief Delete gather lists * @param lio per-network private data */ @@ -578,7 +559,7 @@ static void delete_glists(struct lio *lio) for (i = 0; i < lio->linfo.num_txpciq; i++) { do { g = (struct octnic_gather *) - list_delete_head(&lio->glist[i]); + lio_list_delete_head(&lio->glist[i]); if (g) kfree(g); } while (g); @@ -2570,7 +2551,7 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) spin_lock(&lio->glist_lock[q_idx]); g = (struct octnic_gather *) - list_delete_head(&lio->glist[q_idx]); + lio_list_delete_head(&lio->glist[q_idx]); spin_unlock(&lio->glist_lock[q_idx]); if (!g) { diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c index 83d8bf6..7725b3f 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c @@ -285,25 +285,6 @@ static struct pci_driver liquidio_vf_pci_driver = { }; /** - * Remove the node at the head of the list. The list would be empty at - * the end of this call if there are no more nodes in the list. - */ -static struct list_head *list_delete_head(struct list_head *root) -{ - struct list_head *node; - - if ((root->prev == root) && (root->next == root)) - node = NULL; - else - node = root->next; - - if (node) - list_del(node); - - return node; -} - -/** * \brief Delete gather lists * @param lio per-network private data */ @@ -321,7 +302,7 @@ static void delete_glists(struct lio *lio) for (i = 0; i < lio->linfo.num_txpciq; i++) { do { g = (struct octnic_gather *) - list_delete_head(&lio->glist[i]); + lio_list_delete_head(&lio->glist[i]); kfree(g); } while (g); @@ -1629,8 +1610,8 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) int i, frags; spin_lock(&lio->glist_lock[q_idx]); - g = (struct octnic_gather *)list_delete_head( - &lio->glist[q_idx]); + g = (struct octnic_gather *) + lio_list_delete_head(&lio->glist[q_idx]); spin_unlock(&lio->glist_lock[q_idx]); if (!g) { diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_network.h b/drivers/net/ethernet/cavium/liquidio/octeon_network.h index ad5195c..3cb3d72 100644 --- a/drivers/net/ethernet/cavium/liquidio/octeon_network.h +++ b/drivers/net/ethernet/cavium/liquidio/octeon_network.h @@ -563,4 +563,23 @@ static inline int skb_iq(struct lio *lio, struct sk_buff *skb) return skb->queue_mapping % lio->linfo.num_txpciq; } +/** + * Remove the node at the head of the list. The list would be empty at + * the end of this call if there are no more nodes in the list. + */ +static inline struct list_head *lio_list_delete_head(struct list_head *root) +{ + struct list_head *node; + + if (root->prev == root && root->next == root) + node = NULL; + else + node = root->next; + + if (node) + list_del(node); + + return node; +} + #endif -- 2.9.0