Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Trivial conflict in CAN on file rename. Conflicts: drivers/net/can/m_can/tcan4x5x-core.c Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -621,7 +621,7 @@ static void chtls_reset_synq(struct listen_ctx *listen_ctx)
|
||||
|
||||
while (!skb_queue_empty(&listen_ctx->synq)) {
|
||||
struct chtls_sock *csk =
|
||||
container_of((struct synq *)__skb_dequeue
|
||||
container_of((struct synq *)skb_peek
|
||||
(&listen_ctx->synq), struct chtls_sock, synq);
|
||||
struct sock *child = csk->sk;
|
||||
|
||||
@@ -1109,6 +1109,7 @@ static struct sock *chtls_recv_sock(struct sock *lsk,
|
||||
const struct cpl_pass_accept_req *req,
|
||||
struct chtls_dev *cdev)
|
||||
{
|
||||
struct adapter *adap = pci_get_drvdata(cdev->pdev);
|
||||
struct neighbour *n = NULL;
|
||||
struct inet_sock *newinet;
|
||||
const struct iphdr *iph;
|
||||
@@ -1118,9 +1119,10 @@ static struct sock *chtls_recv_sock(struct sock *lsk,
|
||||
struct dst_entry *dst;
|
||||
struct tcp_sock *tp;
|
||||
struct sock *newsk;
|
||||
bool found = false;
|
||||
u16 port_id;
|
||||
int rxq_idx;
|
||||
int step;
|
||||
int step, i;
|
||||
|
||||
iph = (const struct iphdr *)network_hdr;
|
||||
newsk = tcp_create_openreq_child(lsk, oreq, cdev->askb);
|
||||
@@ -1152,7 +1154,7 @@ static struct sock *chtls_recv_sock(struct sock *lsk,
|
||||
n = dst_neigh_lookup(dst, &ip6h->saddr);
|
||||
#endif
|
||||
}
|
||||
if (!n)
|
||||
if (!n || !n->dev)
|
||||
goto free_sk;
|
||||
|
||||
ndev = n->dev;
|
||||
@@ -1161,6 +1163,13 @@ static struct sock *chtls_recv_sock(struct sock *lsk,
|
||||
if (is_vlan_dev(ndev))
|
||||
ndev = vlan_dev_real_dev(ndev);
|
||||
|
||||
for_each_port(adap, i)
|
||||
if (cdev->ports[i] == ndev)
|
||||
found = true;
|
||||
|
||||
if (!found)
|
||||
goto free_dst;
|
||||
|
||||
port_id = cxgb4_port_idx(ndev);
|
||||
|
||||
csk = chtls_sock_create(cdev);
|
||||
@@ -1238,6 +1247,7 @@ static struct sock *chtls_recv_sock(struct sock *lsk,
|
||||
free_csk:
|
||||
chtls_sock_release(&csk->kref);
|
||||
free_dst:
|
||||
neigh_release(n);
|
||||
dst_release(dst);
|
||||
free_sk:
|
||||
inet_csk_prepare_forced_close(newsk);
|
||||
@@ -1387,7 +1397,7 @@ static void chtls_pass_accept_request(struct sock *sk,
|
||||
|
||||
newsk = chtls_recv_sock(sk, oreq, network_hdr, req, cdev);
|
||||
if (!newsk)
|
||||
goto free_oreq;
|
||||
goto reject;
|
||||
|
||||
if (chtls_get_module(newsk))
|
||||
goto reject;
|
||||
@@ -1403,8 +1413,6 @@ static void chtls_pass_accept_request(struct sock *sk,
|
||||
kfree_skb(skb);
|
||||
return;
|
||||
|
||||
free_oreq:
|
||||
chtls_reqsk_free(oreq);
|
||||
reject:
|
||||
mk_tid_release(reply_skb, 0, tid);
|
||||
cxgb4_ofld_send(cdev->lldi->ports[0], reply_skb);
|
||||
@@ -1589,6 +1597,11 @@ static int chtls_pass_establish(struct chtls_dev *cdev, struct sk_buff *skb)
|
||||
sk_wake_async(sk, 0, POLL_OUT);
|
||||
|
||||
data = lookup_stid(cdev->tids, stid);
|
||||
if (!data) {
|
||||
/* listening server close */
|
||||
kfree_skb(skb);
|
||||
goto unlock;
|
||||
}
|
||||
lsk = ((struct listen_ctx *)data)->lsk;
|
||||
|
||||
bh_lock_sock(lsk);
|
||||
@@ -1997,39 +2010,6 @@ static void t4_defer_reply(struct sk_buff *skb, struct chtls_dev *cdev,
|
||||
spin_unlock_bh(&cdev->deferq.lock);
|
||||
}
|
||||
|
||||
static void send_abort_rpl(struct sock *sk, struct sk_buff *skb,
|
||||
struct chtls_dev *cdev, int status, int queue)
|
||||
{
|
||||
struct cpl_abort_req_rss *req = cplhdr(skb);
|
||||
struct sk_buff *reply_skb;
|
||||
struct chtls_sock *csk;
|
||||
|
||||
csk = rcu_dereference_sk_user_data(sk);
|
||||
|
||||
reply_skb = alloc_skb(sizeof(struct cpl_abort_rpl),
|
||||
GFP_KERNEL);
|
||||
|
||||
if (!reply_skb) {
|
||||
req->status = (queue << 1);
|
||||
t4_defer_reply(skb, cdev, send_defer_abort_rpl);
|
||||
return;
|
||||
}
|
||||
|
||||
set_abort_rpl_wr(reply_skb, GET_TID(req), status);
|
||||
kfree_skb(skb);
|
||||
|
||||
set_wr_txq(reply_skb, CPL_PRIORITY_DATA, queue);
|
||||
if (csk_conn_inline(csk)) {
|
||||
struct l2t_entry *e = csk->l2t_entry;
|
||||
|
||||
if (e && sk->sk_state != TCP_SYN_RECV) {
|
||||
cxgb4_l2t_send(csk->egress_dev, reply_skb, e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
cxgb4_ofld_send(cdev->lldi->ports[0], reply_skb);
|
||||
}
|
||||
|
||||
static void chtls_send_abort_rpl(struct sock *sk, struct sk_buff *skb,
|
||||
struct chtls_dev *cdev,
|
||||
int status, int queue)
|
||||
@@ -2078,9 +2058,9 @@ static void bl_abort_syn_rcv(struct sock *lsk, struct sk_buff *skb)
|
||||
queue = csk->txq_idx;
|
||||
|
||||
skb->sk = NULL;
|
||||
chtls_send_abort_rpl(child, skb, BLOG_SKB_CB(skb)->cdev,
|
||||
CPL_ABORT_NO_RST, queue);
|
||||
do_abort_syn_rcv(child, lsk);
|
||||
send_abort_rpl(child, skb, BLOG_SKB_CB(skb)->cdev,
|
||||
CPL_ABORT_NO_RST, queue);
|
||||
}
|
||||
|
||||
static int abort_syn_rcv(struct sock *sk, struct sk_buff *skb)
|
||||
@@ -2110,8 +2090,8 @@ static int abort_syn_rcv(struct sock *sk, struct sk_buff *skb)
|
||||
if (!sock_owned_by_user(psk)) {
|
||||
int queue = csk->txq_idx;
|
||||
|
||||
chtls_send_abort_rpl(sk, skb, cdev, CPL_ABORT_NO_RST, queue);
|
||||
do_abort_syn_rcv(sk, psk);
|
||||
send_abort_rpl(sk, skb, cdev, CPL_ABORT_NO_RST, queue);
|
||||
} else {
|
||||
skb->sk = sk;
|
||||
BLOG_SKB_CB(skb)->backlog_rcv = bl_abort_syn_rcv;
|
||||
@@ -2129,9 +2109,6 @@ static void chtls_abort_req_rss(struct sock *sk, struct sk_buff *skb)
|
||||
int queue = csk->txq_idx;
|
||||
|
||||
if (is_neg_adv(req->status)) {
|
||||
if (sk->sk_state == TCP_SYN_RECV)
|
||||
chtls_set_tcb_tflag(sk, 0, 0);
|
||||
|
||||
kfree_skb(skb);
|
||||
return;
|
||||
}
|
||||
@@ -2158,12 +2135,12 @@ static void chtls_abort_req_rss(struct sock *sk, struct sk_buff *skb)
|
||||
if (sk->sk_state == TCP_SYN_RECV && !abort_syn_rcv(sk, skb))
|
||||
return;
|
||||
|
||||
chtls_release_resources(sk);
|
||||
chtls_conn_done(sk);
|
||||
}
|
||||
|
||||
chtls_send_abort_rpl(sk, skb, BLOG_SKB_CB(skb)->cdev,
|
||||
rst_status, queue);
|
||||
chtls_release_resources(sk);
|
||||
chtls_conn_done(sk);
|
||||
}
|
||||
|
||||
static void chtls_abort_rpl_rss(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
@@ -223,3 +223,4 @@ static struct platform_driver fs_enet_bb_mdio_driver = {
|
||||
};
|
||||
|
||||
module_platform_driver(fs_enet_bb_mdio_driver);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -224,3 +224,4 @@ static struct platform_driver fs_enet_fec_mdio_driver = {
|
||||
};
|
||||
|
||||
module_platform_driver(fs_enet_fec_mdio_driver);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -169,7 +169,7 @@ struct hclgevf_mbx_arq_ring {
|
||||
#define hclge_mbx_ring_ptr_move_crq(crq) \
|
||||
(crq->next_to_use = (crq->next_to_use + 1) % crq->desc_num)
|
||||
#define hclge_mbx_tail_ptr_move_arq(arq) \
|
||||
(arq.tail = (arq.tail + 1) % HCLGE_MBX_MAX_ARQ_MSG_SIZE)
|
||||
(arq.tail = (arq.tail + 1) % HCLGE_MBX_MAX_ARQ_MSG_NUM)
|
||||
#define hclge_mbx_head_ptr_move_arq(arq) \
|
||||
(arq.head = (arq.head + 1) % HCLGE_MBX_MAX_ARQ_MSG_SIZE)
|
||||
(arq.head = (arq.head + 1) % HCLGE_MBX_MAX_ARQ_MSG_NUM)
|
||||
#endif
|
||||
|
||||
@@ -752,7 +752,8 @@ static int hclge_get_sset_count(struct hnae3_handle *handle, int stringset)
|
||||
handle->flags |= HNAE3_SUPPORT_SERDES_SERIAL_LOOPBACK;
|
||||
handle->flags |= HNAE3_SUPPORT_SERDES_PARALLEL_LOOPBACK;
|
||||
|
||||
if (hdev->hw.mac.phydev) {
|
||||
if (hdev->hw.mac.phydev && hdev->hw.mac.phydev->drv &&
|
||||
hdev->hw.mac.phydev->drv->set_loopback) {
|
||||
count += 1;
|
||||
handle->flags |= HNAE3_SUPPORT_PHY_LOOPBACK;
|
||||
}
|
||||
@@ -4537,8 +4538,8 @@ static int hclge_set_rss_tuple(struct hnae3_handle *handle,
|
||||
req->ipv4_sctp_en = tuple_sets;
|
||||
break;
|
||||
case SCTP_V6_FLOW:
|
||||
if ((nfc->data & RXH_L4_B_0_1) ||
|
||||
(nfc->data & RXH_L4_B_2_3))
|
||||
if (hdev->ae_dev->dev_version <= HNAE3_DEVICE_VERSION_V2 &&
|
||||
(nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)))
|
||||
return -EINVAL;
|
||||
|
||||
req->ipv6_sctp_en = tuple_sets;
|
||||
@@ -4730,6 +4731,8 @@ static void hclge_rss_init_cfg(struct hclge_dev *hdev)
|
||||
vport[i].rss_tuple_sets.ipv6_udp_en =
|
||||
HCLGE_RSS_INPUT_TUPLE_OTHER;
|
||||
vport[i].rss_tuple_sets.ipv6_sctp_en =
|
||||
hdev->ae_dev->dev_version <= HNAE3_DEVICE_VERSION_V2 ?
|
||||
HCLGE_RSS_INPUT_TUPLE_SCTP_NO_PORT :
|
||||
HCLGE_RSS_INPUT_TUPLE_SCTP;
|
||||
vport[i].rss_tuple_sets.ipv6_fragment_en =
|
||||
HCLGE_RSS_INPUT_TUPLE_OTHER;
|
||||
|
||||
@@ -107,6 +107,8 @@
|
||||
#define HCLGE_D_IP_BIT BIT(2)
|
||||
#define HCLGE_S_IP_BIT BIT(3)
|
||||
#define HCLGE_V_TAG_BIT BIT(4)
|
||||
#define HCLGE_RSS_INPUT_TUPLE_SCTP_NO_PORT \
|
||||
(HCLGE_D_IP_BIT | HCLGE_S_IP_BIT | HCLGE_V_TAG_BIT)
|
||||
|
||||
#define HCLGE_RSS_TC_SIZE_0 1
|
||||
#define HCLGE_RSS_TC_SIZE_1 2
|
||||
|
||||
@@ -917,8 +917,8 @@ static int hclgevf_set_rss_tuple(struct hnae3_handle *handle,
|
||||
req->ipv4_sctp_en = tuple_sets;
|
||||
break;
|
||||
case SCTP_V6_FLOW:
|
||||
if ((nfc->data & RXH_L4_B_0_1) ||
|
||||
(nfc->data & RXH_L4_B_2_3))
|
||||
if (hdev->ae_dev->dev_version <= HNAE3_DEVICE_VERSION_V2 &&
|
||||
(nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)))
|
||||
return -EINVAL;
|
||||
|
||||
req->ipv6_sctp_en = tuple_sets;
|
||||
@@ -2502,7 +2502,10 @@ static void hclgevf_rss_init_cfg(struct hclgevf_dev *hdev)
|
||||
tuple_sets->ipv4_fragment_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER;
|
||||
tuple_sets->ipv6_tcp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER;
|
||||
tuple_sets->ipv6_udp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER;
|
||||
tuple_sets->ipv6_sctp_en = HCLGEVF_RSS_INPUT_TUPLE_SCTP;
|
||||
tuple_sets->ipv6_sctp_en =
|
||||
hdev->ae_dev->dev_version <= HNAE3_DEVICE_VERSION_V2 ?
|
||||
HCLGEVF_RSS_INPUT_TUPLE_SCTP_NO_PORT :
|
||||
HCLGEVF_RSS_INPUT_TUPLE_SCTP;
|
||||
tuple_sets->ipv6_fragment_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,6 +122,8 @@
|
||||
#define HCLGEVF_D_IP_BIT BIT(2)
|
||||
#define HCLGEVF_S_IP_BIT BIT(3)
|
||||
#define HCLGEVF_V_TAG_BIT BIT(4)
|
||||
#define HCLGEVF_RSS_INPUT_TUPLE_SCTP_NO_PORT \
|
||||
(HCLGEVF_D_IP_BIT | HCLGEVF_S_IP_BIT | HCLGEVF_V_TAG_BIT)
|
||||
|
||||
#define HCLGEVF_STATS_TIMER_INTERVAL 36U
|
||||
|
||||
|
||||
@@ -4432,7 +4432,7 @@ static int mvneta_xdp_setup(struct net_device *dev, struct bpf_prog *prog,
|
||||
struct bpf_prog *old_prog;
|
||||
|
||||
if (prog && dev->mtu > MVNETA_MAX_RX_BUF_SIZE) {
|
||||
NL_SET_ERR_MSG_MOD(extack, "Jumbo frames not supported on XDP");
|
||||
NL_SET_ERR_MSG_MOD(extack, "MTU too large for XDP");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
|
||||
@@ -871,8 +871,10 @@ static int cgx_lmac_init(struct cgx *cgx)
|
||||
if (!lmac)
|
||||
return -ENOMEM;
|
||||
lmac->name = kcalloc(1, sizeof("cgx_fwi_xxx_yyy"), GFP_KERNEL);
|
||||
if (!lmac->name)
|
||||
return -ENOMEM;
|
||||
if (!lmac->name) {
|
||||
err = -ENOMEM;
|
||||
goto err_lmac_free;
|
||||
}
|
||||
sprintf(lmac->name, "cgx_fwi_%d_%d", cgx->cgx_id, i);
|
||||
lmac->lmac_id = i;
|
||||
lmac->cgx = cgx;
|
||||
@@ -883,7 +885,7 @@ static int cgx_lmac_init(struct cgx *cgx)
|
||||
CGX_LMAC_FWI + i * 9),
|
||||
cgx_fwi_event_handler, 0, lmac->name, lmac);
|
||||
if (err)
|
||||
return err;
|
||||
goto err_irq;
|
||||
|
||||
/* Enable interrupt */
|
||||
cgx_write(cgx, lmac->lmac_id, CGXX_CMRX_INT_ENA_W1S,
|
||||
@@ -895,6 +897,12 @@ static int cgx_lmac_init(struct cgx *cgx)
|
||||
}
|
||||
|
||||
return cgx_lmac_verify_fwi_version(cgx);
|
||||
|
||||
err_irq:
|
||||
kfree(lmac->name);
|
||||
err_lmac_free:
|
||||
kfree(lmac);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int cgx_lmac_exit(struct cgx *cgx)
|
||||
|
||||
@@ -626,6 +626,11 @@ bool mlx5e_rep_tc_update_skb(struct mlx5_cqe64 *cqe,
|
||||
if (!reg_c0)
|
||||
return true;
|
||||
|
||||
/* If reg_c0 is not equal to the default flow tag then skb->mark
|
||||
* is not supported and must be reset back to 0.
|
||||
*/
|
||||
skb->mark = 0;
|
||||
|
||||
priv = netdev_priv(skb->dev);
|
||||
esw = priv->mdev->priv.eswitch;
|
||||
|
||||
|
||||
@@ -118,16 +118,17 @@ struct mlx5_ct_tuple {
|
||||
u16 zone;
|
||||
};
|
||||
|
||||
struct mlx5_ct_shared_counter {
|
||||
struct mlx5_ct_counter {
|
||||
struct mlx5_fc *counter;
|
||||
refcount_t refcount;
|
||||
bool is_shared;
|
||||
};
|
||||
|
||||
struct mlx5_ct_entry {
|
||||
struct rhash_head node;
|
||||
struct rhash_head tuple_node;
|
||||
struct rhash_head tuple_nat_node;
|
||||
struct mlx5_ct_shared_counter *shared_counter;
|
||||
struct mlx5_ct_counter *counter;
|
||||
unsigned long cookie;
|
||||
unsigned long restore_cookie;
|
||||
struct mlx5_ct_tuple tuple;
|
||||
@@ -394,13 +395,14 @@ mlx5_tc_ct_set_tuple_match(struct mlx5e_priv *priv, struct mlx5_flow_spec *spec,
|
||||
}
|
||||
|
||||
static void
|
||||
mlx5_tc_ct_shared_counter_put(struct mlx5_tc_ct_priv *ct_priv, struct mlx5_ct_entry *entry)
|
||||
mlx5_tc_ct_counter_put(struct mlx5_tc_ct_priv *ct_priv, struct mlx5_ct_entry *entry)
|
||||
{
|
||||
if (!refcount_dec_and_test(&entry->shared_counter->refcount))
|
||||
if (entry->counter->is_shared &&
|
||||
!refcount_dec_and_test(&entry->counter->refcount))
|
||||
return;
|
||||
|
||||
mlx5_fc_destroy(ct_priv->dev, entry->shared_counter->counter);
|
||||
kfree(entry->shared_counter);
|
||||
mlx5_fc_destroy(ct_priv->dev, entry->counter->counter);
|
||||
kfree(entry->counter);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -699,7 +701,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv,
|
||||
attr->dest_ft = ct_priv->post_ct;
|
||||
attr->ft = nat ? ct_priv->ct_nat : ct_priv->ct;
|
||||
attr->outer_match_level = MLX5_MATCH_L4;
|
||||
attr->counter = entry->shared_counter->counter;
|
||||
attr->counter = entry->counter->counter;
|
||||
attr->flags |= MLX5_ESW_ATTR_FLAG_NO_IN_PORT;
|
||||
|
||||
mlx5_tc_ct_set_tuple_match(netdev_priv(ct_priv->netdev), spec, flow_rule);
|
||||
@@ -732,13 +734,34 @@ err_attr:
|
||||
return err;
|
||||
}
|
||||
|
||||
static struct mlx5_ct_shared_counter *
|
||||
static struct mlx5_ct_counter *
|
||||
mlx5_tc_ct_counter_create(struct mlx5_tc_ct_priv *ct_priv)
|
||||
{
|
||||
struct mlx5_ct_counter *counter;
|
||||
int ret;
|
||||
|
||||
counter = kzalloc(sizeof(*counter), GFP_KERNEL);
|
||||
if (!counter)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
counter->is_shared = false;
|
||||
counter->counter = mlx5_fc_create(ct_priv->dev, true);
|
||||
if (IS_ERR(counter->counter)) {
|
||||
ct_dbg("Failed to create counter for ct entry");
|
||||
ret = PTR_ERR(counter->counter);
|
||||
kfree(counter);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
return counter;
|
||||
}
|
||||
|
||||
static struct mlx5_ct_counter *
|
||||
mlx5_tc_ct_shared_counter_get(struct mlx5_tc_ct_priv *ct_priv,
|
||||
struct mlx5_ct_entry *entry)
|
||||
{
|
||||
struct mlx5_ct_tuple rev_tuple = entry->tuple;
|
||||
struct mlx5_ct_shared_counter *shared_counter;
|
||||
struct mlx5_core_dev *dev = ct_priv->dev;
|
||||
struct mlx5_ct_counter *shared_counter;
|
||||
struct mlx5_ct_entry *rev_entry;
|
||||
__be16 tmp_port;
|
||||
int ret;
|
||||
@@ -767,25 +790,20 @@ mlx5_tc_ct_shared_counter_get(struct mlx5_tc_ct_priv *ct_priv,
|
||||
rev_entry = rhashtable_lookup_fast(&ct_priv->ct_tuples_ht, &rev_tuple,
|
||||
tuples_ht_params);
|
||||
if (rev_entry) {
|
||||
if (refcount_inc_not_zero(&rev_entry->shared_counter->refcount)) {
|
||||
if (refcount_inc_not_zero(&rev_entry->counter->refcount)) {
|
||||
mutex_unlock(&ct_priv->shared_counter_lock);
|
||||
return rev_entry->shared_counter;
|
||||
return rev_entry->counter;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&ct_priv->shared_counter_lock);
|
||||
|
||||
shared_counter = kzalloc(sizeof(*shared_counter), GFP_KERNEL);
|
||||
if (!shared_counter)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
shared_counter->counter = mlx5_fc_create(dev, true);
|
||||
if (IS_ERR(shared_counter->counter)) {
|
||||
ct_dbg("Failed to create counter for ct entry");
|
||||
ret = PTR_ERR(shared_counter->counter);
|
||||
kfree(shared_counter);
|
||||
shared_counter = mlx5_tc_ct_counter_create(ct_priv);
|
||||
if (IS_ERR(shared_counter)) {
|
||||
ret = PTR_ERR(shared_counter);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
shared_counter->is_shared = true;
|
||||
refcount_set(&shared_counter->refcount, 1);
|
||||
return shared_counter;
|
||||
}
|
||||
@@ -798,10 +816,13 @@ mlx5_tc_ct_entry_add_rules(struct mlx5_tc_ct_priv *ct_priv,
|
||||
{
|
||||
int err;
|
||||
|
||||
entry->shared_counter = mlx5_tc_ct_shared_counter_get(ct_priv, entry);
|
||||
if (IS_ERR(entry->shared_counter)) {
|
||||
err = PTR_ERR(entry->shared_counter);
|
||||
ct_dbg("Failed to create counter for ct entry");
|
||||
if (nf_ct_acct_enabled(dev_net(ct_priv->netdev)))
|
||||
entry->counter = mlx5_tc_ct_counter_create(ct_priv);
|
||||
else
|
||||
entry->counter = mlx5_tc_ct_shared_counter_get(ct_priv, entry);
|
||||
|
||||
if (IS_ERR(entry->counter)) {
|
||||
err = PTR_ERR(entry->counter);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -820,7 +841,7 @@ mlx5_tc_ct_entry_add_rules(struct mlx5_tc_ct_priv *ct_priv,
|
||||
err_nat:
|
||||
mlx5_tc_ct_entry_del_rule(ct_priv, entry, false);
|
||||
err_orig:
|
||||
mlx5_tc_ct_shared_counter_put(ct_priv, entry);
|
||||
mlx5_tc_ct_counter_put(ct_priv, entry);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -918,7 +939,7 @@ mlx5_tc_ct_del_ft_entry(struct mlx5_tc_ct_priv *ct_priv,
|
||||
rhashtable_remove_fast(&ct_priv->ct_tuples_ht, &entry->tuple_node,
|
||||
tuples_ht_params);
|
||||
mutex_unlock(&ct_priv->shared_counter_lock);
|
||||
mlx5_tc_ct_shared_counter_put(ct_priv, entry);
|
||||
mlx5_tc_ct_counter_put(ct_priv, entry);
|
||||
|
||||
}
|
||||
|
||||
@@ -956,7 +977,7 @@ mlx5_tc_ct_block_flow_offload_stats(struct mlx5_ct_ft *ft,
|
||||
if (!entry)
|
||||
return -ENOENT;
|
||||
|
||||
mlx5_fc_query_cached(entry->shared_counter->counter, &bytes, &packets, &lastuse);
|
||||
mlx5_fc_query_cached(entry->counter->counter, &bytes, &packets, &lastuse);
|
||||
flow_stats_update(&f->stats, bytes, packets, 0, lastuse,
|
||||
FLOW_ACTION_HW_STATS_DELAYED);
|
||||
|
||||
|
||||
@@ -371,6 +371,15 @@ struct mlx5e_swp_spec {
|
||||
u8 tun_l4_proto;
|
||||
};
|
||||
|
||||
static inline void mlx5e_eseg_swp_offsets_add_vlan(struct mlx5_wqe_eth_seg *eseg)
|
||||
{
|
||||
/* SWP offsets are in 2-bytes words */
|
||||
eseg->swp_outer_l3_offset += VLAN_HLEN / 2;
|
||||
eseg->swp_outer_l4_offset += VLAN_HLEN / 2;
|
||||
eseg->swp_inner_l3_offset += VLAN_HLEN / 2;
|
||||
eseg->swp_inner_l4_offset += VLAN_HLEN / 2;
|
||||
}
|
||||
|
||||
static inline void
|
||||
mlx5e_set_eseg_swp(struct sk_buff *skb, struct mlx5_wqe_eth_seg *eseg,
|
||||
struct mlx5e_swp_spec *swp_spec)
|
||||
|
||||
@@ -51,7 +51,7 @@ static inline bool mlx5_geneve_tx_allowed(struct mlx5_core_dev *mdev)
|
||||
}
|
||||
|
||||
static inline void
|
||||
mlx5e_tx_tunnel_accel(struct sk_buff *skb, struct mlx5_wqe_eth_seg *eseg)
|
||||
mlx5e_tx_tunnel_accel(struct sk_buff *skb, struct mlx5_wqe_eth_seg *eseg, u16 ihs)
|
||||
{
|
||||
struct mlx5e_swp_spec swp_spec = {};
|
||||
unsigned int offset = 0;
|
||||
@@ -85,6 +85,8 @@ mlx5e_tx_tunnel_accel(struct sk_buff *skb, struct mlx5_wqe_eth_seg *eseg)
|
||||
}
|
||||
|
||||
mlx5e_set_eseg_swp(skb, eseg, &swp_spec);
|
||||
if (skb_vlan_tag_present(skb) && ihs)
|
||||
mlx5e_eseg_swp_offsets_add_vlan(eseg);
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -163,7 +165,7 @@ static inline unsigned int mlx5e_accel_tx_ids_len(struct mlx5e_txqsq *sq,
|
||||
|
||||
static inline bool mlx5e_accel_tx_eseg(struct mlx5e_priv *priv,
|
||||
struct sk_buff *skb,
|
||||
struct mlx5_wqe_eth_seg *eseg)
|
||||
struct mlx5_wqe_eth_seg *eseg, u16 ihs)
|
||||
{
|
||||
#ifdef CONFIG_MLX5_EN_IPSEC
|
||||
if (xfrm_offload(skb))
|
||||
@@ -172,7 +174,7 @@ static inline bool mlx5e_accel_tx_eseg(struct mlx5e_priv *priv,
|
||||
|
||||
#if IS_ENABLED(CONFIG_GENEVE)
|
||||
if (skb->encapsulation)
|
||||
mlx5e_tx_tunnel_accel(skb, eseg);
|
||||
mlx5e_tx_tunnel_accel(skb, eseg, ihs);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1010,6 +1010,22 @@ static int mlx5e_get_link_ksettings(struct net_device *netdev,
|
||||
return mlx5e_ethtool_get_link_ksettings(priv, link_ksettings);
|
||||
}
|
||||
|
||||
static int mlx5e_speed_validate(struct net_device *netdev, bool ext,
|
||||
const unsigned long link_modes, u8 autoneg)
|
||||
{
|
||||
/* Extended link-mode has no speed limitations. */
|
||||
if (ext)
|
||||
return 0;
|
||||
|
||||
if ((link_modes & MLX5E_PROT_MASK(MLX5E_56GBASE_R4)) &&
|
||||
autoneg != AUTONEG_ENABLE) {
|
||||
netdev_err(netdev, "%s: 56G link speed requires autoneg enabled\n",
|
||||
__func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 mlx5e_ethtool2ptys_adver_link(const unsigned long *link_modes)
|
||||
{
|
||||
u32 i, ptys_modes = 0;
|
||||
@@ -1103,13 +1119,9 @@ int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv,
|
||||
link_modes = autoneg == AUTONEG_ENABLE ? ethtool2ptys_adver_func(adver) :
|
||||
mlx5e_port_speed2linkmodes(mdev, speed, !ext);
|
||||
|
||||
if ((link_modes & MLX5E_PROT_MASK(MLX5E_56GBASE_R4)) &&
|
||||
autoneg != AUTONEG_ENABLE) {
|
||||
netdev_err(priv->netdev, "%s: 56G link speed requires autoneg enabled\n",
|
||||
__func__);
|
||||
err = -EINVAL;
|
||||
err = mlx5e_speed_validate(priv->netdev, ext, link_modes, autoneg);
|
||||
if (err)
|
||||
goto out;
|
||||
}
|
||||
|
||||
link_modes = link_modes & eproto.cap;
|
||||
if (!link_modes) {
|
||||
|
||||
@@ -942,6 +942,7 @@ static int mlx5e_create_ttc_table_groups(struct mlx5e_ttc_table *ttc,
|
||||
in = kvzalloc(inlen, GFP_KERNEL);
|
||||
if (!in) {
|
||||
kfree(ft->g);
|
||||
ft->g = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -1087,6 +1088,7 @@ static int mlx5e_create_inner_ttc_table_groups(struct mlx5e_ttc_table *ttc)
|
||||
in = kvzalloc(inlen, GFP_KERNEL);
|
||||
if (!in) {
|
||||
kfree(ft->g);
|
||||
ft->g = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -1390,6 +1392,7 @@ err_destroy_groups:
|
||||
ft->g[ft->num_groups] = NULL;
|
||||
mlx5e_destroy_groups(ft);
|
||||
kvfree(in);
|
||||
kfree(ft->g);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -3161,7 +3161,8 @@ static void mlx5e_modify_admin_state(struct mlx5_core_dev *mdev,
|
||||
|
||||
mlx5_set_port_admin_status(mdev, state);
|
||||
|
||||
if (mlx5_eswitch_mode(mdev) != MLX5_ESWITCH_LEGACY)
|
||||
if (mlx5_eswitch_mode(mdev) == MLX5_ESWITCH_OFFLOADS ||
|
||||
!MLX5_CAP_GEN(mdev, uplink_follow))
|
||||
return;
|
||||
|
||||
if (state == MLX5_PORT_UP)
|
||||
|
||||
@@ -682,9 +682,9 @@ void mlx5e_tx_mpwqe_ensure_complete(struct mlx5e_txqsq *sq)
|
||||
|
||||
static bool mlx5e_txwqe_build_eseg(struct mlx5e_priv *priv, struct mlx5e_txqsq *sq,
|
||||
struct sk_buff *skb, struct mlx5e_accel_tx_state *accel,
|
||||
struct mlx5_wqe_eth_seg *eseg)
|
||||
struct mlx5_wqe_eth_seg *eseg, u16 ihs)
|
||||
{
|
||||
if (unlikely(!mlx5e_accel_tx_eseg(priv, skb, eseg)))
|
||||
if (unlikely(!mlx5e_accel_tx_eseg(priv, skb, eseg, ihs)))
|
||||
return false;
|
||||
|
||||
mlx5e_txwqe_build_eseg_csum(sq, skb, accel, eseg);
|
||||
@@ -714,7 +714,8 @@ netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
if (mlx5e_tx_skb_supports_mpwqe(skb, &attr)) {
|
||||
struct mlx5_wqe_eth_seg eseg = {};
|
||||
|
||||
if (unlikely(!mlx5e_txwqe_build_eseg(priv, sq, skb, &accel, &eseg)))
|
||||
if (unlikely(!mlx5e_txwqe_build_eseg(priv, sq, skb, &accel, &eseg,
|
||||
attr.ihs)))
|
||||
return NETDEV_TX_OK;
|
||||
|
||||
mlx5e_sq_xmit_mpwqe(sq, skb, &eseg, netdev_xmit_more());
|
||||
@@ -731,7 +732,7 @@ netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
/* May update the WQE, but may not post other WQEs. */
|
||||
mlx5e_accel_tx_finish(sq, wqe, &accel,
|
||||
(struct mlx5_wqe_inline_seg *)(wqe->data + wqe_attr.ds_cnt_inl));
|
||||
if (unlikely(!mlx5e_txwqe_build_eseg(priv, sq, skb, &accel, &wqe->eth)))
|
||||
if (unlikely(!mlx5e_txwqe_build_eseg(priv, sq, skb, &accel, &wqe->eth, attr.ihs)))
|
||||
return NETDEV_TX_OK;
|
||||
|
||||
mlx5e_sq_xmit_wqe(sq, skb, &attr, &wqe_attr, wqe, pi, netdev_xmit_more());
|
||||
|
||||
@@ -95,22 +95,21 @@ int esw_acl_egress_lgcy_setup(struct mlx5_eswitch *esw,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!IS_ERR_OR_NULL(vport->egress.acl))
|
||||
return 0;
|
||||
if (!vport->egress.acl) {
|
||||
vport->egress.acl = esw_acl_table_create(esw, vport->vport,
|
||||
MLX5_FLOW_NAMESPACE_ESW_EGRESS,
|
||||
table_size);
|
||||
if (IS_ERR(vport->egress.acl)) {
|
||||
err = PTR_ERR(vport->egress.acl);
|
||||
vport->egress.acl = NULL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
vport->egress.acl = esw_acl_table_create(esw, vport->vport,
|
||||
MLX5_FLOW_NAMESPACE_ESW_EGRESS,
|
||||
table_size);
|
||||
if (IS_ERR(vport->egress.acl)) {
|
||||
err = PTR_ERR(vport->egress.acl);
|
||||
vport->egress.acl = NULL;
|
||||
goto out;
|
||||
err = esw_acl_egress_lgcy_groups_create(esw, vport);
|
||||
if (err)
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = esw_acl_egress_lgcy_groups_create(esw, vport);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
esw_debug(esw->dev,
|
||||
"vport[%d] configure egress rules, vlan(%d) qos(%d)\n",
|
||||
vport->vport, vport->info.vlan, vport->info.qos);
|
||||
|
||||
@@ -564,7 +564,9 @@ void mlx5_lag_add(struct mlx5_core_dev *dev, struct net_device *netdev)
|
||||
struct mlx5_core_dev *tmp_dev;
|
||||
int i, err;
|
||||
|
||||
if (!MLX5_CAP_GEN(dev, vport_group_manager))
|
||||
if (!MLX5_CAP_GEN(dev, vport_group_manager) ||
|
||||
!MLX5_CAP_GEN(dev, lag_master) ||
|
||||
MLX5_CAP_GEN(dev, num_lag_ports) != MLX5_MAX_PORTS)
|
||||
return;
|
||||
|
||||
tmp_dev = mlx5_get_next_phys_dev(dev);
|
||||
@@ -582,12 +584,9 @@ void mlx5_lag_add(struct mlx5_core_dev *dev, struct net_device *netdev)
|
||||
if (mlx5_lag_dev_add_pf(ldev, dev, netdev) < 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < MLX5_MAX_PORTS; i++) {
|
||||
tmp_dev = ldev->pf[i].dev;
|
||||
if (!tmp_dev || !MLX5_CAP_GEN(tmp_dev, lag_master) ||
|
||||
MLX5_CAP_GEN(tmp_dev, num_lag_ports) != MLX5_MAX_PORTS)
|
||||
for (i = 0; i < MLX5_MAX_PORTS; i++)
|
||||
if (!ldev->pf[i].dev)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= MLX5_MAX_PORTS)
|
||||
ldev->flags |= MLX5_LAG_FLAG_READY;
|
||||
|
||||
@@ -1368,8 +1368,10 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
MLX5_COREDEV_VF : MLX5_COREDEV_PF;
|
||||
|
||||
dev->priv.adev_idx = mlx5_adev_idx_alloc();
|
||||
if (dev->priv.adev_idx < 0)
|
||||
return dev->priv.adev_idx;
|
||||
if (dev->priv.adev_idx < 0) {
|
||||
err = dev->priv.adev_idx;
|
||||
goto adev_init_err;
|
||||
}
|
||||
|
||||
err = mlx5_mdev_init(dev, prof_sel);
|
||||
if (err)
|
||||
@@ -1403,6 +1405,7 @@ pci_init_err:
|
||||
mlx5_mdev_uninit(dev);
|
||||
mdev_init_err:
|
||||
mlx5_adev_idx_free(dev->priv.adev_idx);
|
||||
adev_init_err:
|
||||
mlx5_devlink_free(devlink);
|
||||
|
||||
return err;
|
||||
|
||||
@@ -116,7 +116,7 @@ free:
|
||||
static void mlx5_rdma_del_roce_addr(struct mlx5_core_dev *dev)
|
||||
{
|
||||
mlx5_core_roce_gid_set(dev, 0, 0, 0,
|
||||
NULL, NULL, false, 0, 0);
|
||||
NULL, NULL, false, 0, 1);
|
||||
}
|
||||
|
||||
static void mlx5_rdma_make_default_gid(struct mlx5_core_dev *dev, union ib_gid *gid)
|
||||
|
||||
@@ -506,10 +506,14 @@ static int mac_sonic_platform_probe(struct platform_device *pdev)
|
||||
|
||||
err = register_netdev(dev);
|
||||
if (err)
|
||||
goto out;
|
||||
goto undo_probe;
|
||||
|
||||
return 0;
|
||||
|
||||
undo_probe:
|
||||
dma_free_coherent(lp->device,
|
||||
SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
|
||||
lp->descriptors, lp->descriptors_laddr);
|
||||
out:
|
||||
free_netdev(dev);
|
||||
|
||||
@@ -584,12 +588,16 @@ static int mac_sonic_nubus_probe(struct nubus_board *board)
|
||||
|
||||
err = register_netdev(ndev);
|
||||
if (err)
|
||||
goto out;
|
||||
goto undo_probe;
|
||||
|
||||
nubus_set_drvdata(board, ndev);
|
||||
|
||||
return 0;
|
||||
|
||||
undo_probe:
|
||||
dma_free_coherent(lp->device,
|
||||
SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
|
||||
lp->descriptors, lp->descriptors_laddr);
|
||||
out:
|
||||
free_netdev(ndev);
|
||||
return err;
|
||||
|
||||
@@ -229,11 +229,14 @@ int xtsonic_probe(struct platform_device *pdev)
|
||||
sonic_msg_init(dev);
|
||||
|
||||
if ((err = register_netdev(dev)))
|
||||
goto out1;
|
||||
goto undo_probe1;
|
||||
|
||||
return 0;
|
||||
|
||||
out1:
|
||||
undo_probe1:
|
||||
dma_free_coherent(lp->device,
|
||||
SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
|
||||
lp->descriptors, lp->descriptors_laddr);
|
||||
release_region(dev->base_addr, SONIC_MEM_SIZE);
|
||||
out:
|
||||
free_netdev(dev);
|
||||
|
||||
@@ -78,6 +78,7 @@ config QED
|
||||
depends on PCI
|
||||
select ZLIB_INFLATE
|
||||
select CRC8
|
||||
select CRC32
|
||||
select NET_DEVLINK
|
||||
help
|
||||
This enables the support for Marvell FastLinQ adapters family.
|
||||
|
||||
@@ -64,6 +64,7 @@ struct emac_variant {
|
||||
* @variant: reference to the current board variant
|
||||
* @regmap: regmap for using the syscon
|
||||
* @internal_phy_powered: Does the internal PHY is enabled
|
||||
* @use_internal_phy: Is the internal PHY selected for use
|
||||
* @mux_handle: Internal pointer used by mdio-mux lib
|
||||
*/
|
||||
struct sunxi_priv_data {
|
||||
@@ -74,6 +75,7 @@ struct sunxi_priv_data {
|
||||
const struct emac_variant *variant;
|
||||
struct regmap_field *regmap_field;
|
||||
bool internal_phy_powered;
|
||||
bool use_internal_phy;
|
||||
void *mux_handle;
|
||||
};
|
||||
|
||||
@@ -539,8 +541,11 @@ static const struct stmmac_dma_ops sun8i_dwmac_dma_ops = {
|
||||
.dma_interrupt = sun8i_dwmac_dma_interrupt,
|
||||
};
|
||||
|
||||
static int sun8i_dwmac_power_internal_phy(struct stmmac_priv *priv);
|
||||
|
||||
static int sun8i_dwmac_init(struct platform_device *pdev, void *priv)
|
||||
{
|
||||
struct net_device *ndev = platform_get_drvdata(pdev);
|
||||
struct sunxi_priv_data *gmac = priv;
|
||||
int ret;
|
||||
|
||||
@@ -554,13 +559,25 @@ static int sun8i_dwmac_init(struct platform_device *pdev, void *priv)
|
||||
|
||||
ret = clk_prepare_enable(gmac->tx_clk);
|
||||
if (ret) {
|
||||
if (gmac->regulator)
|
||||
regulator_disable(gmac->regulator);
|
||||
dev_err(&pdev->dev, "Could not enable AHB clock\n");
|
||||
return ret;
|
||||
goto err_disable_regulator;
|
||||
}
|
||||
|
||||
if (gmac->use_internal_phy) {
|
||||
ret = sun8i_dwmac_power_internal_phy(netdev_priv(ndev));
|
||||
if (ret)
|
||||
goto err_disable_clk;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_disable_clk:
|
||||
clk_disable_unprepare(gmac->tx_clk);
|
||||
err_disable_regulator:
|
||||
if (gmac->regulator)
|
||||
regulator_disable(gmac->regulator);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void sun8i_dwmac_core_init(struct mac_device_info *hw,
|
||||
@@ -831,7 +848,6 @@ static int mdio_mux_syscon_switch_fn(int current_child, int desired_child,
|
||||
struct sunxi_priv_data *gmac = priv->plat->bsp_priv;
|
||||
u32 reg, val;
|
||||
int ret = 0;
|
||||
bool need_power_ephy = false;
|
||||
|
||||
if (current_child ^ desired_child) {
|
||||
regmap_field_read(gmac->regmap_field, ®);
|
||||
@@ -839,13 +855,12 @@ static int mdio_mux_syscon_switch_fn(int current_child, int desired_child,
|
||||
case DWMAC_SUN8I_MDIO_MUX_INTERNAL_ID:
|
||||
dev_info(priv->device, "Switch mux to internal PHY");
|
||||
val = (reg & ~H3_EPHY_MUX_MASK) | H3_EPHY_SELECT;
|
||||
|
||||
need_power_ephy = true;
|
||||
gmac->use_internal_phy = true;
|
||||
break;
|
||||
case DWMAC_SUN8I_MDIO_MUX_EXTERNAL_ID:
|
||||
dev_info(priv->device, "Switch mux to external PHY");
|
||||
val = (reg & ~H3_EPHY_MUX_MASK) | H3_EPHY_SHUTDOWN;
|
||||
need_power_ephy = false;
|
||||
gmac->use_internal_phy = false;
|
||||
break;
|
||||
default:
|
||||
dev_err(priv->device, "Invalid child ID %x\n",
|
||||
@@ -853,7 +868,7 @@ static int mdio_mux_syscon_switch_fn(int current_child, int desired_child,
|
||||
return -EINVAL;
|
||||
}
|
||||
regmap_field_write(gmac->regmap_field, val);
|
||||
if (need_power_ephy) {
|
||||
if (gmac->use_internal_phy) {
|
||||
ret = sun8i_dwmac_power_internal_phy(priv);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -883,22 +898,23 @@ static int sun8i_dwmac_register_mdio_mux(struct stmmac_priv *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv)
|
||||
static int sun8i_dwmac_set_syscon(struct device *dev,
|
||||
struct plat_stmmacenet_data *plat)
|
||||
{
|
||||
struct sunxi_priv_data *gmac = priv->plat->bsp_priv;
|
||||
struct device_node *node = priv->device->of_node;
|
||||
struct sunxi_priv_data *gmac = plat->bsp_priv;
|
||||
struct device_node *node = dev->of_node;
|
||||
int ret;
|
||||
u32 reg, val;
|
||||
|
||||
ret = regmap_field_read(gmac->regmap_field, &val);
|
||||
if (ret) {
|
||||
dev_err(priv->device, "Fail to read from regmap field.\n");
|
||||
dev_err(dev, "Fail to read from regmap field.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
reg = gmac->variant->default_syscon_value;
|
||||
if (reg != val)
|
||||
dev_warn(priv->device,
|
||||
dev_warn(dev,
|
||||
"Current syscon value is not the default %x (expect %x)\n",
|
||||
val, reg);
|
||||
|
||||
@@ -911,9 +927,9 @@ static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv)
|
||||
/* Force EPHY xtal frequency to 24MHz. */
|
||||
reg |= H3_EPHY_CLK_SEL;
|
||||
|
||||
ret = of_mdio_parse_addr(priv->device, priv->plat->phy_node);
|
||||
ret = of_mdio_parse_addr(dev, plat->phy_node);
|
||||
if (ret < 0) {
|
||||
dev_err(priv->device, "Could not parse MDIO addr\n");
|
||||
dev_err(dev, "Could not parse MDIO addr\n");
|
||||
return ret;
|
||||
}
|
||||
/* of_mdio_parse_addr returns a valid (0 ~ 31) PHY
|
||||
@@ -929,17 +945,17 @@ static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv)
|
||||
|
||||
if (!of_property_read_u32(node, "allwinner,tx-delay-ps", &val)) {
|
||||
if (val % 100) {
|
||||
dev_err(priv->device, "tx-delay must be a multiple of 100\n");
|
||||
dev_err(dev, "tx-delay must be a multiple of 100\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
val /= 100;
|
||||
dev_dbg(priv->device, "set tx-delay to %x\n", val);
|
||||
dev_dbg(dev, "set tx-delay to %x\n", val);
|
||||
if (val <= gmac->variant->tx_delay_max) {
|
||||
reg &= ~(gmac->variant->tx_delay_max <<
|
||||
SYSCON_ETXDC_SHIFT);
|
||||
reg |= (val << SYSCON_ETXDC_SHIFT);
|
||||
} else {
|
||||
dev_err(priv->device, "Invalid TX clock delay: %d\n",
|
||||
dev_err(dev, "Invalid TX clock delay: %d\n",
|
||||
val);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -947,17 +963,17 @@ static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv)
|
||||
|
||||
if (!of_property_read_u32(node, "allwinner,rx-delay-ps", &val)) {
|
||||
if (val % 100) {
|
||||
dev_err(priv->device, "rx-delay must be a multiple of 100\n");
|
||||
dev_err(dev, "rx-delay must be a multiple of 100\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
val /= 100;
|
||||
dev_dbg(priv->device, "set rx-delay to %x\n", val);
|
||||
dev_dbg(dev, "set rx-delay to %x\n", val);
|
||||
if (val <= gmac->variant->rx_delay_max) {
|
||||
reg &= ~(gmac->variant->rx_delay_max <<
|
||||
SYSCON_ERXDC_SHIFT);
|
||||
reg |= (val << SYSCON_ERXDC_SHIFT);
|
||||
} else {
|
||||
dev_err(priv->device, "Invalid RX clock delay: %d\n",
|
||||
dev_err(dev, "Invalid RX clock delay: %d\n",
|
||||
val);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -968,7 +984,7 @@ static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv)
|
||||
if (gmac->variant->support_rmii)
|
||||
reg &= ~SYSCON_RMII_EN;
|
||||
|
||||
switch (priv->plat->interface) {
|
||||
switch (plat->interface) {
|
||||
case PHY_INTERFACE_MODE_MII:
|
||||
/* default */
|
||||
break;
|
||||
@@ -982,8 +998,8 @@ static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv)
|
||||
reg |= SYSCON_RMII_EN | SYSCON_ETCS_EXT_GMII;
|
||||
break;
|
||||
default:
|
||||
dev_err(priv->device, "Unsupported interface mode: %s",
|
||||
phy_modes(priv->plat->interface));
|
||||
dev_err(dev, "Unsupported interface mode: %s",
|
||||
phy_modes(plat->interface));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -1004,17 +1020,10 @@ static void sun8i_dwmac_exit(struct platform_device *pdev, void *priv)
|
||||
struct sunxi_priv_data *gmac = priv;
|
||||
|
||||
if (gmac->variant->soc_has_internal_phy) {
|
||||
/* sun8i_dwmac_exit could be called with mdiomux uninit */
|
||||
if (gmac->mux_handle)
|
||||
mdio_mux_uninit(gmac->mux_handle);
|
||||
if (gmac->internal_phy_powered)
|
||||
sun8i_dwmac_unpower_internal_phy(gmac);
|
||||
}
|
||||
|
||||
sun8i_dwmac_unset_syscon(gmac);
|
||||
|
||||
reset_control_put(gmac->rst_ephy);
|
||||
|
||||
clk_disable_unprepare(gmac->tx_clk);
|
||||
|
||||
if (gmac->regulator)
|
||||
@@ -1049,16 +1058,11 @@ static struct mac_device_info *sun8i_dwmac_setup(void *ppriv)
|
||||
{
|
||||
struct mac_device_info *mac;
|
||||
struct stmmac_priv *priv = ppriv;
|
||||
int ret;
|
||||
|
||||
mac = devm_kzalloc(priv->device, sizeof(*mac), GFP_KERNEL);
|
||||
if (!mac)
|
||||
return NULL;
|
||||
|
||||
ret = sun8i_dwmac_set_syscon(priv);
|
||||
if (ret)
|
||||
return NULL;
|
||||
|
||||
mac->pcsr = priv->ioaddr;
|
||||
mac->mac = &sun8i_dwmac_ops;
|
||||
mac->dma = &sun8i_dwmac_dma_ops;
|
||||
@@ -1134,10 +1138,6 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
plat_dat = stmmac_probe_config_dt(pdev, &stmmac_res.mac);
|
||||
if (IS_ERR(plat_dat))
|
||||
return PTR_ERR(plat_dat);
|
||||
|
||||
gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL);
|
||||
if (!gmac)
|
||||
return -ENOMEM;
|
||||
@@ -1201,11 +1201,15 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
|
||||
ret = of_get_phy_mode(dev->of_node, &interface);
|
||||
if (ret)
|
||||
return -EINVAL;
|
||||
plat_dat->interface = interface;
|
||||
|
||||
plat_dat = stmmac_probe_config_dt(pdev, &stmmac_res.mac);
|
||||
if (IS_ERR(plat_dat))
|
||||
return PTR_ERR(plat_dat);
|
||||
|
||||
/* platform data specifying hardware features and callbacks.
|
||||
* hardware features were copied from Allwinner drivers.
|
||||
*/
|
||||
plat_dat->interface = interface;
|
||||
plat_dat->rx_coe = STMMAC_RX_COE_TYPE2;
|
||||
plat_dat->tx_coe = 1;
|
||||
plat_dat->has_sun8i = true;
|
||||
@@ -1214,9 +1218,13 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
|
||||
plat_dat->exit = sun8i_dwmac_exit;
|
||||
plat_dat->setup = sun8i_dwmac_setup;
|
||||
|
||||
ret = sun8i_dwmac_set_syscon(&pdev->dev, plat_dat);
|
||||
if (ret)
|
||||
goto dwmac_deconfig;
|
||||
|
||||
ret = sun8i_dwmac_init(pdev, plat_dat->bsp_priv);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto dwmac_syscon;
|
||||
|
||||
ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
|
||||
if (ret)
|
||||
@@ -1230,7 +1238,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
|
||||
if (gmac->variant->soc_has_internal_phy) {
|
||||
ret = get_ephy_nodes(priv);
|
||||
if (ret)
|
||||
goto dwmac_exit;
|
||||
goto dwmac_remove;
|
||||
ret = sun8i_dwmac_register_mdio_mux(priv);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Failed to register mux\n");
|
||||
@@ -1239,15 +1247,42 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
|
||||
} else {
|
||||
ret = sun8i_dwmac_reset(priv);
|
||||
if (ret)
|
||||
goto dwmac_exit;
|
||||
goto dwmac_remove;
|
||||
}
|
||||
|
||||
return ret;
|
||||
dwmac_mux:
|
||||
sun8i_dwmac_unset_syscon(gmac);
|
||||
reset_control_put(gmac->rst_ephy);
|
||||
clk_put(gmac->ephy_clk);
|
||||
dwmac_remove:
|
||||
stmmac_dvr_remove(&pdev->dev);
|
||||
dwmac_exit:
|
||||
sun8i_dwmac_exit(pdev, gmac);
|
||||
dwmac_syscon:
|
||||
sun8i_dwmac_unset_syscon(gmac);
|
||||
dwmac_deconfig:
|
||||
stmmac_remove_config_dt(pdev, plat_dat);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sun8i_dwmac_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct net_device *ndev = platform_get_drvdata(pdev);
|
||||
struct stmmac_priv *priv = netdev_priv(ndev);
|
||||
struct sunxi_priv_data *gmac = priv->plat->bsp_priv;
|
||||
|
||||
if (gmac->variant->soc_has_internal_phy) {
|
||||
mdio_mux_uninit(gmac->mux_handle);
|
||||
sun8i_dwmac_unpower_internal_phy(gmac);
|
||||
reset_control_put(gmac->rst_ephy);
|
||||
clk_put(gmac->ephy_clk);
|
||||
}
|
||||
|
||||
stmmac_pltfr_remove(pdev);
|
||||
return ret;
|
||||
sun8i_dwmac_unset_syscon(gmac);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id sun8i_dwmac_match[] = {
|
||||
@@ -1269,7 +1304,7 @@ MODULE_DEVICE_TABLE(of, sun8i_dwmac_match);
|
||||
|
||||
static struct platform_driver sun8i_dwmac_driver = {
|
||||
.probe = sun8i_dwmac_probe,
|
||||
.remove = stmmac_pltfr_remove,
|
||||
.remove = sun8i_dwmac_remove,
|
||||
.driver = {
|
||||
.name = "dwmac-sun8i",
|
||||
.pm = &stmmac_pltfr_pm_ops,
|
||||
|
||||
Reference in New Issue
Block a user