Commit a5b37888 authored by Raghu Vatsavayi's avatar Raghu Vatsavayi Committed by David S. Miller

liquidio: Consider PTP for packet size calculations

This patch is to refactor packet size calculations to support PTP enabled
for 66xx and 68xx cards and also other cards that do not support PTP.
Signed-off-by: default avatarDerek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: default avatarSatanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: default avatarFelix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: default avatarRaghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cabeb13b
...@@ -84,6 +84,8 @@ static int conf_type; ...@@ -84,6 +84,8 @@ static int conf_type;
module_param(conf_type, int, 0); module_param(conf_type, int, 0);
MODULE_PARM_DESC(conf_type, "select octeon configuration 0 default 1 ovs"); MODULE_PARM_DESC(conf_type, "select octeon configuration 0 default 1 ovs");
static int ptp_enable = 1;
/* Bit mask values for lio->ifstate */ /* Bit mask values for lio->ifstate */
#define LIO_IFSTATE_DROQ_OPS 0x01 #define LIO_IFSTATE_DROQ_OPS 0x01
#define LIO_IFSTATE_REGISTERED 0x02 #define LIO_IFSTATE_REGISTERED 0x02
...@@ -1851,6 +1853,7 @@ liquidio_push_packet(u32 octeon_id, ...@@ -1851,6 +1853,7 @@ liquidio_push_packet(u32 octeon_id,
if (netdev) { if (netdev) {
int packet_was_received; int packet_was_received;
struct lio *lio = GET_LIO(netdev); struct lio *lio = GET_LIO(netdev);
struct octeon_device *oct = lio->oct_dev;
/* Do not proceed if the interface is not in RUNNING state. */ /* Do not proceed if the interface is not in RUNNING state. */
if (!ifstate_check(lio, LIO_IFSTATE_RUNNING)) { if (!ifstate_check(lio, LIO_IFSTATE_RUNNING)) {
...@@ -1889,21 +1892,26 @@ liquidio_push_packet(u32 octeon_id, ...@@ -1889,21 +1892,26 @@ liquidio_push_packet(u32 octeon_id,
put_page(pg_info->page); put_page(pg_info->page);
} }
if (rh->r_dh.has_hwtstamp) { if (((oct->chip_id == OCTEON_CN66XX) ||
/* timestamp is included from the hardware at the (oct->chip_id == OCTEON_CN68XX)) &&
* beginning of the packet. ptp_enable) {
*/ if (rh->r_dh.has_hwtstamp) {
if (ifstate_check(lio, /* timestamp is included from the hardware at
LIO_IFSTATE_RX_TIMESTAMP_ENABLED)) { * the beginning of the packet.
/* Nanoseconds are in the first 64-bits
* of the packet.
*/ */
memcpy(&ns, (skb->data), sizeof(ns)); if (ifstate_check
shhwtstamps = skb_hwtstamps(skb); (lio, LIO_IFSTATE_RX_TIMESTAMP_ENABLED)) {
shhwtstamps->hwtstamp = /* Nanoseconds are in the first 64-bits
ns_to_ktime(ns + lio->ptp_adjust); * of the packet.
*/
memcpy(&ns, (skb->data), sizeof(ns));
shhwtstamps = skb_hwtstamps(skb);
shhwtstamps->hwtstamp =
ns_to_ktime(ns +
lio->ptp_adjust);
}
skb_pull(skb, sizeof(ns));
} }
skb_pull(skb, sizeof(ns));
} }
skb->protocol = eth_type_trans(skb, skb->dev); skb->protocol = eth_type_trans(skb, skb->dev);
......
...@@ -174,9 +174,11 @@ static inline void add_sg_size(struct octeon_sg_entry *sg_entry, ...@@ -174,9 +174,11 @@ static inline void add_sg_size(struct octeon_sg_entry *sg_entry,
/*------------------------- End Scatter/Gather ---------------------------*/ /*------------------------- End Scatter/Gather ---------------------------*/
#define OCTNET_FRM_PTP_HEADER_SIZE 8 #define OCTNET_FRM_PTP_HEADER_SIZE 8
#define OCTNET_FRM_HEADER_SIZE 30 /* PTP timestamp + VLAN + Ethernet */
#define OCTNET_MIN_FRM_SIZE (64 + OCTNET_FRM_PTP_HEADER_SIZE) #define OCTNET_FRM_HEADER_SIZE 22 /* VLAN + Ethernet */
#define OCTNET_MIN_FRM_SIZE 64
#define OCTNET_MAX_FRM_SIZE (16000 + OCTNET_FRM_HEADER_SIZE) #define OCTNET_MAX_FRM_SIZE (16000 + OCTNET_FRM_HEADER_SIZE)
#define OCTNET_DEFAULT_FRM_SIZE (1500 + OCTNET_FRM_HEADER_SIZE) #define OCTNET_DEFAULT_FRM_SIZE (1500 + OCTNET_FRM_HEADER_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