ixgbe: checkpatch cleanups
PATCH 1/1 ixgbe: checkpatch cleanups
Run ixgbe driver through checkpatch and edit away all the nasty bits. Fix line spacing, some bad indentation, and in a couple of cases use short circuit (already there) return to lessen indentation.
---
v2 - fix more things found by checkpatch
drivers/net/ixgbe/ixgbe_82599_bypass.c | 8 +- drivers/net/ixgbe/ixgbe_bypass.c | 6 +- drivers/net/ixgbe/ixgbe_bypass.h | 8 +- drivers/net/ixgbe/ixgbe_bypass_defines.h | 2 +- drivers/net/ixgbe/ixgbe_ethdev.c | 251 +++++++++++++-------------- drivers/net/ixgbe/ixgbe_fdir.c | 68 ++++---- drivers/net/ixgbe/ixgbe_pf.c | 37 ++-- drivers/net/ixgbe/ixgbe_rxtx.c | 284 ++++++++++++++++--------------- drivers/net/ixgbe/ixgbe_rxtx_vec.c | 33 ++-- 9 files changed, 359 insertions(+), 338 deletions(-)
drivers/net/ixgbe/ixgbe_82599_bypass.c +4 -4
@@ -297,8 +297,8 @@ ixgbe_bypass_init_hw(struct ixgbe_hw *hw) {int rc; -if ((rc =ixgbe_init_hw (hw)) ==0 && - hw->device_id ==IXGBE_DEV_ID_82599_BYPASS ) { + rc =ixgbe_init_hw (hw); +if (rc ==0 && hw->device_id ==IXGBE_DEV_ID_82599_BYPASS ) { hw->mac.ops.setup_link = &ixgbe_setup_mac_link_multispeed_fixed_fiber;
@@ -306,8 +306,8 @@ ixgbe_bypass_init_hw(struct ixgbe_hw *hw) hw->mac.ops.get_media_type = &ixgbe_bypass_get_media_type; hw->mac.ops.disable_tx_laser =NULL ; - hw->mac.ops.enable_tx_laser =NULL ; - hw->mac.ops.flap_tx_laser =NULL ; + hw->mac.ops.enable_tx_laser =NULL ; + hw->mac.ops.flap_tx_laser =NULL ; }return rc;
drivers/net/ixgbe/ixgbe_bypass.c +3 -3
@@ -82,7 +82,7 @@ ixgbe_bypass_set_time(struct ixgbe_adapter *adapter)BYPASS_CTL1_VALID_M |BYPASS_CTL1_OFFTRST_M ; value = (sec &BYPASS_CTL1_TIME_M ) | -BYPASS_CTL1_VALID | +BYPASS_CTL1_VALID |BYPASS_CTL1_OFFTRST ;FUNC_PTR_OR_RET (adapter->bps.ops.bypass_set);
@@ -275,8 +275,8 @@ s32 ixgbe_bypass_wd_timeout_store(struct rte_eth_dev *dev, u32 timeout) {struct ixgbe_hw *hw; -u32 status; -u32 mask; +u32 status; +u32 mask;s32 ret_val;struct ixgbe_adapter *adapter =IXGBE_DEV_TO_ADPATER (dev);
drivers/net/ixgbe/ixgbe_bypass.h +4 -4
@@ -37,10 +37,10 @@#ifdef RTE_NIC_BYPASS struct ixgbe_bypass_mac_ops { -s32 (*bypass_rw) (struct ixgbe_hw *hw,u32 cmd,u32 *status); -bool (*bypass_valid_rd) (u32 in_reg,u32 out_reg); -s32 (*bypass_set) (struct ixgbe_hw *hw,u32 cmd,u32 event,u32 action); -s32 (*bypass_rd_eep) (struct ixgbe_hw *hw,u32 addr,u8 *value); +s32 (*bypass_rw)(struct ixgbe_hw *hw,u32 cmd,u32 *status); +bool (*bypass_valid_rd)(u32 in_reg,u32 out_reg); +s32 (*bypass_set)(struct ixgbe_hw *hw,u32 cmd,u32 event,u32 action); +s32 (*bypass_rd_eep)(struct ixgbe_hw *hw,u32 addr,u8 *value); }; struct ixgbe_bypass_info {
drivers/net/ixgbe/ixgbe_bypass_defines.h +1 -1
@@ -136,7 +136,7 @@ enum ixgbe_state_t {#define BYPASS_LOG_EVENT_SHIFT 28#define BYPASS_LOG_CLEAR_SHIFT 24/* bit offset */ #define IXGBE_DEV_TO_ADPATER (dev) \ - ((struct ixgbe_adapter*)(dev->data->dev_private)) + ((struct ixgbe_adapter *)(dev->data->dev_private))/* extractions from ixgbe_phy.h */ #define IXGBE_I2C_EEPROM_DEV_ADDR2 0xA2
drivers/net/ixgbe/ixgbe_ethdev.c +127 -124
682 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_fdir.c +36 -32
178 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_pf.c +19 -18
@@ -97,9 +97,9 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)struct ixgbe_vf_info **vfinfo =IXGBE_DEV_PRIVATE_TO_P_VFDATA (eth_dev->data->dev_private);struct ixgbe_mirror_info *mirror_info = -IXGBE_DEV_PRIVATE_TO_PFDATA (eth_dev->data->dev_private); +IXGBE_DEV_PRIVATE_TO_PFDATA (eth_dev->data->dev_private);struct ixgbe_uta_info *uta_info = -IXGBE_DEV_PRIVATE_TO_UTA (eth_dev->data->dev_private); +IXGBE_DEV_PRIVATE_TO_UTA (eth_dev->data->dev_private);struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private);uint16_t vf_num;
@@ -108,15 +108,16 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)PMD_INIT_FUNC_TRACE ();RTE_ETH_DEV_SRIOV (eth_dev).active =0 ; -if (0 == (vf_num =dev_num_vf (eth_dev))) + vf_num =dev_num_vf (eth_dev); +if (vf_num ==0 )return ; *vfinfo =rte_zmalloc ("vf_info" ,sizeof (struct ixgbe_vf_info ) * vf_num,0 );if (*vfinfo ==NULL )rte_panic ("Cannot allocate memory for private VF data\n" ); -memset (mirror_info,0 ,sizeof (struct ixgbe_mirror_info )); -memset (uta_info,0 ,sizeof (struct ixgbe_uta_info )); +memset (mirror_info,0 ,sizeof (struct ixgbe_mirror_info )); +memset (uta_info,0 ,sizeof (struct ixgbe_uta_info )); hw->mac.mc_filter_type =0 ;if (vf_num >=ETH_32_POOLS ) {
@@ -141,8 +142,6 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)/* set mb interrupt mask */ ixgbe_mb_intr_setup (eth_dev); - -return ; }void ixgbe_pf_host_uninit (struct rte_eth_dev *eth_dev)
@@ -220,7 +219,8 @@ int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)uint32_t vlanctrl;int i; -if (0 == (vf_num =dev_num_vf (eth_dev))) + vf_num =dev_num_vf (eth_dev); +if (vf_num ==0 )return -1 ;/* enable VMDq and set the default pool for PF */
@@ -280,19 +280,19 @@ int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev) }IXGBE_WRITE_REG (hw,IXGBE_GCR_EXT , gcr_ext); -IXGBE_WRITE_REG (hw,IXGBE_GPIE , gpie); +IXGBE_WRITE_REG (hw,IXGBE_GPIE , gpie); -/* +/* * enable vlan filtering and allow all vlan tags through */ - vlanctrl =IXGBE_READ_REG (hw,IXGBE_VLNCTRL ); - vlanctrl |=IXGBE_VLNCTRL_VFE ;/* enable vlan filters */ -IXGBE_WRITE_REG (hw,IXGBE_VLNCTRL , vlanctrl); + vlanctrl =IXGBE_READ_REG (hw,IXGBE_VLNCTRL ); + vlanctrl |=IXGBE_VLNCTRL_VFE ;/* enable vlan filters */ +IXGBE_WRITE_REG (hw,IXGBE_VLNCTRL , vlanctrl); -/* VFTA - enable all vlan filters */ -for (i =0 ; i <IXGBE_MAX_VFTA ; i++) { -IXGBE_WRITE_REG (hw,IXGBE_VFTA (i),0xFFFFFFFF ); - } +/* VFTA - enable all vlan filters */ +for (i =0 ; i <IXGBE_MAX_VFTA ; i++) { +IXGBE_WRITE_REG (hw,IXGBE_VFTA (i),0xFFFFFFFF ); + }/* Enable MAC Anti-Spoofing */ hw->mac.ops.set_mac_anti_spoofing (hw, FALSE, vf_num);
@@ -481,7 +481,7 @@ ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)int rar_entry = hw->mac.num_rar_entries - (vf +1 );uint8_t *new_mac = (uint8_t *)(&msgbuf[1 ]); -if (is_valid_assigned_ether_addr ((struct ether_addr *)new_mac)) { +if (is_valid_assigned_ether_addr ((struct ether_addr *)new_mac)) {rte_memcpy (vfinfo[vf].vf_mac_addresses, new_mac,6 );return hw->mac.ops.set_rar (hw, rar_entry, new_mac, vf,IXGBE_RAH_AV ); }
@@ -678,6 +678,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)/* perform VF reset */ if (msgbuf[0 ] ==IXGBE_VF_RESET ) {int ret =ixgbe_vf_reset (dev, vf, msgbuf); + vfinfo[vf].clear_to_send = true;return ret; }
drivers/net/ixgbe/ixgbe_rxtx.c +144 -140
671 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_rxtx_vec.c +21 -12
@@ -154,7 +154,8 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)/* pkt type + vlan olflags mask */ const __m128i pkttype_msk =_mm_set_epi16 (0x0000 ,0x0000 ,0x0000 ,0x0000 , -PKT_RX_VLAN_PKT ,PKT_RX_VLAN_PKT ,PKT_RX_VLAN_PKT ,PKT_RX_VLAN_PKT ); +PKT_RX_VLAN_PKT ,PKT_RX_VLAN_PKT , +PKT_RX_VLAN_PKT ,PKT_RX_VLAN_PKT );/* mask everything except rss type */ const __m128i rsstype_msk = _mm_set_epi16(
@@ -228,18 +229,21 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts, nb_pkts =RTE_ALIGN_FLOOR (nb_pkts,RTE_IXGBE_DESCS_PER_LOOP );/* Just the act of getting into the function from the application is -* going to cost about 7 cycles */ +* going to cost about 7 cycles +*/ rxdp = rxq->rx_ring + rxq->rx_tail;_mm_prefetch ((const void *)rxdp, _MM_HINT_T0);/* See if we need to rearm the RX queue - gives the prefetch a bit -* of time to act */ +* of time to act +*/ if (rxq->rxrearm_nb >RTE_IXGBE_RXQ_REARM_THRESH )ixgbe_rxq_rearm (rxq);/* Before we start moving massive data around, check to see if -* there is actually a packet available */ +* there is actually a packet available +*/ if (!(rxdp->wb.upper.status_error &rte_cpu_to_le_32 (IXGBE_RXDADV_STAT_DD )))return 0 ;
@@ -262,7 +266,8 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts, );/* Cache is empty -> need to scan the buffer rings, but first move -* the next 'n' mbufs into the cache */ +* the next 'n' mbufs into the cache +*/ sw_ring = &rxq->sw_ring[rxq->rx_tail];/* A. load 4 packet in one loop
@@ -359,7 +364,8 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,/* the staterr values are not in order, as the count * count of dd bits doesn't care. However, for end of * packet tracking, we do care, so shuffle. This also -* compresses the 32-bit values to 8-bit */ +* compresses the 32-bit values to 8-bit +*/ eop_bits =_mm_shuffle_epi8 (eop_bits, eop_shuf_mask);/* store the resulting 32-bit value */ *(int *)split_packet =_mm_cvtsi128_si32 (eop_bits);
@@ -416,12 +422,12 @@ ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,static inline uint16_t reassemble_packets (struct ixgbe_rx_queue *rxq,struct rte_mbuf **rx_bufs, -uint16_t nb_bufs,uint8_t *split_flags) +uint16_t nb_bufs,uint8_t *split_flags) {struct rte_mbuf *pkts[nb_bufs];/*finished pkts*/ struct rte_mbuf *start = rxq->pkt_first_seg;struct rte_mbuf *end = rxq->pkt_last_seg; -unsigned pkt_idx, buf_idx; +unsigned int pkt_idx, buf_idx;for (buf_idx =0 , pkt_idx =0 ; buf_idx < nb_bufs; buf_idx++) {if (end !=NULL ) {
@@ -535,6 +541,7 @@ vtx(volatile union ixgbe_adv_tx_desc *txdp, struct rte_mbuf **pkt, uint16_t nb_pkts, uint64_t flags) { int i; +for (i =0 ; i < nb_pkts; ++i, ++txdp, ++pkt)vtx1 (txdp, *pkt, flags); }
@@ -601,6 +608,7 @@ tx_backlog_entry(struct ixgbe_tx_entry_v *txep, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { int i; +for (i =0 ; i < (int )nb_pkts; ++i) txep[i].mbuf = tx_pkts[i]; }
@@ -675,7 +683,7 @@ ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,static void __attribute__((cold))ixgbe_tx_queue_release_mbufs_vec (struct ixgbe_tx_queue *txq) { -unsigned i; +unsigned int i;struct ixgbe_tx_entry_v *txe;const uint16_t max_desc = (uint16_t )(txq->nb_tx_desc -1 );
@@ -701,8 +709,8 @@ ixgbe_tx_queue_release_mbufs_vec(struct ixgbe_tx_queue *txq)void __attribute__((cold))ixgbe_rx_queue_release_mbufs_vec (struct ixgbe_rx_queue *rxq) { -const unsigned mask = rxq->nb_rx_desc -1 ; -unsigned i; +const unsigned int mask = rxq->nb_rx_desc -1 ; +unsigned int i;if (rxq->sw_ring ==NULL || rxq->rxrearm_nb >= rxq->nb_rx_desc)return ;
@@ -731,7 +739,7 @@ ixgbe_tx_free_swring(struct ixgbe_tx_queue *txq)static void __attribute__((cold))ixgbe_reset_tx_queue (struct ixgbe_tx_queue *txq) { -static const union ixgbe_adv_tx_desc zeroed_desc = {{0 }}; +static const union ixgbe_adv_tx_desc zeroed_desc = { {0 } };struct ixgbe_tx_entry_v *txe = txq->sw_ring_v;uint16_t i;
@@ -742,6 +750,7 @@ ixgbe_reset_tx_queue(struct ixgbe_tx_queue *txq)/* Initialize SW ring entries */ for (i =0 ; i < txq->nb_tx_desc; i++) {volatile union ixgbe_adv_tx_desc *txd = &txq->tx_ring[i]; + txd->wb.status =IXGBE_TXD_STAT_DD ; txe[i].mbuf =NULL ; }
Signature · 1 line
2.1.4
Hi,
Quoted 7 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Stephen Hemminger
Sent: Friday, April 8, 2016 7:45 AM
To: Zhang, Helin; Ananyev, Konstantin
Cc: [email protected]; Stephen Hemminger
Subject: [dpdk-dev] [PATCH] ixgbe: checkpatch cleanups
Quoted 5 lines
Run ixgbe driver through checkpatch and edit away all the nasty bits. Fix line spacing, some bad indentation, and in a couple of cases use short circuit (already there) return to lessen indentation.
Signed-off-by Stephen Hemminger <[email protected]>
Bruce Richardson
AppliedQuoted 10 lines · Wenzhuo
Hi,
Quoted 7 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Stephen Hemminger
Sent: Friday, April 8, 2016 7:45 AM
To: Zhang, Helin; Ananyev, Konstantin
Cc: [email protected]; Stephen Hemminger
Subject: [dpdk-dev] [PATCH] ixgbe: checkpatch cleanups
Quoted 6 lines
Quoted 5 lines
Run ixgbe driver through checkpatch and edit away all the nasty bits. Fix line spacing, some bad indentation, and in a couple of cases use short circuit (already there) return to lessen indentation.
Signed-off-by Stephen Hemminger <[email protected]>Acked-by Wenzhuo Lu <[email protected]>
Applied to dpdk-next-net/rel_16_07 with 4 additional checkpatch fixes included.
/Bruce