Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple PCIe FMC carrier SPEC - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Simple PCIe FMC carrier SPEC - Software
Commits
106fcb76
Commit
106fcb76
authored
Feb 28, 2017
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel:wr-nic: checkpatch cleanup
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
7499f529
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
45 deletions
+47
-45
device.c
kernel/wr_nic/device.c
+12
-8
endpoint.c
kernel/wr_nic/endpoint.c
+12
-14
ethtool.c
kernel/wr_nic/ethtool.c
+1
-1
nic-core.c
kernel/wr_nic/nic-core.c
+16
-17
timestamp.c
kernel/wr_nic/timestamp.c
+6
-5
No files found.
kernel/wr_nic/device.c
View file @
106fcb76
...
@@ -59,6 +59,7 @@ static int wrn_remove(struct platform_device *pdev)
...
@@ -59,6 +59,7 @@ static int wrn_remove(struct platform_device *pdev)
/* Unregister all interrupts that were registered */
/* Unregister all interrupts that were registered */
for
(
i
=
0
;
wrn
->
irq_registered
;
i
++
)
{
for
(
i
=
0
;
wrn
->
irq_registered
;
i
++
)
{
static
int
irqs
[]
=
WRN_IRQ_NUMBERS
;
static
int
irqs
[]
=
WRN_IRQ_NUMBERS
;
if
(
wrn
->
irq_registered
&
(
1
<<
i
))
if
(
wrn
->
irq_registered
&
(
1
<<
i
))
free_irq
(
irqs
[
i
],
wrn
);
free_irq
(
irqs
[
i
],
wrn
);
wrn
->
irq_registered
&=
~
(
1
<<
i
);
wrn
->
irq_registered
&=
~
(
1
<<
i
);
...
@@ -119,13 +120,14 @@ static int wrn_probe(struct platform_device *pdev)
...
@@ -119,13 +120,14 @@ static int wrn_probe(struct platform_device *pdev)
if (++wrn->use_count != 1) {
if (++wrn->use_count != 1) {
--wrn->use_count;
--wrn->use_count;
spin_unlock(&wrn->lock);
spin_unlock(&wrn->lock);
printk(
"use count %i\n", wrn->use_count);
dev_err(&pdev->dev,
"use count %i\n", wrn->use_count);
return -EBUSY;
return -EBUSY;
}
}
spin_unlock(&wrn->lock);
spin_unlock(&wrn->lock);
#endif
#endif
/* Map our resource list and instantiate the shortcut pointers */
/* Map our resource list and instantiate the shortcut pointers */
if
(
(
err
=
__wrn_map_resources
(
pdev
))
)
err
=
__wrn_map_resources
(
pdev
);
if
(
err
)
goto
out
;
goto
out
;
wrn
->
regs
=
wrn
->
bases
[
WRN_FB_NIC
];
wrn
->
regs
=
wrn
->
bases
[
WRN_FB_NIC
];
wrn
->
txtsu_regs
=
wrn
->
bases
[
WRN_FB_TS
];
wrn
->
txtsu_regs
=
wrn
->
bases
[
WRN_FB_TS
];
...
@@ -135,15 +137,16 @@ static int wrn_probe(struct platform_device *pdev)
...
@@ -135,15 +137,16 @@ static int wrn_probe(struct platform_device *pdev)
wrn
->
databuf
=
(
void
*
)
wrn
->
regs
+
offsetof
(
struct
NIC_WB
,
MEM
);
wrn
->
databuf
=
(
void
*
)
wrn
->
regs
+
offsetof
(
struct
NIC_WB
,
MEM
);
tasklet_init
(
&
wrn
->
rx_tlet
,
wrn_rx_interrupt
,
(
unsigned
long
)
wrn
);
tasklet_init
(
&
wrn
->
rx_tlet
,
wrn_rx_interrupt
,
(
unsigned
long
)
wrn
);
if
(
0
)
if
(
0
)
printk
(
"regs %p, txd %p, rxd %p, buffer %p
\n
"
,
dev_info
(
&
pdev
->
dev
,
"regs %p, txd %p, rxd %p, buffer %p
\n
"
,
wrn
->
regs
,
wrn
->
txd
,
wrn
->
rxd
,
wrn
->
databuf
);
wrn
->
regs
,
wrn
->
txd
,
wrn
->
rxd
,
wrn
->
databuf
);
#if 0
#if 0
/* Register the interrupt handlers (not shared) */
/* Register the interrupt handlers (not shared) */
for (i = 0; i < ARRAY_SIZE(irq_names); i++) {
for (i = 0; i < ARRAY_SIZE(irq_names); i++) {
err = request_irq(irqs[i], irq_handlers[i],
err = request_irq(irqs[i], irq_handlers[i],
IRQF_TRIGGER_LOW, irq_names[i], wrn);
IRQF_TRIGGER_LOW, irq_names[i], wrn);
if (err) goto out;
if (err)
goto out;
wrn->irq_registered |= 1 << i;
wrn->irq_registered |= 1 << i;
}
}
#endif
#endif
...
@@ -181,14 +184,15 @@ static int wrn_probe(struct platform_device *pdev)
...
@@ -181,14 +184,15 @@ static int wrn_probe(struct platform_device *pdev)
wrn
->
dev
[
i
]
=
netdev
;
wrn
->
dev
[
i
]
=
netdev
;
err
=
wrn_mezzanine_init
(
netdev
);
err
=
wrn_mezzanine_init
(
netdev
);
if
(
err
)
if
(
err
)
dev_err
(
&
pdev
->
dev
,
"Init mezzanine code: "
dev_err
(
&
pdev
->
dev
,
"
error %i
\n
"
,
err
);
"Init mezzanine code:
error %i
\n
"
,
err
);
}
}
if
(
i
==
0
)
if
(
i
==
0
)
return
-
ENODEV
;
/* no endpoints */
return
-
ENODEV
;
/* no endpoints */
for
(
i
=
0
;
i
<
WRN_NR_TXDESC
;
i
++
)
{
/* Clear all tx descriptors */
for
(
i
=
0
;
i
<
WRN_NR_TXDESC
;
i
++
)
{
/* Clear all tx descriptors */
struct
wrn_txd
*
tx
;
struct
wrn_txd
*
tx
;
tx
=
wrn
->
txd
+
i
;
tx
=
wrn
->
txd
+
i
;
writel
(
0
,
&
tx
->
tx1
);
writel
(
0
,
&
tx
->
tx1
);
}
}
...
@@ -200,7 +204,7 @@ static int wrn_probe(struct platform_device *pdev)
...
@@ -200,7 +204,7 @@ static int wrn_probe(struct platform_device *pdev)
rx
=
wrn
->
rxd
+
i
;
rx
=
wrn
->
rxd
+
i
;
offset
=
__wrn_desc_offset
(
wrn
,
WRN_DDIR_RX
,
i
);
offset
=
__wrn_desc_offset
(
wrn
,
WRN_DDIR_RX
,
i
);
writel
(
(
2000
<<
16
)
|
offset
,
&
rx
->
rx3
);
writel
((
2000
<<
16
)
|
offset
,
&
rx
->
rx3
);
writel
(
NIC_RX1_D1_EMPTY
,
&
rx
->
rx1
);
writel
(
NIC_RX1_D1_EMPTY
,
&
rx
->
rx1
);
}
}
...
...
kernel/wr_nic/endpoint.c
View file @
106fcb76
...
@@ -38,7 +38,7 @@ int wrn_phy_read(struct net_device *dev, int phy_id, int location)
...
@@ -38,7 +38,7 @@ int wrn_phy_read(struct net_device *dev, int phy_id, int location)
}
}
wrn_ep_write
(
ep
,
MDIO_CR
,
EP_MDIO_CR_ADDR_W
(
location
));
wrn_ep_write
(
ep
,
MDIO_CR
,
EP_MDIO_CR_ADDR_W
(
location
));
while
(
(
wrn_ep_read
(
ep
,
MDIO_ASR
)
&
EP_MDIO_ASR_READY
)
==
0
)
while
(
(
wrn_ep_read
(
ep
,
MDIO_ASR
)
&
EP_MDIO_ASR_READY
)
==
0
)
;
;
val
=
wrn_ep_read
(
ep
,
MDIO_ASR
);
val
=
wrn_ep_read
(
ep
,
MDIO_ASR
);
/* mask from wbgen macros */
/* mask from wbgen macros */
...
@@ -64,7 +64,7 @@ void wrn_phy_write(struct net_device *dev, int phy_id, int location,
...
@@ -64,7 +64,7 @@ void wrn_phy_write(struct net_device *dev, int phy_id, int location,
EP_MDIO_CR_ADDR_W
(
location
)
EP_MDIO_CR_ADDR_W
(
location
)
|
EP_MDIO_CR_DATA_W
(
value
)
|
EP_MDIO_CR_DATA_W
(
value
)
|
EP_MDIO_CR_RW
);
|
EP_MDIO_CR_RW
);
while
(
(
wrn_ep_read
(
ep
,
MDIO_ASR
)
&
EP_MDIO_ASR_READY
)
==
0
)
while
(
(
wrn_ep_read
(
ep
,
MDIO_ASR
)
&
EP_MDIO_ASR_READY
)
==
0
)
;
;
}
}
...
@@ -81,18 +81,18 @@ static void wrn_update_link_status(struct net_device *dev)
...
@@ -81,18 +81,18 @@ static void wrn_update_link_status(struct net_device *dev)
// printk("%s: read %x %x %x\n", __func__, bmsr, bmcr);
// printk("%s: read %x %x %x\n", __func__, bmsr, bmcr);
/* Link wnt down? */
/* Link wnt down? */
if
(
!
mii_link_ok
(
&
ep
->
mii
))
{
if
(
!
mii_link_ok
(
&
ep
->
mii
))
{
if
(
netif_carrier_ok
(
dev
))
{
if
(
netif_carrier_ok
(
dev
))
{
netif_carrier_off
(
dev
);
netif_carrier_off
(
dev
);
clear_bit
(
WRN_EP_UP
,
&
ep
->
ep_flags
);
clear_bit
(
WRN_EP_UP
,
&
ep
->
ep_flags
);
printk
(
KERN_INFO
"%s: Link down.
\n
"
,
dev
->
name
);
netdev_info
(
dev
,
"Link down.
\n
"
);
return
;
return
;
}
}
return
;
return
;
}
}
/* Currently the link is active */
/* Currently the link is active */
if
(
netif_carrier_ok
(
dev
))
{
if
(
netif_carrier_ok
(
dev
))
{
/* Software already knows it's up */
/* Software already knows it's up */
return
;
return
;
}
}
...
@@ -109,16 +109,15 @@ static void wrn_update_link_status(struct net_device *dev)
...
@@ -109,16 +109,15 @@ static void wrn_update_link_status(struct net_device *dev)
if
(
0
)
{
/* was commented in minic */
if
(
0
)
{
/* was commented in minic */
wrn_ep_write
(
ep
,
FCR
,
wrn_ep_write
(
ep
,
FCR
,
EP_FCR_TXPAUSE
|
EP_FCR_RXPAUSE
EP_FCR_TXPAUSE
|
EP_FCR_RXPAUSE
|
EP_FCR_TX_THR_W
(
128
)
|
EP_FCR_TX_THR_W
(
128
)
|
EP_FCR_TX_QUANTA_W
(
200
));
|
EP_FCR_TX_QUANTA_W
(
200
));
}
}
printk
(
KERN_INFO
"%s: Link up, lpa 0x%04x.
\n
"
,
netdev_info
(
dev
,
"Link up, lpa 0x%04x.
\n
"
,
lpa
);
dev
->
name
,
lpa
);
}
else
{
}
else
{
/* No autonegotiation. It's up immediately */
/* No autonegotiation. It's up immediately */
printk
(
KERN_INFO
"%s: Link up.
\n
"
,
dev
->
name
);
netdev_info
(
dev
,
"Link up.
\n
"
);
}
}
netif_carrier_on
(
dev
);
netif_carrier_on
(
dev
);
set_bit
(
WRN_EP_UP
,
&
ep
->
ep_flags
);
set_bit
(
WRN_EP_UP
,
&
ep
->
ep_flags
);
...
@@ -126,7 +125,7 @@ static void wrn_update_link_status(struct net_device *dev)
...
@@ -126,7 +125,7 @@ static void wrn_update_link_status(struct net_device *dev)
/* reset RMON counters */
/* reset RMON counters */
ecr
=
wrn_ep_read
(
ep
,
ECR
);
ecr
=
wrn_ep_read
(
ep
,
ECR
);
wrn_ep_write
(
ep
,
ECR
,
ecr
|
EP_ECR_RST_CNT
);
wrn_ep_write
(
ep
,
ECR
,
ecr
|
EP_ECR_RST_CNT
);
wrn_ep_write
(
ep
,
ECR
,
ecr
);
wrn_ep_write
(
ep
,
ECR
,
ecr
);
}
}
/* Actual timer function. Takes the lock and calls above function */
/* Actual timer function. Takes the lock and calls above function */
...
@@ -165,7 +164,7 @@ int wrn_ep_open(struct net_device *dev)
...
@@ -165,7 +164,7 @@ int wrn_ep_open(struct net_device *dev)
* and we need the RX OOB block to identify orginating endpoints
* and we need the RX OOB block to identify orginating endpoints
* for RXed packets -- Tom
* for RXed packets -- Tom
*/
*/
writel
(
EP_TSCR_EN_TXTS
|
EP_TSCR_EN_RXTS
,
&
ep
->
ep_regs
->
TSCR
);
writel
(
EP_TSCR_EN_TXTS
|
EP_TSCR_EN_RXTS
,
&
ep
->
ep_regs
->
TSCR
);
writel
(
0
writel
(
0
|
EP_ECR_PORTID_W
(
ep
->
ep_number
)
|
EP_ECR_PORTID_W
(
ep
->
ep_number
)
...
@@ -253,8 +252,7 @@ int wrn_endpoint_probe(struct net_device *dev)
...
@@ -253,8 +252,7 @@ int wrn_endpoint_probe(struct net_device *dev)
/* Finally, register and succeed, or fail and undo */
/* Finally, register and succeed, or fail and undo */
err
=
register_netdev
(
dev
);
err
=
register_netdev
(
dev
);
if
(
err
)
{
if
(
err
)
{
printk
(
KERN_ERR
KBUILD_MODNAME
": Can't register dev %s
\n
"
,
netdev_err
(
dev
,
"Can't register device
\n
"
);
dev
->
name
);
__wrn_endpoint_shutdown
(
ep
);
__wrn_endpoint_shutdown
(
ep
);
/* ENODEV means "no more" for the caller, so avoid it */
/* ENODEV means "no more" for the caller, so avoid it */
return
err
==
-
ENODEV
?
-
EIO
:
err
;
return
err
==
-
ENODEV
?
-
EIO
:
err
;
...
...
kernel/wr_nic/ethtool.c
View file @
106fcb76
...
@@ -29,7 +29,7 @@ static int wrn_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
...
@@ -29,7 +29,7 @@ static int wrn_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
ret
=
mii_ethtool_gset
(
&
ep
->
mii
,
cmd
);
ret
=
mii_ethtool_gset
(
&
ep
->
mii
,
cmd
);
spin_unlock_irq
(
&
ep
->
lock
);
spin_unlock_irq
(
&
ep
->
lock
);
cmd
->
supported
=
cmd
->
supported
=
SUPPORTED_FIBRE
|
/* FIXME: copper sfp? */
SUPPORTED_FIBRE
|
/* FIXME: copper sfp? */
SUPPORTED_Autoneg
|
SUPPORTED_Autoneg
|
SUPPORTED_1000baseKX_Full
;
SUPPORTED_1000baseKX_Full
;
...
...
kernel/wr_nic/nic-core.c
View file @
106fcb76
...
@@ -44,11 +44,10 @@ static int wrn_open(struct net_device *dev)
...
@@ -44,11 +44,10 @@ static int wrn_open(struct net_device *dev)
wrn_ep_open
(
dev
);
wrn_ep_open
(
dev
);
/* Software-only management is in this file*/
/* Software-only management is in this file*/
if
(
netif_queue_stopped
(
dev
))
{
if
(
netif_queue_stopped
(
dev
))
netif_wake_queue
(
dev
);
netif_wake_queue
(
dev
);
}
else
{
else
netif_start_queue
(
dev
);
netif_start_queue
(
dev
);
}
/*
/*
* Set the MRU bit enough, to avoid issues. We used dev-mtu,
* Set the MRU bit enough, to avoid issues. We used dev-mtu,
...
@@ -57,7 +56,7 @@ static int wrn_open(struct net_device *dev)
...
@@ -57,7 +56,7 @@ static int wrn_open(struct net_device *dev)
* malformed packets
* malformed packets
*/
*/
val
=
readl
(
&
ep
->
ep_regs
->
RFCR
)
&
~
EP_RFCR_MRU_MASK
;
val
=
readl
(
&
ep
->
ep_regs
->
RFCR
)
&
~
EP_RFCR_MRU_MASK
;
writel
(
val
|
EP_RFCR_MRU_W
(
2048
),
&
ep
->
ep_regs
->
RFCR
);
writel
(
val
|
EP_RFCR_MRU_W
(
2048
),
&
ep
->
ep_regs
->
RFCR
);
/* Most drivers call platform_set_drvdata() but we don't need it */
/* Most drivers call platform_set_drvdata() but we don't need it */
return
0
;
return
0
;
...
@@ -68,7 +67,8 @@ static int wrn_close(struct net_device *dev)
...
@@ -68,7 +67,8 @@ static int wrn_close(struct net_device *dev)
struct
wrn_ep
*
ep
=
netdev_priv
(
dev
);
struct
wrn_ep
*
ep
=
netdev_priv
(
dev
);
int
ret
;
int
ret
;
if
(
(
ret
=
wrn_ep_close
(
dev
))
)
ret
=
wrn_ep_close
(
dev
);
if
(
ret
)
return
ret
;
return
ret
;
/* FIXME: software-only fixing at close time */
/* FIXME: software-only fixing at close time */
...
@@ -78,7 +78,7 @@ static int wrn_close(struct net_device *dev)
...
@@ -78,7 +78,7 @@ static int wrn_close(struct net_device *dev)
return
0
;
return
0
;
}
}
static
int
wrn_set_mac_address
(
struct
net_device
*
dev
,
void
*
vaddr
)
static
int
wrn_set_mac_address
(
struct
net_device
*
dev
,
void
*
vaddr
)
{
{
struct
wrn_ep
*
ep
=
netdev_priv
(
dev
);
struct
wrn_ep
*
ep
=
netdev_priv
(
dev
);
struct
sockaddr
*
addr
=
vaddr
;
struct
sockaddr
*
addr
=
vaddr
;
...
@@ -165,7 +165,7 @@ static int wrn_start_xmit(struct sk_buff *skb, struct net_device *dev)
...
@@ -165,7 +165,7 @@ static int wrn_start_xmit(struct sk_buff *skb, struct net_device *dev)
int
id
;
int
id
;
int
do_stamp
=
0
;
int
do_stamp
=
0
;
void
*
data
;
/* FIXME: move data and len to __wrn_tx_desc */
void
*
data
;
/* FIXME: move data and len to __wrn_tx_desc */
unsigned
len
;
unsigned
int
len
;
if
(
unlikely
(
skb
->
len
>
WRN_MTU
))
{
if
(
unlikely
(
skb
->
len
>
WRN_MTU
))
{
/* FIXME: check this WRN_MTU is needed and used properly */
/* FIXME: check this WRN_MTU is needed and used properly */
...
@@ -210,7 +210,7 @@ static int wrn_start_xmit(struct sk_buff *skb, struct net_device *dev)
...
@@ -210,7 +210,7 @@ static int wrn_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* We are done, this is trivial maiintainance*/
/* We are done, this is trivial maiintainance*/
ep
->
stats
.
tx_packets
++
;
ep
->
stats
.
tx_packets
++
;
ep
->
stats
.
tx_bytes
+=
len
;
ep
->
stats
.
tx_bytes
+=
len
;
#if KERNEL_VERSION(4,
7,
0) > LINUX_VERSION_CODE
#if KERNEL_VERSION(4,
7,
0) > LINUX_VERSION_CODE
dev
->
trans_start
=
jiffies
;
dev
->
trans_start
=
jiffies
;
#else
#else
netif_trans_update
(
dev
);
netif_trans_update
(
dev
);
...
@@ -245,7 +245,6 @@ int __weak wrn_mezzanine_init(struct net_device *dev)
...
@@ -245,7 +245,6 @@ int __weak wrn_mezzanine_init(struct net_device *dev)
void
__weak
wrn_mezzanine_exit
(
struct
net_device
*
dev
)
void
__weak
wrn_mezzanine_exit
(
struct
net_device
*
dev
)
{
{
return
;
}
}
...
@@ -378,7 +377,7 @@ static void __wrn_rx_descriptor(struct wrn_dev *wrn, int desc)
...
@@ -378,7 +377,7 @@ static void __wrn_rx_descriptor(struct wrn_dev *wrn, int desc)
__wrn_copy_in
(
skb_put
(
skb
,
len
),
wrn
->
databuf
+
off
,
len
);
__wrn_copy_in
(
skb_put
(
skb
,
len
),
wrn
->
databuf
+
off
,
len
);
/* Rewrite lenght (modified during rx) and mark it free ASAP */
/* Rewrite lenght (modified during rx) and mark it free ASAP */
writel
(
(
2000
<<
16
)
|
offset
,
&
rx
->
rx3
);
writel
((
2000
<<
16
)
|
offset
,
&
rx
->
rx3
);
writel
(
NIC_RX1_D1_EMPTY
,
&
rx
->
rx1
);
writel
(
NIC_RX1_D1_EMPTY
,
&
rx
->
rx1
);
/* RX timestamping part */
/* RX timestamping part */
...
@@ -391,14 +390,14 @@ static void __wrn_rx_descriptor(struct wrn_dev *wrn, int desc)
...
@@ -391,14 +390,14 @@ static void __wrn_rx_descriptor(struct wrn_dev *wrn, int desc)
ts
.
tv_sec
=
(
s32
)
utc
&
0x7fffffff
;
ts
.
tv_sec
=
(
s32
)
utc
&
0x7fffffff
;
cntr_diff
=
(
ts_r
&
0xf
)
-
ts_f
;
cntr_diff
=
(
ts_r
&
0xf
)
-
ts_f
;
/* the bit says the rising edge cnter is 1tick ahead */
/* the bit says the rising edge cnter is 1tick ahead */
if
(
cntr_diff
==
1
||
cntr_diff
==
(
-
0xf
))
if
(
cntr_diff
==
1
||
cntr_diff
==
(
-
0xf
))
ts
.
tv_sec
|=
0x80000000
;
ts
.
tv_sec
|=
0x80000000
;
ts
.
tv_nsec
=
ts_r
*
NSEC_PER_TICK
;
ts
.
tv_nsec
=
ts_r
*
NSEC_PER_TICK
;
pr_debug
(
"Timestamp: %li:%li, ahead = %d
\n
"
,
pr_debug
(
"Timestamp: %li:%li, ahead = %d
\n
"
,
ts
.
tv_sec
&
0x7fffffff
,
ts
.
tv_sec
&
0x7fffffff
,
ts
.
tv_nsec
&
0x7fffffff
,
ts
.
tv_nsec
&
0x7fffffff
,
ts
.
tv_sec
&
0x80000000
?
1
:
0
);
ts
.
tv_sec
&
0x80000000
?
1
:
0
);
if
(
1
)
{
if
(
1
)
{
/* SPEC: don't do the strange stuff for wr-ptp */
/* SPEC: don't do the strange stuff for wr-ptp */
...
@@ -406,7 +405,7 @@ static void __wrn_rx_descriptor(struct wrn_dev *wrn, int desc)
...
@@ -406,7 +405,7 @@ static void __wrn_rx_descriptor(struct wrn_dev *wrn, int desc)
ts
.
tv_nsec
&=
0x7fffffff
;
ts
.
tv_nsec
&=
0x7fffffff
;
}
}
if
(
!
(
r1
&
NIC_RX1_D1_TS_INCORRECT
))
{
if
(
!
(
r1
&
NIC_RX1_D1_TS_INCORRECT
))
{
hwts
=
skb_hwtstamps
(
skb
);
hwts
=
skb_hwtstamps
(
skb
);
hwts
->
hwtstamp
=
timespec_to_ktime
(
ts
);
hwts
->
hwtstamp
=
timespec_to_ktime
(
ts
);
}
}
...
@@ -420,7 +419,7 @@ static void __wrn_rx_descriptor(struct wrn_dev *wrn, int desc)
...
@@ -420,7 +419,7 @@ static void __wrn_rx_descriptor(struct wrn_dev *wrn, int desc)
return
;
return
;
err_out:
/* Mark it free anyways -- with its full length */
err_out:
/* Mark it free anyways -- with its full length */
writel
(
(
2000
<<
16
)
|
offset
,
&
rx
->
rx3
);
writel
((
2000
<<
16
)
|
offset
,
&
rx
->
rx3
);
writel
(
NIC_RX1_D1_EMPTY
,
&
rx
->
rx1
);
writel
(
NIC_RX1_D1_EMPTY
,
&
rx
->
rx1
);
/* account the error to endpoint 0 -- we don't know who it is */
/* account the error to endpoint 0 -- we don't know who it is */
...
@@ -461,7 +460,7 @@ static void wrn_tx_interrupt(struct wrn_dev *wrn)
...
@@ -461,7 +460,7 @@ static void wrn_tx_interrupt(struct wrn_dev *wrn)
int
i
;
int
i
;
/* Loop using our tail until one is not sent */
/* Loop using our tail until one is not sent */
while
(
(
i
=
wrn
->
next_tx_tail
)
!=
wrn
->
next_tx_head
)
{
while
((
i
=
wrn
->
next_tx_tail
)
!=
wrn
->
next_tx_head
)
{
/* Check if this is txdone */
/* Check if this is txdone */
tx
=
wrn
->
txd
+
i
;
tx
=
wrn
->
txd
+
i
;
reg
=
readl
(
&
tx
->
tx1
);
reg
=
readl
(
&
tx
->
tx1
);
...
...
kernel/wr_nic/timestamp.c
View file @
106fcb76
...
@@ -32,12 +32,12 @@ void wrn_tx_tstamp_skb(struct wrn_dev *wrn, int desc)
...
@@ -32,12 +32,12 @@ void wrn_tx_tstamp_skb(struct wrn_dev *wrn, int desc)
wrn_ppsg_read_time
(
wrn
,
&
counter_ppsg
,
&
utc
);
wrn_ppsg_read_time
(
wrn
,
&
counter_ppsg
,
&
utc
);
/* We may be at the beginning og the next second */
/* We may be at the beginning og the next second */
if
(
counter_ppsg
<
d
->
cycles
)
if
(
counter_ppsg
<
d
->
cycles
)
utc
--
;
utc
--
;
ts
.
tv_sec
=
(
s32
)
utc
&
0x7fffffff
;
ts
.
tv_sec
=
(
s32
)
utc
&
0x7fffffff
;
ts
.
tv_nsec
=
d
->
cycles
*
NSEC_PER_TICK
;
ts
.
tv_nsec
=
d
->
cycles
*
NSEC_PER_TICK
;
if
(
!
(
d
->
valid
&
TS_INVALID
))
{
if
(
!
(
d
->
valid
&
TS_INVALID
))
{
hwts
=
skb_hwtstamps
(
skb
);
hwts
=
skb_hwtstamps
(
skb
);
hwts
->
hwtstamp
=
timespec_to_ktime
(
ts
);
hwts
->
hwtstamp
=
timespec_to_ktime
(
ts
);
skb_tstamp_tx
(
skb
,
hwts
);
skb_tstamp_tx
(
skb
,
hwts
);
...
@@ -75,7 +75,7 @@ static int record_tstamp(struct wrn_dev *wrn, u32 tsval, u32 idreg, u32 r2)
...
@@ -75,7 +75,7 @@ static int record_tstamp(struct wrn_dev *wrn, u32 tsval, u32 idreg, u32 r2)
wrn_ppsg_read_time
(
wrn
,
&
counter_ppsg
,
&
utc
);
wrn_ppsg_read_time
(
wrn
,
&
counter_ppsg
,
&
utc
);
if
(
counter_ppsg
<
(
tsval
&
0xfffffff
))
if
(
counter_ppsg
<
(
tsval
&
0xfffffff
))
utc
--
;
utc
--
;
ts
.
tv_sec
=
(
s32
)
utc
&
0x7fffffff
;
ts
.
tv_sec
=
(
s32
)
utc
&
0x7fffffff
;
...
@@ -119,8 +119,9 @@ int wrn_tstamp_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
...
@@ -119,8 +119,9 @@ int wrn_tstamp_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
if
(
copy_from_user
(
&
config
,
rq
->
ifr_data
,
sizeof
(
config
)))
if
(
copy_from_user
(
&
config
,
rq
->
ifr_data
,
sizeof
(
config
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
0
)
netdev_dbg
(
dev
,
"%s: tx type %i, rx filter %i
\n
"
,
__func__
,
if
(
0
)
config
.
tx_type
,
config
.
rx_filter
);
netdev_dbg
(
dev
,
"%s: tx type %i, rx filter %i
\n
"
,
__func__
,
config
.
tx_type
,
config
.
rx_filter
);
switch
(
config
.
tx_type
)
{
switch
(
config
.
tx_type
)
{
/* Set up time stamping on transmission */
/* Set up time stamping on transmission */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment