Skip to content

Commit 8336462

Browse files
committed
docs: net: use C syntax highlight in driver.rst
Use syntax highlight, comment out the "..." since they are not valid C. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent da4f0f8 commit 8336462

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

Documentation/networking/driver.rst

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,17 @@ there is no way your device can tell ahead of time when its
4343
transmit function will become busy.
4444

4545
Instead it must maintain the queue properly. For example,
46-
for a driver implementing scatter-gather this means::
46+
for a driver implementing scatter-gather this means:
47+
48+
.. code-block:: c
4749
4850
static netdev_tx_t drv_hard_start_xmit(struct sk_buff *skb,
4951
struct net_device *dev)
5052
{
5153
struct drv *dp = netdev_priv(dev);
5254
5355
lock_tx(dp);
54-
...
56+
//...
5557
/* This is a hard error log it. */
5658
if (TX_BUFFS_AVAIL(dp) <= (skb_shinfo(skb)->nr_frags + 1)) {
5759
netif_stop_queue(dev);
@@ -61,34 +63,42 @@ for a driver implementing scatter-gather this means::
6163
return NETDEV_TX_BUSY;
6264
}
6365
64-
... queue packet to card ...
65-
... update tx consumer index ...
66+
//... queue packet to card ...
67+
//... update tx consumer index ...
6668
6769
if (TX_BUFFS_AVAIL(dp) <= (MAX_SKB_FRAGS + 1))
6870
netif_stop_queue(dev);
6971
70-
...
72+
//...
7173
unlock_tx(dp);
72-
...
74+
//...
7375
return NETDEV_TX_OK;
7476
}
7577
76-
And then at the end of your TX reclamation event handling::
78+
And then at the end of your TX reclamation event handling:
79+
80+
.. code-block:: c
7781
7882
if (netif_queue_stopped(dp->dev) &&
7983
TX_BUFFS_AVAIL(dp) > (MAX_SKB_FRAGS + 1))
8084
netif_wake_queue(dp->dev);
8185
82-
For a non-scatter-gather supporting card, the three tests simply become::
86+
For a non-scatter-gather supporting card, the three tests simply become:
87+
88+
.. code-block:: c
8389
8490
/* This is a hard error log it. */
8591
if (TX_BUFFS_AVAIL(dp) <= 0)
8692
87-
and::
93+
and:
94+
95+
.. code-block:: c
8896
8997
if (TX_BUFFS_AVAIL(dp) == 0)
9098
91-
and::
99+
and:
100+
101+
.. code-block:: c
92102
93103
if (netif_queue_stopped(dp->dev) &&
94104
TX_BUFFS_AVAIL(dp) > 0)

0 commit comments

Comments
 (0)