Commit 7495ab68 authored by Glenn Streiff's avatar Glenn Streiff Committed by Roland Dreier

RDMA/nes: Formatting cleanup

Various cleanups:
	- Change // to /* .. */
	- Place whitespace around binary operators.
	- Trim down a few long lines.
	- Some minor alignment formatting for better readability.
	- Remove some silly tabs.
Signed-off-by: default avatarGlenn Streiff <gstreiff@neteffect.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 0e1de5d6
...@@ -594,7 +594,7 @@ static void nes_cm_timer_tick(unsigned long pass) ...@@ -594,7 +594,7 @@ static void nes_cm_timer_tick(unsigned long pass)
continue; continue;
} }
/* this seems like the correct place, but leave send entry unprotected */ /* this seems like the correct place, but leave send entry unprotected */
// spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags); /* spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags); */
atomic_inc(&send_entry->skb->users); atomic_inc(&send_entry->skb->users);
cm_packets_retrans++; cm_packets_retrans++;
nes_debug(NES_DBG_CM, "Retransmitting send_entry %p for node %p," nes_debug(NES_DBG_CM, "Retransmitting send_entry %p for node %p,"
...@@ -1335,7 +1335,7 @@ static int process_packet(struct nes_cm_node *cm_node, struct sk_buff *skb, ...@@ -1335,7 +1335,7 @@ static int process_packet(struct nes_cm_node *cm_node, struct sk_buff *skb,
cm_node->loc_addr, cm_node->loc_port, cm_node->loc_addr, cm_node->loc_port,
cm_node->rem_addr, cm_node->rem_port, cm_node->rem_addr, cm_node->rem_port,
cm_node->state, atomic_read(&cm_node->ref_count)); cm_node->state, atomic_read(&cm_node->ref_count));
// create event /* create event */
cm_node->state = NES_CM_STATE_CLOSED; cm_node->state = NES_CM_STATE_CLOSED;
create_event(cm_node, NES_CM_EVENT_ABORTED); create_event(cm_node, NES_CM_EVENT_ABORTED);
...@@ -1669,7 +1669,7 @@ static struct nes_cm_node *mini_cm_connect(struct nes_cm_core *cm_core, ...@@ -1669,7 +1669,7 @@ static struct nes_cm_node *mini_cm_connect(struct nes_cm_core *cm_core,
if (!cm_node) if (!cm_node)
return NULL; return NULL;
// set our node side to client (active) side /* set our node side to client (active) side */
cm_node->tcp_cntxt.client = 1; cm_node->tcp_cntxt.client = 1;
cm_node->tcp_cntxt.rcv_wscale = NES_CM_DEFAULT_RCV_WND_SCALE; cm_node->tcp_cntxt.rcv_wscale = NES_CM_DEFAULT_RCV_WND_SCALE;
...@@ -1694,7 +1694,7 @@ static struct nes_cm_node *mini_cm_connect(struct nes_cm_core *cm_core, ...@@ -1694,7 +1694,7 @@ static struct nes_cm_node *mini_cm_connect(struct nes_cm_core *cm_core,
loopbackremotenode->mpa_frame_size = mpa_frame_size - loopbackremotenode->mpa_frame_size = mpa_frame_size -
sizeof(struct ietf_mpa_frame); sizeof(struct ietf_mpa_frame);
// we are done handling this state, set node to a TSA state /* we are done handling this state, set node to a TSA state */
cm_node->state = NES_CM_STATE_TSA; cm_node->state = NES_CM_STATE_TSA;
cm_node->tcp_cntxt.rcv_nxt = loopbackremotenode->tcp_cntxt.loc_seq_num; cm_node->tcp_cntxt.rcv_nxt = loopbackremotenode->tcp_cntxt.loc_seq_num;
loopbackremotenode->tcp_cntxt.rcv_nxt = cm_node->tcp_cntxt.loc_seq_num; loopbackremotenode->tcp_cntxt.rcv_nxt = cm_node->tcp_cntxt.loc_seq_num;
......
This diff is collapsed.
...@@ -969,7 +969,7 @@ struct nes_arp_entry { ...@@ -969,7 +969,7 @@ struct nes_arp_entry {
#define NES_NIC_CQ_DOWNWARD_TREND 16 #define NES_NIC_CQ_DOWNWARD_TREND 16
struct nes_hw_tune_timer { struct nes_hw_tune_timer {
//u16 cq_count; /* u16 cq_count; */
u16 threshold_low; u16 threshold_low;
u16 threshold_target; u16 threshold_target;
u16 threshold_high; u16 threshold_high;
......
...@@ -185,12 +185,13 @@ static int nes_netdev_open(struct net_device *netdev) ...@@ -185,12 +185,13 @@ static int nes_netdev_open(struct net_device *netdev)
nic_active |= nic_active_bit; nic_active |= nic_active_bit;
nes_write_indexed(nesdev, NES_IDX_NIC_BROADCAST_ON, nic_active); nes_write_indexed(nesdev, NES_IDX_NIC_BROADCAST_ON, nic_active);
macaddr_high = ((u16)netdev->dev_addr[0]) << 8; macaddr_high = ((u16)netdev->dev_addr[0]) << 8;
macaddr_high += (u16)netdev->dev_addr[1]; macaddr_high += (u16)netdev->dev_addr[1];
macaddr_low = ((u32)netdev->dev_addr[2]) << 24;
macaddr_low += ((u32)netdev->dev_addr[3]) << 16; macaddr_low = ((u32)netdev->dev_addr[2]) << 24;
macaddr_low += ((u32)netdev->dev_addr[4]) << 8; macaddr_low += ((u32)netdev->dev_addr[3]) << 16;
macaddr_low += (u32)netdev->dev_addr[5]; macaddr_low += ((u32)netdev->dev_addr[4]) << 8;
macaddr_low += (u32)netdev->dev_addr[5];
/* Program the various MAC regs */ /* Program the various MAC regs */
for (i = 0; i < NES_MAX_PORT_COUNT; i++) { for (i = 0; i < NES_MAX_PORT_COUNT; i++) {
...@@ -451,7 +452,7 @@ static int nes_netdev_start_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -451,7 +452,7 @@ static int nes_netdev_start_xmit(struct sk_buff *skb, struct net_device *netdev)
__le16 *wqe_fragment_length; __le16 *wqe_fragment_length;
u32 nr_frags; u32 nr_frags;
u32 original_first_length; u32 original_first_length;
// u64 *wqe_fragment_address; /* u64 *wqe_fragment_address; */
/* first fragment (0) is used by copy buffer */ /* first fragment (0) is used by copy buffer */
u16 wqe_fragment_index=1; u16 wqe_fragment_index=1;
u16 hoffset; u16 hoffset;
...@@ -461,11 +462,12 @@ static int nes_netdev_start_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -461,11 +462,12 @@ static int nes_netdev_start_xmit(struct sk_buff *skb, struct net_device *netdev)
u32 old_head; u32 old_head;
u32 wqe_misc; u32 wqe_misc;
/* nes_debug(NES_DBG_NIC_TX, "%s Request to tx NIC packet length %u, headlen %u," /*
" (%u frags), tso_size=%u\n", * nes_debug(NES_DBG_NIC_TX, "%s Request to tx NIC packet length %u, headlen %u,"
netdev->name, skb->len, skb_headlen(skb), * " (%u frags), tso_size=%u\n",
skb_shinfo(skb)->nr_frags, skb_is_gso(skb)); * netdev->name, skb->len, skb_headlen(skb),
*/ * skb_shinfo(skb)->nr_frags, skb_is_gso(skb));
*/
if (!netif_carrier_ok(netdev)) if (!netif_carrier_ok(netdev))
return NETDEV_TX_OK; return NETDEV_TX_OK;
...@@ -795,12 +797,12 @@ static int nes_netdev_set_mac_address(struct net_device *netdev, void *p) ...@@ -795,12 +797,12 @@ static int nes_netdev_set_mac_address(struct net_device *netdev, void *p)
memcpy(netdev->dev_addr, mac_addr->sa_data, netdev->addr_len); memcpy(netdev->dev_addr, mac_addr->sa_data, netdev->addr_len);
printk(PFX "%s: Address length = %d, Address = %s\n", printk(PFX "%s: Address length = %d, Address = %s\n",
__func__, netdev->addr_len, print_mac(mac, mac_addr->sa_data)); __func__, netdev->addr_len, print_mac(mac, mac_addr->sa_data));
macaddr_high = ((u16)netdev->dev_addr[0]) << 8; macaddr_high = ((u16)netdev->dev_addr[0]) << 8;
macaddr_high += (u16)netdev->dev_addr[1]; macaddr_high += (u16)netdev->dev_addr[1];
macaddr_low = ((u32)netdev->dev_addr[2]) << 24; macaddr_low = ((u32)netdev->dev_addr[2]) << 24;
macaddr_low += ((u32)netdev->dev_addr[3]) << 16; macaddr_low += ((u32)netdev->dev_addr[3]) << 16;
macaddr_low += ((u32)netdev->dev_addr[4]) << 8; macaddr_low += ((u32)netdev->dev_addr[4]) << 8;
macaddr_low += (u32)netdev->dev_addr[5]; macaddr_low += (u32)netdev->dev_addr[5];
for (i = 0; i < NES_MAX_PORT_COUNT; i++) { for (i = 0; i < NES_MAX_PORT_COUNT; i++) {
if (nesvnic->qp_nic_index[i] == 0xf) { if (nesvnic->qp_nic_index[i] == 0xf) {
...@@ -881,12 +883,12 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev) ...@@ -881,12 +883,12 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev)
print_mac(mac, multicast_addr->dmi_addr), print_mac(mac, multicast_addr->dmi_addr),
perfect_filter_register_address+(mc_index * 8), perfect_filter_register_address+(mc_index * 8),
mc_nic_index); mc_nic_index);
macaddr_high = ((u16)multicast_addr->dmi_addr[0]) << 8; macaddr_high = ((u16)multicast_addr->dmi_addr[0]) << 8;
macaddr_high += (u16)multicast_addr->dmi_addr[1]; macaddr_high += (u16)multicast_addr->dmi_addr[1];
macaddr_low = ((u32)multicast_addr->dmi_addr[2]) << 24; macaddr_low = ((u32)multicast_addr->dmi_addr[2]) << 24;
macaddr_low += ((u32)multicast_addr->dmi_addr[3]) << 16; macaddr_low += ((u32)multicast_addr->dmi_addr[3]) << 16;
macaddr_low += ((u32)multicast_addr->dmi_addr[4]) << 8; macaddr_low += ((u32)multicast_addr->dmi_addr[4]) << 8;
macaddr_low += (u32)multicast_addr->dmi_addr[5]; macaddr_low += (u32)multicast_addr->dmi_addr[5];
nes_write_indexed(nesdev, nes_write_indexed(nesdev,
perfect_filter_register_address+(mc_index * 8), perfect_filter_register_address+(mc_index * 8),
macaddr_low); macaddr_low);
...@@ -910,23 +912,23 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev) ...@@ -910,23 +912,23 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev)
/** /**
* nes_netdev_change_mtu * nes_netdev_change_mtu
*/ */
static int nes_netdev_change_mtu(struct net_device *netdev, int new_mtu) static int nes_netdev_change_mtu(struct net_device *netdev, int new_mtu)
{ {
struct nes_vnic *nesvnic = netdev_priv(netdev); struct nes_vnic *nesvnic = netdev_priv(netdev);
struct nes_device *nesdev = nesvnic->nesdev; struct nes_device *nesdev = nesvnic->nesdev;
int ret = 0; int ret = 0;
u8 jumbomode=0; u8 jumbomode = 0;
if ((new_mtu < ETH_ZLEN) || (new_mtu > max_mtu)) if ((new_mtu < ETH_ZLEN) || (new_mtu > max_mtu))
return -EINVAL; return -EINVAL;
netdev->mtu = new_mtu; netdev->mtu = new_mtu;
nesvnic->max_frame_size = new_mtu + VLAN_ETH_HLEN; nesvnic->max_frame_size = new_mtu + VLAN_ETH_HLEN;
if (netdev->mtu > 1500) { if (netdev->mtu > 1500) {
jumbomode=1; jumbomode=1;
} }
nes_nic_init_timer_defaults(nesdev, jumbomode); nes_nic_init_timer_defaults(nesdev, jumbomode);
if (netif_running(netdev)) { if (netif_running(netdev)) {
nes_netdev_stop(netdev); nes_netdev_stop(netdev);
...@@ -1225,14 +1227,14 @@ static int nes_netdev_set_coalesce(struct net_device *netdev, ...@@ -1225,14 +1227,14 @@ static int nes_netdev_set_coalesce(struct net_device *netdev,
struct ethtool_coalesce *et_coalesce) struct ethtool_coalesce *et_coalesce)
{ {
struct nes_vnic *nesvnic = netdev_priv(netdev); struct nes_vnic *nesvnic = netdev_priv(netdev);
struct nes_device *nesdev = nesvnic->nesdev; struct nes_device *nesdev = nesvnic->nesdev;
struct nes_adapter *nesadapter = nesdev->nesadapter; struct nes_adapter *nesadapter = nesdev->nesadapter;
struct nes_hw_tune_timer *shared_timer = &nesadapter->tune_timer; struct nes_hw_tune_timer *shared_timer = &nesadapter->tune_timer;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&nesadapter->periodic_timer_lock, flags); spin_lock_irqsave(&nesadapter->periodic_timer_lock, flags);
if (et_coalesce->rx_max_coalesced_frames_low) { if (et_coalesce->rx_max_coalesced_frames_low) {
shared_timer->threshold_low = et_coalesce->rx_max_coalesced_frames_low; shared_timer->threshold_low = et_coalesce->rx_max_coalesced_frames_low;
} }
if (et_coalesce->rx_max_coalesced_frames_irq) { if (et_coalesce->rx_max_coalesced_frames_irq) {
shared_timer->threshold_target = et_coalesce->rx_max_coalesced_frames_irq; shared_timer->threshold_target = et_coalesce->rx_max_coalesced_frames_irq;
...@@ -1252,14 +1254,14 @@ static int nes_netdev_set_coalesce(struct net_device *netdev, ...@@ -1252,14 +1254,14 @@ static int nes_netdev_set_coalesce(struct net_device *netdev,
nesadapter->et_rx_coalesce_usecs_irq = et_coalesce->rx_coalesce_usecs_irq; nesadapter->et_rx_coalesce_usecs_irq = et_coalesce->rx_coalesce_usecs_irq;
if (et_coalesce->use_adaptive_rx_coalesce) { if (et_coalesce->use_adaptive_rx_coalesce) {
nesadapter->et_use_adaptive_rx_coalesce = 1; nesadapter->et_use_adaptive_rx_coalesce = 1;
nesadapter->timer_int_limit = NES_TIMER_INT_LIMIT_DYNAMIC; nesadapter->timer_int_limit = NES_TIMER_INT_LIMIT_DYNAMIC;
nesadapter->et_rx_coalesce_usecs_irq = 0; nesadapter->et_rx_coalesce_usecs_irq = 0;
if (et_coalesce->pkt_rate_low) { if (et_coalesce->pkt_rate_low) {
nesadapter->et_pkt_rate_low = et_coalesce->pkt_rate_low; nesadapter->et_pkt_rate_low = et_coalesce->pkt_rate_low;
} }
} else { } else {
nesadapter->et_use_adaptive_rx_coalesce = 0; nesadapter->et_use_adaptive_rx_coalesce = 0;
nesadapter->timer_int_limit = NES_TIMER_INT_LIMIT; nesadapter->timer_int_limit = NES_TIMER_INT_LIMIT;
if (nesadapter->et_rx_coalesce_usecs_irq) { if (nesadapter->et_rx_coalesce_usecs_irq) {
nes_write32(nesdev->regs+NES_PERIODIC_CONTROL, nes_write32(nesdev->regs+NES_PERIODIC_CONTROL,
0x80000000 | ((u32)(nesadapter->et_rx_coalesce_usecs_irq*8))); 0x80000000 | ((u32)(nesadapter->et_rx_coalesce_usecs_irq*8)));
...@@ -1276,28 +1278,28 @@ static int nes_netdev_get_coalesce(struct net_device *netdev, ...@@ -1276,28 +1278,28 @@ static int nes_netdev_get_coalesce(struct net_device *netdev,
struct ethtool_coalesce *et_coalesce) struct ethtool_coalesce *et_coalesce)
{ {
struct nes_vnic *nesvnic = netdev_priv(netdev); struct nes_vnic *nesvnic = netdev_priv(netdev);
struct nes_device *nesdev = nesvnic->nesdev; struct nes_device *nesdev = nesvnic->nesdev;
struct nes_adapter *nesadapter = nesdev->nesadapter; struct nes_adapter *nesadapter = nesdev->nesadapter;
struct ethtool_coalesce temp_et_coalesce; struct ethtool_coalesce temp_et_coalesce;
struct nes_hw_tune_timer *shared_timer = &nesadapter->tune_timer; struct nes_hw_tune_timer *shared_timer = &nesadapter->tune_timer;
unsigned long flags; unsigned long flags;
memset(&temp_et_coalesce, 0, sizeof(temp_et_coalesce)); memset(&temp_et_coalesce, 0, sizeof(temp_et_coalesce));
temp_et_coalesce.rx_coalesce_usecs_irq = nesadapter->et_rx_coalesce_usecs_irq; temp_et_coalesce.rx_coalesce_usecs_irq = nesadapter->et_rx_coalesce_usecs_irq;
temp_et_coalesce.use_adaptive_rx_coalesce = nesadapter->et_use_adaptive_rx_coalesce; temp_et_coalesce.use_adaptive_rx_coalesce = nesadapter->et_use_adaptive_rx_coalesce;
temp_et_coalesce.rate_sample_interval = nesadapter->et_rate_sample_interval; temp_et_coalesce.rate_sample_interval = nesadapter->et_rate_sample_interval;
temp_et_coalesce.pkt_rate_low = nesadapter->et_pkt_rate_low; temp_et_coalesce.pkt_rate_low = nesadapter->et_pkt_rate_low;
spin_lock_irqsave(&nesadapter->periodic_timer_lock, flags); spin_lock_irqsave(&nesadapter->periodic_timer_lock, flags);
temp_et_coalesce.rx_max_coalesced_frames_low = shared_timer->threshold_low; temp_et_coalesce.rx_max_coalesced_frames_low = shared_timer->threshold_low;
temp_et_coalesce.rx_max_coalesced_frames_irq = shared_timer->threshold_target; temp_et_coalesce.rx_max_coalesced_frames_irq = shared_timer->threshold_target;
temp_et_coalesce.rx_max_coalesced_frames_high = shared_timer->threshold_high; temp_et_coalesce.rx_max_coalesced_frames_high = shared_timer->threshold_high;
temp_et_coalesce.rx_coalesce_usecs_low = shared_timer->timer_in_use_min; temp_et_coalesce.rx_coalesce_usecs_low = shared_timer->timer_in_use_min;
temp_et_coalesce.rx_coalesce_usecs_high = shared_timer->timer_in_use_max; temp_et_coalesce.rx_coalesce_usecs_high = shared_timer->timer_in_use_max;
if (nesadapter->et_use_adaptive_rx_coalesce) { if (nesadapter->et_use_adaptive_rx_coalesce) {
temp_et_coalesce.rx_coalesce_usecs_irq = shared_timer->timer_in_use; temp_et_coalesce.rx_coalesce_usecs_irq = shared_timer->timer_in_use;
} }
spin_unlock_irqrestore(&nesadapter->periodic_timer_lock, flags); spin_unlock_irqrestore(&nesadapter->periodic_timer_lock, flags);
memcpy(et_coalesce, &temp_et_coalesce, sizeof(*et_coalesce)); memcpy(et_coalesce, &temp_et_coalesce, sizeof(*et_coalesce));
return 0; return 0;
} }
...@@ -1376,7 +1378,7 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd ...@@ -1376,7 +1378,7 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd
u16 phy_data; u16 phy_data;
et_cmd->duplex = DUPLEX_FULL; et_cmd->duplex = DUPLEX_FULL;
et_cmd->port = PORT_MII; et_cmd->port = PORT_MII;
if (nesadapter->OneG_Mode) { if (nesadapter->OneG_Mode) {
et_cmd->speed = SPEED_1000; et_cmd->speed = SPEED_1000;
...@@ -1401,13 +1403,13 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd ...@@ -1401,13 +1403,13 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd
if ((nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_IRIS) || if ((nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_IRIS) ||
(nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_ARGUS)) { (nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_ARGUS)) {
et_cmd->transceiver = XCVR_EXTERNAL; et_cmd->transceiver = XCVR_EXTERNAL;
et_cmd->port = PORT_FIBRE; et_cmd->port = PORT_FIBRE;
et_cmd->supported = SUPPORTED_FIBRE; et_cmd->supported = SUPPORTED_FIBRE;
et_cmd->advertising = ADVERTISED_FIBRE; et_cmd->advertising = ADVERTISED_FIBRE;
et_cmd->phy_address = nesadapter->phy_index[nesdev->mac_index]; et_cmd->phy_address = nesadapter->phy_index[nesdev->mac_index];
} else { } else {
et_cmd->transceiver = XCVR_INTERNAL; et_cmd->transceiver = XCVR_INTERNAL;
et_cmd->supported = SUPPORTED_10000baseT_Full; et_cmd->supported = SUPPORTED_10000baseT_Full;
et_cmd->advertising = ADVERTISED_10000baseT_Full; et_cmd->advertising = ADVERTISED_10000baseT_Full;
et_cmd->phy_address = nesdev->mac_index; et_cmd->phy_address = nesdev->mac_index;
} }
...@@ -1438,7 +1440,7 @@ static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd ...@@ -1438,7 +1440,7 @@ static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd
/* Turn on Full duplex, Autoneg, and restart autonegotiation */ /* Turn on Full duplex, Autoneg, and restart autonegotiation */
phy_data |= 0x1300; phy_data |= 0x1300;
} else { } else {
// Turn off autoneg /* Turn off autoneg */
phy_data &= ~0x1000; phy_data &= ~0x1000;
} }
nes_write_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index], nes_write_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index],
......
...@@ -1266,7 +1266,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd, ...@@ -1266,7 +1266,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
sq_size = init_attr->cap.max_send_wr; sq_size = init_attr->cap.max_send_wr;
rq_size = init_attr->cap.max_recv_wr; rq_size = init_attr->cap.max_recv_wr;
// check if the encoded sizes are OK or not... /* check if the encoded sizes are OK or not... */
sq_encoded_size = nes_get_encoded_size(&sq_size); sq_encoded_size = nes_get_encoded_size(&sq_size);
rq_encoded_size = nes_get_encoded_size(&rq_size); rq_encoded_size = nes_get_encoded_size(&rq_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment