@@ -2634,6 +2634,18 @@ static int qeth_init_input_buffer(struct qeth_card *card,
2634
2634
return 0 ;
2635
2635
}
2636
2636
2637
+ static unsigned int qeth_tx_select_bulk_max (struct qeth_card * card ,
2638
+ struct qeth_qdio_out_q * queue )
2639
+ {
2640
+ if (!IS_IQD (card ) ||
2641
+ qeth_iqd_is_mcast_queue (card , queue ) ||
2642
+ card -> options .cq == QETH_CQ_ENABLED ||
2643
+ qdio_get_ssqd_desc (CARD_DDEV (card ), & card -> ssqd ))
2644
+ return 1 ;
2645
+
2646
+ return card -> ssqd .mmwc ? card -> ssqd .mmwc : 1 ;
2647
+ }
2648
+
2637
2649
int qeth_init_qdio_queues (struct qeth_card * card )
2638
2650
{
2639
2651
unsigned int i ;
@@ -2673,6 +2685,8 @@ int qeth_init_qdio_queues(struct qeth_card *card)
2673
2685
queue -> do_pack = 0 ;
2674
2686
queue -> prev_hdr = NULL ;
2675
2687
queue -> bulk_start = 0 ;
2688
+ queue -> bulk_count = 0 ;
2689
+ queue -> bulk_max = qeth_tx_select_bulk_max (card , queue );
2676
2690
atomic_set (& queue -> used_buffers , 0 );
2677
2691
atomic_set (& queue -> set_pci_flags_count , 0 );
2678
2692
atomic_set (& queue -> state , QETH_OUT_Q_UNLOCKED );
@@ -3318,10 +3332,11 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index,
3318
3332
3319
3333
static void qeth_flush_queue (struct qeth_qdio_out_q * queue )
3320
3334
{
3321
- qeth_flush_buffers (queue , queue -> bulk_start , 1 );
3335
+ qeth_flush_buffers (queue , queue -> bulk_start , queue -> bulk_count );
3322
3336
3323
- queue -> bulk_start = QDIO_BUFNR (queue -> bulk_start + 1 );
3337
+ queue -> bulk_start = QDIO_BUFNR (queue -> bulk_start + queue -> bulk_count );
3324
3338
queue -> prev_hdr = NULL ;
3339
+ queue -> bulk_count = 0 ;
3325
3340
}
3326
3341
3327
3342
static void qeth_check_outbound_queue (struct qeth_qdio_out_q * queue )
@@ -3680,10 +3695,10 @@ static int qeth_add_hw_header(struct qeth_qdio_out_q *queue,
3680
3695
}
3681
3696
3682
3697
static bool qeth_iqd_may_bulk (struct qeth_qdio_out_q * queue ,
3683
- struct qeth_qdio_out_buffer * buffer ,
3684
3698
struct sk_buff * curr_skb ,
3685
3699
struct qeth_hdr * curr_hdr )
3686
3700
{
3701
+ struct qeth_qdio_out_buffer * buffer = queue -> bufs [queue -> bulk_start ];
3687
3702
struct qeth_hdr * prev_hdr = queue -> prev_hdr ;
3688
3703
3689
3704
if (!prev_hdr )
@@ -3803,13 +3818,14 @@ static int __qeth_xmit(struct qeth_card *card, struct qeth_qdio_out_q *queue,
3803
3818
struct qeth_hdr * hdr , unsigned int offset ,
3804
3819
unsigned int hd_len )
3805
3820
{
3806
- struct qeth_qdio_out_buffer * buffer = queue -> bufs [queue -> bulk_start ];
3807
3821
unsigned int bytes = qdisc_pkt_len (skb );
3822
+ struct qeth_qdio_out_buffer * buffer ;
3808
3823
unsigned int next_element ;
3809
3824
struct netdev_queue * txq ;
3810
3825
bool stopped = false;
3811
3826
bool flush ;
3812
3827
3828
+ buffer = queue -> bufs [QDIO_BUFNR (queue -> bulk_start + queue -> bulk_count )];
3813
3829
txq = netdev_get_tx_queue (card -> dev , skb_get_queue_mapping (skb ));
3814
3830
3815
3831
/* Just a sanity check, the wake/stop logic should ensure that we always
@@ -3818,11 +3834,23 @@ static int __qeth_xmit(struct qeth_card *card, struct qeth_qdio_out_q *queue,
3818
3834
if (atomic_read (& buffer -> state ) != QETH_QDIO_BUF_EMPTY )
3819
3835
return - EBUSY ;
3820
3836
3821
- if ((buffer -> next_element_to_fill + elements > queue -> max_elements ) ||
3822
- !qeth_iqd_may_bulk (queue , buffer , skb , hdr )) {
3823
- atomic_set (& buffer -> state , QETH_QDIO_BUF_PRIMED );
3824
- qeth_flush_queue (queue );
3825
- buffer = queue -> bufs [queue -> bulk_start ];
3837
+ flush = !qeth_iqd_may_bulk (queue , skb , hdr );
3838
+
3839
+ if (flush ||
3840
+ (buffer -> next_element_to_fill + elements > queue -> max_elements )) {
3841
+ if (buffer -> next_element_to_fill > 0 ) {
3842
+ atomic_set (& buffer -> state , QETH_QDIO_BUF_PRIMED );
3843
+ queue -> bulk_count ++ ;
3844
+ }
3845
+
3846
+ if (queue -> bulk_count >= queue -> bulk_max )
3847
+ flush = true;
3848
+
3849
+ if (flush )
3850
+ qeth_flush_queue (queue );
3851
+
3852
+ buffer = queue -> bufs [QDIO_BUFNR (queue -> bulk_start +
3853
+ queue -> bulk_count )];
3826
3854
3827
3855
/* Sanity-check again: */
3828
3856
if (atomic_read (& buffer -> state ) != QETH_QDIO_BUF_EMPTY )
@@ -3848,7 +3876,13 @@ static int __qeth_xmit(struct qeth_card *card, struct qeth_qdio_out_q *queue,
3848
3876
3849
3877
if (flush || next_element >= queue -> max_elements ) {
3850
3878
atomic_set (& buffer -> state , QETH_QDIO_BUF_PRIMED );
3851
- qeth_flush_queue (queue );
3879
+ queue -> bulk_count ++ ;
3880
+
3881
+ if (queue -> bulk_count >= queue -> bulk_max )
3882
+ flush = true;
3883
+
3884
+ if (flush )
3885
+ qeth_flush_queue (queue );
3852
3886
}
3853
3887
3854
3888
if (stopped && !qeth_out_queue_is_full (queue ))
0 commit comments