Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  hv.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
// Copyright (c) 2018 Mellanox Technologies

#include <linux/hyperv.h>
#include "mlx5_core.h"
#include "lib/hv.h"

static int mlx5_hv_config_common(struct mlx5_core_dev *dev, void *buf, int len,
     int offset, bool read)
{
 int rc = -EOPNOTSUPP;
 int bytes_returned;
 int block_id;

 if (offset % HV_CONFIG_BLOCK_SIZE_MAX || len != HV_CONFIG_BLOCK_SIZE_MAX)
  return -EINVAL;

 block_id = offset / HV_CONFIG_BLOCK_SIZE_MAX;

 rc = read ?
      hyperv_read_cfg_blk(dev->pdev, buf,
     HV_CONFIG_BLOCK_SIZE_MAX, block_id,
     &bytes_returned) :
      hyperv_write_cfg_blk(dev->pdev, buf,
      HV_CONFIG_BLOCK_SIZE_MAX, block_id);

 /* Make sure len bytes were read successfully  */
 if (read && !rc && len != bytes_returned)
  rc = -EIO;

 if (rc) {
  mlx5_core_err(dev, "Failed to %s hv config, err = %d, len = %d, offset = %d\n",
         read ? "read" : "write", rc, len,
         offset);
  return rc;
 }

 return 0;
}

int mlx5_hv_read_config(struct mlx5_core_dev *dev, void *buf, int len,
   int offset)
{
 return mlx5_hv_config_common(dev, buf, len, offset, true);
}

int mlx5_hv_write_config(struct mlx5_core_dev *dev, void *buf, int len,
    int offset)
{
 return mlx5_hv_config_common(dev, buf, len, offset, false);
}

int mlx5_hv_register_invalidate(struct mlx5_core_dev *dev, void *context,
    void (*block_invalidate)(void *context,
        u64 block_mask))
{
 return hyperv_reg_block_invalidate(dev->pdev, context,
        block_invalidate);
}

void mlx5_hv_unregister_invalidate(struct mlx5_core_dev *dev)
{
 hyperv_reg_block_invalidate(dev->pdev, NULL, NULL);
}

Messung V0.5
C=99 H=92 G=95

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge