History

can: kvaser_pciefd: Use TX FIFO size read from CAN controller

Use the TX FIFO size read from CAN controller register, instead of using hard coded value.

Jimmy Assarsson committed 3 years ago

Commit 6fdcd641 parent f4845741 file · +3 −12Browse files

Unified · Split

drivers/net/can/kvaser_pciefd.c+3−12
@@ -658,8 +658,7 @@ static netdev_tx_t kvaser_pciefd_start_xmit(struct sk_buff *skb, · 657 unmodified lines
658658 /* No room for a new message, stop the queue until at least one
659659 * successful transmit
660660 */
661− if (count >= KVASER_PCIEFD_CAN_TX_MAX_COUNT ||
662− can->can.echo_skb[can->echo_idx])
661+ if (count >= can->can.echo_skb_max || can->can.echo_skb[can->echo_idx])
663662 netif_stop_queue(netdev);
664663 spin_unlock_irqrestore(&can->echo_lock, irq_flags);
665664
@@ -802,16 +801,9 @@ static int kvaser_pciefd_setup_can_ctrls(struct kvaser_pciefd *pcie) · 136 unmodified lines
802801 tx_nr_packets_max =
803802 FIELD_GET(KVASER_PCIEFD_KCAN_TX_NR_PACKETS_MAX_MASK,
804803 ioread32(can->reg_base + KVASER_PCIEFD_KCAN_TX_NR_PACKETS_REG));
805− if (tx_nr_packets_max < KVASER_PCIEFD_CAN_TX_MAX_COUNT) {
806− dev_err(&pcie->pci->dev,
807− "Max Tx count is smaller than expected\n");
808−
809− free_candev(netdev);
810− return -ENODEV;
811− }
812804
813805 can->can.clock.freq = pcie->freq;
814− can->can.echo_skb_max = KVASER_PCIEFD_CAN_TX_MAX_COUNT;
806+ can->can.echo_skb_max = min(KVASER_PCIEFD_CAN_TX_MAX_COUNT, tx_nr_packets_max - 1);
815807 can->echo_idx = 0;
816808 spin_lock_init(&can->echo_lock);
817809 spin_lock_init(&can->lock);
@@ -1311,8 +1303,7 @@ static int kvaser_pciefd_handle_ack_packet(struct kvaser_pciefd *pcie, · 493 unmodified lines
13111303 count = FIELD_GET(KVASER_PCIEFD_KCAN_TX_NR_PACKETS_CURRENT_MASK,
13121304 ioread32(can->reg_base + KVASER_PCIEFD_KCAN_TX_NR_PACKETS_REG));
13131305
1314− if (count < KVASER_PCIEFD_CAN_TX_MAX_COUNT &&
1315− netif_queue_stopped(can->can.dev))
1306+ if (count < can->can.echo_skb_max && netif_queue_stopped(can->can.dev))
13161307 netif_wake_queue(can->can.dev);
13171308
13181309 if (!one_shot_fail) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t